Skip to content

authhelper: Support LLM assisted auth, phase 1 - #7637

Open
psiinon wants to merge 1 commit into
zaproxy:mainfrom
psiinon:authhelper/llmauth
Open

authhelper: Support LLM assisted auth, phase 1#7637
psiinon wants to merge 1 commit into
zaproxy:mainfrom
psiinon:authhelper/llmauth

Conversation

@psiinon

@psiinon psiinon commented Aug 12, 2026

Copy link
Copy Markdown
Member

Add an AI Assisted authentication method which is available via the Authentication tester and the Content / Authentication dialogs.
Does not provide AF support or diagnostic integration - these will be added in future PRs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds LLM-assisted, multi-step authentication to Auth Helper and converts successful browser actions into a reusable Zest client-authentication script.

Changes:

  • Adds the AI authentication method, browser action loop, and Zest generation.
  • Integrates AI authentication into configuration and Authentication Tester dialogs.
  • Adds documentation, tests, persistence settings, and a development test flow.

Reviewed changes

Copilot reviewed 48 out of 48 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
dev/.../MultiStepAuthHomePageUnitTest.java Tests session redirects.
dev/.../multi-step-auth/step2.html Adds department step.
dev/.../multi-step-auth/password.html Adds password step.
dev/.../multi-step-auth/index.html Adds initial login step.
dev/.../multi-step-auth/home.html Adds authenticated page.
dev/.../TestProxyServer.java Registers test flow.
dev/.../MultiStepAuthVerificationPage.java Adds verification endpoint.
dev/.../MultiStepAuthStep2Page.java Serves step two.
dev/.../MultiStepAuthPasswordPage.java Serves password step.
dev/.../MultiStepAuthLoginPage.java Validates login data.
dev/.../MultiStepAuthHomePage.java Protects the home page.
dev/.../MultiStepAuthDir.java Defines test-flow routes.
authhelper/.../AiAuthZestBuilderUnitTest.java Tests Zest generation.
authhelper/.../AiAuthScriptGeneratorUnitTest.java Tests actions and LLM loop.
authhelper/.../AiAuthSchemaUnitTest.java Tests AI JSON schemas.
authhelper/.../AiAssistedAuthenticationMethodTypeUnitTest.java Tests method configuration.
authhelper/.../AuthTestDialogUnitTest.java Tests method selection mapping.
authhelper/.../AuthhelperParamUnitTest.java Tests saved tester method.
authhelper/.../Messages.properties Adds localized UI strings.
authhelper/.../help/toc.xml Adds help navigation.
authhelper/.../help/map.jhm Maps AI help page.
authhelper/.../help/index.xml Indexes AI help.
authhelper/.../contents/client-script.html Documents generated scripts.
authhelper/.../contents/authhelper.html Links AI authentication.
authhelper/.../contents/auth-tester.html Documents tester integration.
authhelper/.../contents/ai-auth.html Documents AI authentication.
authhelper/.../ExtensionAuthhelperLlm.java Registers optional LLM support.
authhelper/.../AiAuthZestBuilder.java Builds replayable Zest scripts.
authhelper/.../AiAuthTurnPayload.java Defines LLM turn payloads.
authhelper/.../AiAuthSuccessIndicatorType.java Defines success indicators.
authhelper/.../AiAuthSuccessIndicator.java Models success detection.
authhelper/.../AiAuthState.java Defines authentication states.
authhelper/.../AiAuthScriptGenerator.java Drives LLM browser automation.
authhelper/.../AiAuthResult.java Models final results.
authhelper/.../AiAuthResponse.java Models LLM responses.
authhelper/.../AiAuthInputElement.java Models page elements.
authhelper/.../AiAuthActionType.java Defines supported actions.
authhelper/.../AiAuthActionResult.java Models action outcomes.
authhelper/.../AiAuthAction.java Models requested actions.
authhelper/.../AiAssistedAuthenticationMethodType.java Implements the authentication method.
authhelper/.../BrowserBasedAuthenticationMethodType.java Reuses shared UI fields.
authhelper/.../AuthUtils.java Adds AI result statistics.
authhelper/.../AuthTestDialog.java Adds AI tester support.
authhelper/.../AuthMethodOptionsPanelUtils.java Extracts shared UI construction.
authhelper/.../AuthhelperParam.java Persists method and hints.
authhelper/.../AiAssistedAuthTesterSupport.java Defines tester integration contract.
authhelper/CHANGELOG.md Records the new functionality.
authhelper/authhelper.gradle.kts Adds the optional LLM extension.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +210 to +211
LlmCommunicationService llm =
extLlm.getCommunicationService("authhelper-ai-auth", null);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concurrent runs are not possible via the UI. I'm ok with requiring the users to close the tab if they want to loose the history

