Fix is_secret three-state check and use [[ ]] in detect_secrets_baseline.sh - #158
Merged
Merged
Conversation
- Add separate Check 2 for confirmed real secrets (is_secret: True), distinct from unaudited findings (is_secret absent); addresses the edge case where confirmed secrets would not cause a CI failure - Replace all [ ] conditionals with [[ ]] to satisfy SonarCloud - Renumber former Check 2 (new secrets scan) to Check 3 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Restructure into named functions with clear responsibilities: - find_detect_secrets: locates the binary - build_exclude_args: assembles --exclude-files flags - baseline_fingerprints / baselines_match: clean baseline comparison using a heredoc Python block instead of inline escaped one-liners - count_findings: shared helper for unaudited/confirmed checks - check_unaudited_findings, check_confirmed_secrets, check_new_secrets: each check is its own function with a descriptive name - run_ci_checks: top-level that reads like a table of contents - case statement replaces if/elif chain for the entry point Also adds set -euo pipefail, named constants for BASELINE and BASELINE_IGNORE, inline comments on each GLOBAL_EXCLUDES entry, and a usage guard for unknown arguments. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…_match Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Avoids blocking .github/workflows/ and other .github/ paths from secrets scanning. Suggested by @nutjob4life in PR review. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Single-quoted trap deferred expansion of scratch until after RETURN, at which point bash 5.1 (ubuntu-latest) had already unset the local, triggering set -u unbound-variable error. Double-quoting expands the path at trap-registration time while scratch is still in scope. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add exclusions for Python build/cache artifacts (__pycache__, compiled files, packaging outputs), env template files (.env.example etc.), and editor/IDE directories (.vscode, .idea, .sublime-*) that commonly trigger false positives but never contain real secrets. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports two fixes from NASA-PDS/s3-browser-cloudfront#193 (per review by @nutjob4life) to the Python template.
Changes
1.
is_secretthree-state fixThe
is_secretfield in a detect-secrets baseline is effectively three-state:true— audited and confirmed as a real secretfalse— audited and marked as a false positiveThe previous Check 1 only caught unaudited findings (absent
is_secret). A confirmed real secret (is_secret: true) would silently pass. This PR splits Check 1 into two separate checks:is_secretabsent)is_secret: true)2.
[ ]→[[ ]]All single-bracket
[ ]conditionals replaced with double-bracket[[ ]]to satisfy SonarCloud.AI Assistance Disclosure
Estimated % of code influenced by AI: 90%
🤖 Generated with Claude Code