Skip to content

Fix zap scan#3198

Merged
arkid15r merged 9 commits intoOWASP:mainfrom
kart-u:fix_zap_scan
Jan 6, 2026
Merged

Fix zap scan#3198
arkid15r merged 9 commits intoOWASP:mainfrom
kart-u:fix_zap_scan

Conversation

@kart-u
Copy link
Contributor

@kart-u kart-u commented Jan 5, 2026

Resolves #3183

  • Reverted HTML report to use default name report_html.html
  • Added ZAP alert ignore for false positives

Checklist

  • Required: I read and followed the contributing guidelines
  • Required: I ran make check-test locally and all tests passed
  • I used AI for code, documentation, or tests in this PR

@kart-u kart-u requested review from arkid15r and kasya as code owners January 5, 2026 12:33
@github-actions github-actions bot added the ci label Jan 5, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

Summary by CodeRabbit

  • Chores
    • Refined CI/CD workflow names and scan step sequence; added repository checkout before baseline scans.
    • Updated baseline scan configuration to use a dedicated config file and standardized report naming; adjusted artifact upload names.
    • Aligned build naming/capitalization and updated image build parameters (UID/GID and production tagging).
    • Added a scan rule to ignore a known sitemap finding and registered the new token in the spelling dictionary.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Rename and standardize ZAP baseline scan job/step names in CI workflow, change scan options to include a .zapconfig rules file and output report.html, add a .zapconfig file suppressing a specific ZAP finding, and add zapconfig to the cspell custom dictionary.

Changes