Comment on lines +339 to +343
java.net.URI uri = new java.net.URI(loginPageUrl);
String host = uri.getHost();
int port = uri.getPort();
String hostPart = (port > 0) ? host + ":" + port : host;
return "AI Auth - " + hostPart;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems very unlikely to me, so I'm fine with that restriction.

Comment on lines +433 to +437
case SEND_KEYS -> {
try {
String value = substituteCredentials(action.value(), username, password);
element.clear();
element.sendKeys(value);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model cannot navigate to another page.

@psiinon

psiinon commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

Logo
Checkmarx One – Scan Summary & Details3098e7c3-5dc4-430c-abf0-116ccba3b491


New Issues (11)

Medium: 11

Checkmarx found the following issues in this Pull Request

# Severity Issue Source File / Package Checkmarx Insight
1 MEDIUM Privacy_Violation addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java: 299
detailsMethod at line 299 of /addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java sends user information outside the ap...
Attack Vector
2 MEDIUM Privacy_Violation addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java: 299
detailsMethod at line 299 of /addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java sends user information outside the ap...
Attack Vector
3 MEDIUM Privacy_Violation addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java: 299
detailsMethod at line 299 of /addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java sends user information outside the ap...
Attack Vector
4 MEDIUM Privacy_Violation addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java: 298
detailsMethod at line 298 of /addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java sends user information outside the ap...
Attack Vector
5 MEDIUM Privacy_Violation addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java: 298
detailsMethod at line 298 of /addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java sends user information outside the ap...
Attack Vector
6 MEDIUM Privacy_Violation addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java: 299
detailsMethod at line 299 of /addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java sends user information outside the ap...
Attack Vector
7 MEDIUM Privacy_Violation addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java: 298
detailsMethod at line 298 of /addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java sends user information outside the ap...
Attack Vector
8 MEDIUM Privacy_Violation addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java: 298
detailsMethod at line 298 of /addOns/llm/src/main/java/org/zaproxy/addon/llm/services/LlmCommunicationService.java sends user information outside the ap...
Attack Vector
9 MEDIUM Privacy_Violation addOns/dev/src/main/java/org/zaproxy/addon/dev/TestAuthDirectory.java: 39
detailsMethod at line 39 of /addOns/dev/src/main/java/org/zaproxy/addon/dev/TestAuthDirectory.java sends user information outside the application. This...
Attack Vector
10 MEDIUM Use_Of_Hardcoded_Password addOns/authhelper/src/test/java/org/zaproxy/addon/authhelper/llm/AiAuthScriptGeneratorUnitTest.java: 54
detailsThe application uses the hard-coded password PASSWORD for authentication purposes, either using it to verify users' identities, or to access anoth...
Attack Vector
11 MEDIUM Use_Of_Hardcoded_Password addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/llm/AiAuthTurnPayload.java: 65
detailsThe application uses the hard-coded password PASSWORD_PLACEHOLDER for authentication purposes, either using it to verify users' identities, or to...
Attack Vector

Fixed Issues (1)

Low: 1

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
LOW Log_Forging addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/BrowserBasedAuthenticationMethodType.java: 804

Use @Checkmarx to interact with Checkmarx PR Assistant.
Examples:
@Checkmarx how are you able to help me?
@Checkmarx rescan this PR

@psiinon
psiinon force-pushed the authhelper/llmauth branch 2 times, most recently from 37c04d2 to c3a5acf Compare August 17, 2026 12:31
@psiinon
psiinon marked this pull request as ready for review August 17, 2026 12:34
@psiinon

psiinon commented Aug 17, 2026

Copy link
Copy Markdown
Member Author

Ready for review 😁

Signed-off-by: Simon Bennetts <psiinon@gmail.com>
@psiinon
psiinon force-pushed the authhelper/llmauth branch from c3a5acf to 915e855 Compare August 17, 2026 15:20
@psiinon

psiinon commented Aug 17, 2026

Copy link
Copy Markdown
Member Author

Added Automation Framework support for the method (not LLMs in general).
An example which will work with the dev add-on is as follows. Note that a valid LLM model and provider must be configured manually first. The same details can be used in the Authentication Tester.

env:
  contexts:
  - name: LLM Auth Test
    urls:
    - http://localhost:9091/
    includePaths:
    - http://localhost:9091/.*
    authentication:
      method: ai
      parameters:
        loginPageUrl: http://localhost:9091/auth/multi-step-auth/
        loginPageWait: 3
        browserId: firefox
        hint: "the domain should be Project1"
        stepDelay: 2
        steps: []
      verification:
        method: autodetect
    sessionManagement:
      method: autodetect
    technology: {}
    structure: {}
    users:
    - name: testuser
      credentials:
        password: password123
        username: test@test.com
  parameters: {}
jobs:
- type: requestor
  parameters:
    user: testuser
  requests:
  - url: http://localhost:9091/auth/multi-step-auth/
    method: GET
    responseCode: 200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants