Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PA-13820 Support regex for authVerificationURL #112

Merged
merged 3 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The basic command to run a baseline scan would look like:
| `--authSubmitField` | | Submit button id to use when authentication is required |
| `--authUsername` | | Username to use when authentication is required |
| `--authUsernameField` | | Username input id to use when authentication is required |
| `--authVerificationURL` | | URL used to verify authentication success, should be an URL that is expected to throw 200/302 during any authFormType authentication. If authentication fails when this URL is provided, the scan will be terminated. |
| `--authVerificationURL` | | URL used to verify authentication success, should be an URL that is expected to throw 200/302 during any authFormType authentication. If authentication fails when this URL is provided, the scan will be terminated. Supports plain URL or regex URL.|
| `--bearerToken` | | Bearer token to authenticate |
| `--branchName` | | The name of the branch from the SCM System |
| `--branchURI` | | The URI to the branch from the SCM System |
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "soos-dast",
"version": "2.0.31",
"version": "2.0.32",
SOOS-MMalony marked this conversation as resolved.
Show resolved Hide resolved
"description": "SOOS DAST - The affordable no limit web vulnerability scanner",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class SOOSDASTAnalysis {
});

analysisArgumentParser.argumentParser.add_argument("--authVerificationURL", {
help: "URL used to verify authentication success, should be an URL that is expected to throw 200/302 during any authFormType authentication. If authentication fails when this URL is provided, the scan will be terminated.",
help: "URL used to verify authentication success, should be an URL that is expected to throw 200/302 during any authFormType authentication. If authentication fails when this URL is provided, the scan will be terminated. Supports plain URL or regex URL.",
required: false,
});

Expand Down
5 changes: 3 additions & 2 deletions src/zap_hooks/helpers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,15 @@ def validate_authentication_url(driver, url):
log(f"Validating authentication url: {url}")
url_found = False
for request in driver.requests:
if request.response and url in request.url:
if request.response and (url in request.url or search(url, request.url) is not None):
SOOS-MMalony marked this conversation as resolved.
Show resolved Hide resolved
url_found = True
log(f"Checking response status code {request.response}")
log(f"Checking response status code {request.response} for {request.url}")
if request.response.status_code not in [200, 302]:
log(f"Status code is not 200/302 for {request.url}, it is {request.response.status_code}")
sys.exit(1)
else:
log(f"Status code is {request.response.status_code} for {request.url}, authentication was successful")
break
SOOS-MMalony marked this conversation as resolved.
Show resolved Hide resolved
if not url_found:
log(f"Authentication url {url} was not found, authentication failed.")
sys.exit(1)
Expand Down
Loading