Skip to content

Conversation

@LakshmiSHR
Copy link

@LakshmiSHR LakshmiSHR commented Nov 28, 2025

Enhancement: Improve detection of version information in HTTP Server header

This PR is related to Issue zaproxy/zaproxy#9160 by enhancing the version-detection logic in ServerHeaderInfoLeakScanRule.

Key Improvements:

  • Replaced weak version check (.*\d.*) with stricter regex: \d+\.\d+(?:\.\d+)?
    • Now accurately detects version-like patterns (e.g., 2.4, 1.8.0, 2.4.49)
  • Changed matches() to find() to correctly identify versions inside strings such as:
    • Apache/2.4.49 (Unix)
    • nginx/1.21.6
  • Preserved existing behavior:
    • At LOW threshold → still alerts for presence of Server header
    • Raises version-leak alert only when version information is present

Let me know if further expansion is needed (e.g., detecting more header types or enhancing severity levels).

Thank you!

@github-actions
Copy link

github-actions bot commented Nov 28, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@LakshmiSHR
Copy link
Author

i have read the CLA Document and I hereby sign the CLA

Copy link
Member

@kingthorin kingthorin left a comment

Choose a reason for hiding this comment

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

The CHANGELOG.md should also be updated. Add a bullet under the "Unreleased" header, you can check older entries for inspiration.

It might also be worth adding/updating unit tests.

@psiinon
Copy link
Member

psiinon commented Nov 28, 2025

Logo
Checkmarx One – Scan Summary & Detailsc1796428-7d3c-406a-9b78-d0409003def9

New Issues (3)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
LOW Unpinned Actions Full Length Commit SHA /codeql.yml: 31
detailsPinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA help...
ID: z89ONTXYaYdPcNUEzfFqPVDqGfU%3D
LOW Unpinned Actions Full Length Commit SHA /codeql.yml: 35
detailsPinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA help...
ID: ivv4LqDvobLaIQBf4po7RJO0z9E%3D
LOW Unpinned Actions Full Length Commit SHA /codeql.yml: 50
detailsPinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA help...
ID: D2MI8bkE1KfW3jWUtbTZgCIA7fE%3D

Use @Checkmarx to reach out to us for assistance.

Just send a PR comment with @Checkmarx followed by a natural language request.

Examples: @Checkmarx how are you able to help me? @Checkmarx rescan this PR

@LakshmiSHR
Copy link
Author

@Checkmarx These scan issues are related to workflow configuration files (codeql.yml),
which I did not modify. My changes are only in the Java code and CHANGELOG.md.
Please let me know if any action is required from my side.

@thc202 thc202 changed the title Improve version detection in Server Header Info Leak rule (10036) pscanrules: Improve version detection in Server Header Info Leak rule (10036) Nov 28, 2025
@kingthorin
Copy link
Member

You can ignore the Checkmarx report. Thanks for your diligence though.

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.

3 participants