Cohort / File(s) Summary
CI workflow: ZAP baseline scan
​.github/workflows/run-ci-cd.yaml
Renamed staging/production ZAP job and step titles; added a "Check out repository" step before baseline scan; replaced -a -r zap-report.html with -a -c .zapconfig -r report.html in cmd_options; updated artifact upload name/path from zap-report.html to report.html; minor build naming/casing adjustments and updated OWASP_UID/GID values.
ZAP rules config
.zapconfig
Added .zapconfig to ignore finding 10062 for `https://nest.owasp.(dev
Spell dictionary
cspell/custom-dict.txt
Added the token zapconfig to the custom dictionary.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • kasya

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Fix zap scan' is vague and lacks specific context about what was fixed, using generic phrasing that doesn't clearly convey the main changes made. Consider a more descriptive title like 'Update ZAP scan configuration and suppress false positives' to better reflect the actual changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description is related to the changeset, mentioning the reversion of HTML report naming and addition of ZAP alert ignore configuration, which align with the actual changes made.
Linked Issues check ✅ Passed The PR addresses issue #3183 by suppressing false positives and fixing ZAP baseline scan issues through configuration updates, meeting the stated objectives.
Out of Scope Changes check ✅ Passed Changes to the CI/CD workflow, ZAP configuration, and spell check dictionary are all in scope for fixing the ZAP baseline scan issues as per the linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 196eb97 and 52d4ae5.

📒 Files selected for processing (1)
  • .github/workflows/run-ci-cd.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/run-ci-cd.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run backend tests
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: Run frontend unit tests
  • GitHub Check: CodeQL (javascript-typescript)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 5, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 5, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 5, 2026
.zap-rules.tsv Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not all of them are FPs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I removed all those ids which can be a actual security lapse

  • 10010 Cookie No HttpOnly Flag
  • 10011 Cookie Without Secure Flag
  • 10054 Cookie without SameSite Attribute
  • 10015 Re-examine Cache-control Directives due to https://nest.owasp.dev/csrf/

allow_issue_writing: false
fail_action: false
cmd_options: '-a -r zap-report.html'
rules_file_name: 'zap_rules.tsv'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
rules_file_name: 'zap_rules.tsv'
rules_file_name: '.zap-rules.tsv'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As recommended I changed file name to .zap-rules.tsv in commit
f282877

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 6, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 6, 2026
@kart-u kart-u requested a review from arkid15r January 6, 2026 07:53
@kart-u kart-u marked this pull request as ready for review January 6, 2026 07:54
Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

This PR doesn't address the issue scope fully. The FPs suppression was the easy part whereas real findings haven't been addressed.

@arkid15r arkid15r enabled auto-merge January 6, 2026 18:32
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI Agents
In @.github/workflows/run-ci-cd.yaml:
- Around line 945-967: The run-production-zap-baseline-scan job is missing a
checkout step so the referenced .zapconfig in the cmd_options won't be
available; add a step using actions/checkout before the "Run baseline scan" step
(i.e., insert a step with name "Checkout repository" that uses actions/checkout)
so the ZAP action can read .zapconfig and the report upload step can find
report.html.
- Around line 604-627: The run-staging-zap-baseline-scan job references
.zapconfig via the cmd_options but never checks out the repository, so add a
checkout step before the "Run baseline scan" step; specifically, insert an
actions/checkout@vX step (or reuse existing checkout step) in the
run-staging-zap-baseline-scan job so the .zapconfig file is present for the
zaproxy/action-baseline action that uses cmd_options: '-a -c .zapconfig -r
report.html '.
🧹 Nitpick comments (2)
.github/workflows/run-ci-cd.yaml (2)

619-619: Optional: Remove trailing space in cmd_options.

There's a trailing space after report.html which is unnecessary but harmless.

🔎 Proposed fix
-         cmd_options: '-a -c .zapconfig -r report.html '
+         cmd_options: '-a -c .zapconfig -r report.html'

960-960: Optional: Remove trailing space in cmd_options.

Same trailing space issue as in the staging job.

🔎 Proposed fix
-         cmd_options: '-a -c .zapconfig -r report.html '
+         cmd_options: '-a -c .zapconfig -r report.html'
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f282877 and 196eb97.

📒 Files selected for processing (3)
  • .github/workflows/run-ci-cd.yaml
  • .zapconfig
  • cspell/custom-dict.txt
✅ Files skipped from review due to trivial changes (1)
  • .zapconfig
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-21T19:03:59.068Z
Learnt from: ahmedxgouda
Repo: OWASP/Nest PR: 1139
File: .github/workflows/setup-backend-environment/action.yaml:16-27
Timestamp: 2025-12-21T19:03:59.068Z
Learning: Composite actions (runs: using: composite) execute as steps within the calling job's context and can access the job context, including job.services.* properties (e.g., job.services.<service_id>.id, job.services.<service_id>.ports). Service containers must be defined at the job level, but a composite action's steps can reference them via the job context.

Applied to files:

  • .github/workflows/run-ci-cd.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Run frontend e2e tests
🔇 Additional comments (2)
cspell/custom-dict.txt (1)

148-148: LGTM!

The addition of "zapconfig" to the custom dictionary is correct and prevents spell-check failures for the new .zapconfig file.

.github/workflows/run-ci-cd.yaml (1)

605-605: Good naming improvements for consistency.

The job and step names are now more concise and consistent with the rest of the workflow.

Also applies to: 612-612, 621-621

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 6, 2026

@arkid15r arkid15r added this pull request to the merge queue Jan 6, 2026
Merged via the queue into OWASP:main with commit 01c992f Jan 6, 2026
27 checks passed
@kart-u
Copy link
Contributor Author

kart-u commented Jan 6, 2026

This PR doesn't address the issue scope fully. The FPs suppression was the easy part whereas real findings haven't been addressed.

hello @arkid15r
I am extremely sorry about this I was following config example from here
https://www.zaproxy.org/blog/2020-04-09-automate-security-testing-with-zap-and-github-actions/ and was thinking that with default report_html.html this would get resolved.

If you don’t mind, could you please help me understand why this approach doesn’t address the real findings??
This would really help me improve as a developer

@arkid15r
Copy link
Collaborator

arkid15r commented Jan 6, 2026

If you don’t mind, could you please help me understand why this approach doesn’t address the real findings?? This would really help me improve as a developer

Your code doesn't solve real-world problems the report has, e.g. cookie flags, missing headers, not sure whether other are false positives. Each warning needs to be addressed -- either ignored or fixed.

anukalp2804 pushed a commit to anukalp2804/Nest that referenced this pull request Jan 12, 2026
* fixed zap baseline scan

* fix:removed false positives

* lint/format

* fix:removed false positives

* update:followed recommendation

* lint/format

* Update code

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix ZAP baseline scan issues

2 participants

Comments