Skip to content

Normalize OWASP cheat sheet references#954

Open
Bornunique911 wants to merge 3 commits into
OWASP:mainfrom
Bornunique911:review/issue-471-cheatsheet-references-clean
Open

Normalize OWASP cheat sheet references#954
Bornunique911 wants to merge 3 commits into
OWASP:mainfrom
Bornunique911:review/issue-471-cheatsheet-references-clean

Conversation

@Bornunique911

@Bornunique911 Bornunique911 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR is split out from the larger issue-471 review flow to make review smaller and more focused.

It normalizes OWASP cheat sheet references by:

  • using official OWASP Cheat Sheet Series links
  • adding supplemental cheat sheet mappings for references that are not reliably discoverable from repository parsing alone
  • covering that behavior with focused parser tests

Issue reference:

Problem Fixed

The earlier cheat sheet references review became too large because it was mixed with unrelated importer-stack work.

For this part of the work, the useful standalone contribution is:

  • using official cheat sheet URLs
  • supplementing missing cheat sheet references with explicit mapping data
  • ensuring parser behavior remains test-covered

Solution

This PR updates the cheat sheet parser to:

  • tolerate repository clone failure and continue with supplemental cheat sheet mappings
  • load supplemental cheat sheet mapping data from JSON
  • deduplicate cheat sheet entries by section and hyperlink
  • keep official OWASP Cheat Sheet Series hyperlinks for normalized references

This PR also adds:

  • supplemental cheat sheet mapping data
  • focused parser test coverage for the supplemental references

Files in scope:

  • application/utils/external_project_parsers/parsers/cheatsheets_parser.py
  • application/utils/external_project_parsers/data/owasp_cheatsheets_supplement.json
  • application/tests/cheatsheets_parser_test.py

Tests

./venv/bin/python -m pytest application/tests/cheatsheets_parser_test.py -q

Reviewer Notes

This PR is intentionally narrow because it was split to reduce review size:

  • no frontend changes
  • no unrelated OWASP importer modules
  • no refresh script aggregation
  • no bundle artifacts

This PR is meant to be reviewed as a standalone cheat sheet reference normalization change.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Bornunique911, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 35 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro Plus

Run ID: 80d880ef-6956-4e2b-b30b-7b906d94557f

📥 Commits

Reviewing files that changed from the base of the PR and between 79cab23 and cc87a19.

📒 Files selected for processing (2)
  • application/tests/cheatsheets_parser_test.py
  • application/utils/external_project_parsers/parsers/cheatsheets_parser.py

Walkthrough

Changes

Cheat sheet registration

Layer / File(s) Summary
Official cheat sheet URLs and registration
application/utils/external_project_parsers/parsers/cheatsheets_parser.py, application/tests/cheatsheets_parser_test.py
Repository-backed entries now use official OWASP HTML URLs, with updated registration expectations.
Supplemental metadata and CRE links
application/utils/external_project_parsers/data/owasp_cheatsheets_supplement.json, application/utils/external_project_parsers/parsers/cheatsheets_parser.py, application/tests/cheatsheets_parser_test.py
Supplemental entries are loaded from JSON, linked to CRE documents, and deduplicated by section and hyperlink.
Fallback and result consolidation
application/utils/external_project_parsers/parsers/cheatsheets_parser.py
Parsing continues after repository clone failures, combines available sources, and consolidates the final entries.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: northdpole, paoga87, robvanderveer, pa04rth

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: normalizing OWASP cheat sheet references.
Description check ✅ Passed The description is directly related to the parser, supplemental data, and test updates in this changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@Bornunique911
Bornunique911 force-pushed the review/issue-471-cheatsheet-references-clean branch from 7f640f4 to aac9e3b Compare July 7, 2026 12:23
@Bornunique911
Bornunique911 force-pushed the review/issue-471-cheatsheet-references-clean branch from aac9e3b to 79cab23 Compare July 26, 2026 13:14

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
application/tests/cheatsheets_parser_test.py (1)

81-102: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover clone fallback and duplicate merging.

The new test covers supplemental loading only. Add cases where git.clone fails but a seeded supplemental entry is still returned, and where repository/supplement entries share (section, hyperlink) and their CRE links are merged. This protects both new parse paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@application/tests/cheatsheets_parser_test.py` around lines 81 - 102, Add test
cases alongside test_register_supplemental_cheatsheets covering clone failure
with a seeded supplemental entry still returned, and repository/supplement
entries sharing the same (section, hyperlink) with their CRE links merged.
Configure the git.clone failure through the existing test seam and assert both
fallback retention and deduplicated combined links.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@application/utils/external_project_parsers/parsers/cheatsheets_parser.py`:
- Around line 57-61: Restrict the exception handler around the OWASP
CheatSheetSeries clone in the parser to expected process and OS failures raised
by git.clone(), such as subprocess and operating-system errors. Do not catch
arbitrary Exception, so parser and configuration defects propagate normally
while the existing warning and supplemental-cheat-sheets fallback remain
unchanged for those failures.

---

Nitpick comments:
In `@application/tests/cheatsheets_parser_test.py`:
- Around line 81-102: Add test cases alongside
test_register_supplemental_cheatsheets covering clone failure with a seeded
supplemental entry still returned, and repository/supplement entries sharing the
same (section, hyperlink) with their CRE links merged. Configure the git.clone
failure through the existing test seam and assert both fallback retention and
deduplicated combined links.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro Plus

Run ID: d61289eb-2550-49a5-9d56-a8af8cd692f9

📥 Commits

Reviewing files that changed from the base of the PR and between 8fe46df and 79cab23.

📒 Files selected for processing (3)
  • application/tests/cheatsheets_parser_test.py
  • application/utils/external_project_parsers/data/owasp_cheatsheets_supplement.json
  • application/utils/external_project_parsers/parsers/cheatsheets_parser.py

Comment thread application/utils/external_project_parsers/parsers/cheatsheets_parser.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant