Authentication
Overview
Many applications have functionality behind authentication - admin panels, user dashboards, API endpoints requiring authorization, and more. To test these protected areas, Pensar needs authentication credentials. This guide explains how to provide credentials so the AI agent can authenticate and test your entire application surface.
Authentication credentials are provided when adding domains to your workspace. They’re stored securely and only used during penetration testing.
Why Provide Authentication?
Testing authenticated areas of your application is critical for comprehensive security coverage:
Test for broken access control, privilege escalation, and improper authorization checks.
Access endpoints and functionality that require authentication, dramatically increasing test coverage.
Discover Insecure Direct Object Reference (IDOR) vulnerabilities where users can access other users’ data.
Test session management, token handling, and authentication mechanism security.
Supported Authentication Types
Pensar supports multiple authentication mechanisms:
Username & Password
Bearer Token
Custom Headers
The most common authentication method for web applications.
What to Provide
- Username or Email: The credential used to log in
- Password: The corresponding password
- Role: Description of the user role (e.g., “admin”, “standard user”, “manager”)
- Context: Detailed instructions on how to use these credentials for authentication
Example Configuration
Create a dedicated test account for Pensar rather than using production user credentials. This account should have representative permissions but not access to sensitive production data.
Adding Authentication Credentials
Authentication is configured when adding domains to your workspace:
Choose Authentication Type
Select the authentication method your application uses (username/password, bearer token, etc.).
The AI agent uses your provided context to understand how to authenticate. The more detailed your context, the better the agent can navigate authentication flows.
TOTP seeds
Use a TOTP seed when a test account signs in with an authenticator app that generates a rotating code. This is different from an SMS-delivered code: see Mobile OTP below for that flow.
TOTP is an additional secret on a Username & Password credential, not a separate credential type. Pensar supports standard six-digit, 30-second, SHA-1 TOTP codes.
Configure a test credential
Use a dedicated test account
Create or use a test account with representative permissions. Do not use an employee account or an account that can access real customer data.
Obtain the authenticator setup key
During MFA enrollment, the application provides a QR code and often a manual setup key. Copy the base32 setup key. If the account is already enrolled and the application will not reveal the key, reset and re-enroll MFA for the dedicated test account.
Use the setup key, not a current code
The enrollment QR code represents a value like
otpauth://totp/...?...&secret=BASE32_SETUP_KEY. Enter only the base32 value
from the secret parameter.
Do not enter:
- A current six-digit code from an authenticator app — it expires and cannot generate future codes.
- The full
otpauth://URI or a QR-code image. - A recovery code, passkey, push-approval token, or SMS code.
The TOTP seed is as sensitive as a password. Do not paste it into credential context, agent instructions, chat, tickets, scripts, logs, or third-party QR-code decoders.
How Pensar uses the seed
Pensar stores the seed as encrypted credential data. The agent is told that a TOTP secret exists, but the value is injected only into the isolated test run when it is needed and is redacted from agent output.
Immediately before an authenticator prompt, Apex computes the current six-digit code from the seed and the current time. Codes rotate every 30 seconds. If a submission crosses a time-window boundary, the agent generates a fresh code and retries once.
Each account needs its own seed. Add TOTP_SEED separately to every credential
whose account has a different authenticator enrollment. Edited credentials apply
to newly dispatched runs; a sandbox that is already running keeps the
credential snapshot with which it started.
TOTP and Mobile OTP
Authenticator TOTP
Mobile OTP
The application asks for a code from an authenticator app such as 1Password,
Google Authenticator, or Authy. Add the account’s base32 setup key as the
TOTP_SEED additional secret.
Troubleshoot TOTP authentication
Fresh codes are rejected
Confirm the seed belongs to the exact test account and that the provider uses six-digit, 30-second, SHA-1 TOTP. Re-enroll the account if the seed is stale or the provider uses a different algorithm, code length, or rotation interval.
A pentest still reports an MFA barrier
Retest the credential first. Then start a new run or restart the affected endpoints: active sandboxes do not reload edited credentials.
The provider asks for push approval, a passkey, or WebAuthn
These verification methods are not TOTP. Configure an alternative dedicated test-account flow, such as standard TOTP or SMS Mobile OTP, for autonomous testing.
Context Examples
Providing good context is crucial for successful authentication. Here are examples:
Simple Login Form
Multi-Step Authentication
Security Best Practices
Use Test Accounts
Always create dedicated test accounts for Pensar:
- Don’t use production user accounts
- Don’t use accounts with access to real customer data
- Create accounts specifically for security testing
- Use realistic permissions but isolate from production data
Never provide credentials for accounts with access to sensitive production data or systems.
Limit Permissions
Test accounts should have representative permissions but be limited:
- Grant enough access to test key functionality
- Avoid overly privileged accounts (e.g., super admin)
- Use role-based access control to limit scope
- Test multiple permission levels by providing multiple accounts
Consider providing multiple test accounts with different roles:
- Regular user account
- Manager/power user account
- Limited admin account
Use Staging Environments
When possible, test against staging rather than production:
- Staging credentials can be less restrictive
- No risk to production data or systems
- More flexibility for destructive testing
- Easier to reset state between tests
Rotate Test Credentials
Regularly rotate and update test credentials:
- Change test account passwords periodically
- Regenerate API tokens regularly
- Remove unused test accounts
- Monitor test account activity
Secure Credential Storage
Pensar handles credentials securely:
- Credentials are encrypted at rest
- Transmitted only over secure connections
- Only used during active penetration tests
- Not logged or exposed in reports
- Accessible only to your workspace team
You can update or remove credentials anytime in the Console.
Testing Multiple User Roles
To comprehensively test authorization, provide credentials for multiple user roles:
Troubleshooting Authentication
If authentication isn’t working during testing:
Verify Credentials Manually
Test the credentials yourself:
- Log in manually using the provided credentials
- Ensure the credentials still work
- Verify the account hasn’t been locked or disabled
- Check that the credentials have expected permissions
Check Context Accuracy
Review your authentication context: - Are all steps clearly explained? - Is the login URL correct? - Are there any missing steps (e.g., CAPTCHAs, 2FA)? - Does the flow match the current application behavior?
Review Test Results
Check the test logs in Pensar Console: - Look for authentication error messages - Verify the agent is following your auth steps correctly - Check if rate limiting is blocking login attempts - See if sessions are expiring too quickly
Update Configuration
Update your authentication configuration:
- Provide more detailed context
- Use a different authentication method if available
- Generate new tokens or passwords
- Add troubleshooting notes for the agent
Example Configurations
Here are complete examples for common scenarios: