Skip to content

Fix crypto_usage false positives and failing hook test - #50

Open
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
fix-crypto-usage-fp-17287384905726647658
Open

Fix crypto_usage false positives and failing hook test#50
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
fix-crypto-usage-fp-17287384905726647658

Conversation

@google-labs-jules

Copy link
Copy Markdown

What changed:

  1. Refined regex patterns in src/websec_validator/extractors/crypto_usage.py for the crypto_usage extractor.
  • TIMING_UNSAFE: Restricted LHS matching to avoid arbitrary headers or boolean variables like isMatch or state like currentStatus.
  • WEAK_PW_HASH: Tightly constrained the .update() match to the identified _PW variable rather than matching arbitrary variables far away.
  • PW_CONTEXT_FAST_HASH: Replaced the over-broad wildcard regex with specific match targets (like input, password, key) and short identifiers, eliminating false positives on things like someOtherData.
  1. Appended 6 new regression test cases verifying these false positives are no longer flagged in tests/test_recon.py.
  2. Fixed test_end_to_end_post_commit_runs by enforcing git config core.hooksPath .git/hooks in the temporary testing directory before making a commit.
  3. Updated CHANGELOG.md under [Unreleased].

Why:
The crypto_usage extractor was falsely flagging legitimate, benign idiomatic usage as vulnerabilities (such as boolean assertions, enum state checks that happen to use the word "Auth", and unrelated createHash() commands located near checkPassword functions). Additionally, a test checking post-commit hooks randomly failed due to lack of local core.hooksPath configuration.

Risk:
Low. The regex refinements keep all existing (15+) security findings tests passing while squashing the FPs. The repo cleanliness was preserved and tests/docguard are completely green.


PR created automatically by Jules for task 17287384905726647658 started by @raccioly

* Refined WEAK_PW_HASH and TIMING_UNSAFE regexes in crypto_usage.py to avoid matching unrelated boolean/status/hash logic.
* Constrained PW_CONTEXT_FAST_HASH to look for specific common password-like variable names to avoid triggering on file uploads or non-auth context.
* Added 6 new regression tests in test_recon.py to prevent false positives from regressing.
* Fixed the `test_end_to_end_post_commit_runs` hook test to pass despite global config.
* Updated CHANGELOG.md as required.
@google-labs-jules

Copy link
Copy Markdown
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

0 participants