Repository navigation
fix(python-security-analysis): detect repo state instead of hardcoding uv sync/run --frozen - #158
Conversation
|
Warning Review limit reached
More reviews will be available in 4 minutes and 6 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Updates the org reusable workflow python-security-analysis.yml to detect the caller repository state at runtime, so uv-based installs and scans do not assume pyproject.toml and uv.lock always exist.
Changes:
- Add a repo-state detection step to both the CodeQL and Bandit jobs to classify callers as
skip,uv-locked,uv-no-lock, orpoetry-not-supported. - Collapse uv install commands to a single step per job by computing a
FROZEN_FLAGenv var instead of hardcoding--frozen. - Gate CodeQL init/build/analyze, Bandit run, and artifact upload based on the detected repo state.
| echo "state=skip" >> $GITHUB_OUTPUT | ||
| echo "::notice::No pyproject.toml found at repo root; CodeQL analysis will be skipped. Remove the python-security-analysis.yml caller from this repo if it does not need Python security scanning." | ||
| elif [ -f poetry.lock ] || grep -qE '^\[tool\.poetry(\.|])' pyproject.toml; then | ||
| echo "state=poetry-not-supported" >> $GITHUB_OUTPUT | ||
| echo "::error::This repo uses Poetry. The python-security-analysis.yml reusable workflow is uv-only by org policy. Convert this repo to uv before re-enabling Python security analysis." | ||
| exit 1 | ||
| elif [ -f uv.lock ]; then | ||
| echo "state=uv-locked" >> $GITHUB_OUTPUT | ||
| echo "Detected: uv with lockfile" | ||
| else | ||
| echo "state=uv-no-lock" >> $GITHUB_OUTPUT |
| elif [ -f uv.lock ]; then | ||
| echo "state=uv-locked" >> $GITHUB_OUTPUT | ||
| echo "Detected: uv with lockfile" | ||
| else | ||
| echo "state=uv-no-lock" >> $GITHUB_OUTPUT | ||
| echo "Detected: uv without lockfile (PEP 621 pyproject.toml only); will sync without --frozen" | ||
| fi |
| echo "state=skip" >> $GITHUB_OUTPUT | ||
| echo "::notice::No pyproject.toml found at repo root; Bandit SAST will be skipped. Remove the python-security-analysis.yml caller from this repo if it does not need Python security scanning." | ||
| elif [ -f poetry.lock ] || grep -qE '^\[tool\.poetry(\.|])' pyproject.toml; then | ||
| echo "state=poetry-not-supported" >> $GITHUB_OUTPUT | ||
| echo "::error::This repo uses Poetry. The python-security-analysis.yml reusable workflow is uv-only by org policy. Convert this repo to uv before re-enabling Python security analysis." | ||
| exit 1 | ||
| elif [ -f uv.lock ]; then | ||
| echo "state=uv-locked" >> $GITHUB_OUTPUT | ||
| echo "Detected: uv with lockfile" | ||
| else | ||
| echo "state=uv-no-lock" >> $GITHUB_OUTPUT |
| # Detect the repo state before attempting uv sync. The reusable workflow is uv-only | ||
| # by org policy (poetry repos are being converted to uv in separate work), but it is | ||
| # still called by some repos that don't have a pyproject.toml (template / docs-only | ||
| # forks like DeQA-Doc) and by uv-managed repos that haven't yet committed a uv.lock. | ||
| # Hardcoding `uv sync --frozen` failed for both categories. Auto-detection skips | ||
| # cleanly when pyproject is absent and drops --frozen when no lockfile exists yet. | ||
| # Poetry repos are explicitly rejected with an actionable error. | ||
| - name: Detect repo state |
| # Detect repo state. Same logic as the codeql job above; each job runs | ||
| # on its own runner so the detect step must be repeated per job. | ||
| - name: Detect repo state | ||
| id: detect |
31672c6 to
774408d
Compare
…narCloud Applies the same restructure pattern landed in PR #157 (python-fips) and PR #158 (python-security-analysis) to python-ci.yml. See docs/sonarcloud-nosonar-patterns.md for the full background. Changes across both jobs in python-ci.yml (quality-checks and matrix-testing): 1. Split Install dependencies steps into uv-locked / uv-no-lock variants. uv-locked uses literal uv sync --all-extras --frozen $NO_BUILD_FLAG; uv-no-lock carries inline NOSONAR(S8541,S8544) with rationale. 2. Drop FROZEN_FLAG env var from every downstream step in both jobs: - Ruff formatter check, Ruff linter, BasedPyright - Dead code detection with Vulture - Unit / integration / security tests (3 pytest invocations) - Combined coverage report (4 coverage invocations) - Security scan with Bandit (2 invocations, if/else branches) - Dependency vulnerability scan with pip-audit (2 invocations) - Matrix test runner 3. Replace every $FROZEN_FLAG with literal --frozen on uv run lines. 4. Add # NOSONAR(S8541) as a preceding bash comment to every uv run line in the run: blocks (17 total). 5. Update the echo error-message hint in Ruff formatter check from uv run $FROZEN_FLAG to uv run --frozen so the displayed remediation command matches what the workflow now executes. Trade-off: matches sibling design. No new install runtime; the install step was already running unconditionally on every CI job. Quality gate should flip to A on new code after re-analysis. Verified locally: pre-commit clean (yamllint, em-dash, secrets, commitizen); FROZEN_FLAG completely removed from the file; no empty env: blocks; indentation preserved across if/else shell branches. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
PR ReviewBUILD FAILING — SonarCloud Quality Gate is ERROR (PR-introduced; passes on Reviewer status: Copilot was not requested (ruleset gap); CodeRabbit was rate-limited (org out of credits). Only the local agent pipeline and SonarQube produced findings. Critical (must fix before merge)
Important (should fix)
Suggested
Informational
Recommended order: (1) add NOSONAR to L312 to clear the gate, (2) rebase on 🤖 Generated with Claude Code |
PR Fix: ResolvedApplied the structural fix pattern proven on PR #157. SonarCloud Quality Gate: OK (Security Rating A on new code). All 2 open MAJOR vulnerabilities resolved. Commit ( Changes:
Final state: CI 20 SUCCESS / 4 SKIPPED / 0 FAILURE; SonarCloud 0 open vulnerabilities; branch rebased on main. Ready for merge review. See Generated with Claude Code |
…-frozen (#159) * fix(python-ci): detect repo state instead of hardcoding uv sync/run --frozen Same pattern as PR #156 (python-compatibility.yml) and #157 (python-fips-compatibility.yml). Root cause: the quality-checks and matrix-testing jobs ran `uv sync --all-extras --frozen` and `uv run --frozen` unconditionally, crashing on (1) repos without pyproject.toml, (2) uv-managed repos without uv.lock yet, and (3) Poetry repos that should not be served by this uv-only workflow. Added a Detect repo state step in both jobs that emits one of four states (skip, uv-locked, uv-no-lock, poetry-not-supported) and gated every install and test step on that state. uv run sites now read FROZEN_FLAG from the detect step so the --frozen flag is dropped only when no lockfile exists. The Validate source layout precondition (per project_python_ci_audit_2026_05.md) is preserved unchanged. The llm-governance job does not use uv and was not modified. Impact: repairs CI across the uv repos in the fleet. The 4 Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master) surface the new actionable error directing to their migration tracking issues (williaby/PromptCraft#328, williaby/ledgerbase#147, williaby/data_ingestor#38, ByronWilliamsCPA/pp-security-master#38). Reference: docs/audits/cve-scan-coverage-2026-05-25.md (CI Repair Sprint). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(python-ci): collapse install steps via FROZEN_FLAG env + NOSONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in python-mutation.yml (lines 159-169) and halves the YAML maintenance surface. Applied to both quality-checks and matrix-testing jobs. The 9 downstream uv run steps already used the FROZEN_FLAG pattern; only the 2 install steps needed collapsing. Layout-precondition hardening from project_python_ci_audit_2026_05 is preserved untouched. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(quality): restructure python-ci to expose literal --frozen for SonarCloud Applies the same restructure pattern landed in PR #157 (python-fips) and PR #158 (python-security-analysis) to python-ci.yml. See docs/sonarcloud-nosonar-patterns.md for the full background. Changes across both jobs in python-ci.yml (quality-checks and matrix-testing): 1. Split Install dependencies steps into uv-locked / uv-no-lock variants. uv-locked uses literal uv sync --all-extras --frozen $NO_BUILD_FLAG; uv-no-lock carries inline NOSONAR(S8541,S8544) with rationale. 2. Drop FROZEN_FLAG env var from every downstream step in both jobs: - Ruff formatter check, Ruff linter, BasedPyright - Dead code detection with Vulture - Unit / integration / security tests (3 pytest invocations) - Combined coverage report (4 coverage invocations) - Security scan with Bandit (2 invocations, if/else branches) - Dependency vulnerability scan with pip-audit (2 invocations) - Matrix test runner 3. Replace every $FROZEN_FLAG with literal --frozen on uv run lines. 4. Add # NOSONAR(S8541) as a preceding bash comment to every uv run line in the run: blocks (17 total). 5. Update the echo error-message hint in Ruff formatter check from uv run $FROZEN_FLAG to uv run --frozen so the displayed remediation command matches what the workflow now executes. Trade-off: matches sibling design. No new install runtime; the install step was already running unconditionally on every CI job. Quality gate should flip to A on new code after re-analysis. Verified locally: pre-commit clean (yamllint, em-dash, secrets, commitizen); FROZEN_FLAG completely removed from the file; no empty env: blocks; indentation preserved across if/else shell branches. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
…g uv sync/run --frozen Same pattern as PR #156 (python-compatibility.yml) and #157 (python-fips-compatibility.yml). Root cause: codeql and python-security (Bandit) jobs hardcoded `uv sync --frozen` and `uv run --frozen`, which failed on three caller categories: repos without pyproject.toml (DeQA-Doc), uv-managed repos without uv.lock yet, and Poetry repos (uv cannot parse poetry projects). Fix: detect-state step + gated install/run steps in both jobs (codeql, python-security). Each job has its own Detect step because every job runs on a fresh runner with a fresh checkout. The detect step exits 1 with an actionable error for Poetry repos, prints a job summary notice when pyproject.toml is absent, and drops --frozen when uv.lock is not yet present. Impact: repairs Security Analysis across the uv repos in the fleet. The 4 Poetry repos (PromptCraft, ledgerbase, data_ingestor, pp-security-master) surface the new actionable error directing to their migration tracking issues (williaby/PromptCraft#328, williaby/ledgerbase#147, williaby/data_ingestor#38, ByronWilliamsCPA/pp-security-master#38). Reference: docs/audits/cve-scan-coverage-2026-05-25.md (CI Repair Sprint). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…nv + NOSONAR S8541 Follow up to PR #156 team feedback. Step-level branching for uv-locked vs uv-no-lock just shuffles the S8541 finding to the without-frozen branch (allowing builds is intentional and configurable via the no-build input). Collapsing to a single Install dependencies step with FROZEN_FLAG env var indirection plus # NOSONAR S8541 suppression matches the established convention in python-mutation.yml (lines 159-169) and halves the YAML maintenance surface. Applied to both codeql and python-security jobs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…--frozen for SonarCloud Applies the same restructure pattern landed in PR #157 (python-fips- compatibility.yml) to python-security-analysis.yml. See docs/sonarcloud-nosonar-patterns.md for the full background; the short version is that SonarCloud cannot follow $FROZEN_FLAG env-var indirection, and preceding-line NOSONAR(S8541,S8544) inside a `|` block is not honored. Changes to both jobs in python-security-analysis.yml: CodeQL job (lines 169-183): 1. Split Install dependencies into uv-locked / uv-no-lock variants. uv-locked uses literal `uv sync --no-dev --frozen $NO_BUILD_FLAG`; uv-no-lock carries inline NOSONAR(S8541,S8544) with rationale. Python SAST (Bandit) job (lines 295-332): 2. Same Install split. 3. Bandit Static Analysis step: drop FROZEN_FLAG env, use literal `uv run --frozen $NO_BUILD_FLAG bandit ...` with preceding-line NOSONAR(S8541). Add shell: bash explicitly. Trade-off: adds ~1-2 min of cache-friendly install runtime to the uv-no-lock path on the CodeQL job; matches sibling design. Verified locally: pre-commit clean (yamllint, em-dash, secrets); FROZEN_FLAG completely removed from the file. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…to detect-state block
The python-security job's detect-state block already references the codeql
job ("Same logic as the codeql job above; each job runs on its own
runner..."), but the codeql block had no reciprocal pointer. Adds a
one-line "Mirrored in the python-security job below; keep both blocks in
sync" comment so future edits in either direction surface the duplication
constraint.
Pure comment change; no behavior delta. Pre-commit clean.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
774408d to
2b6c48e
Compare
Review supersession + cleanupMy earlier review comment was based on PR HEAD You arrived at the correct fix independently in commit Current state of PR head (after rebase + cleanup push):
Original review findings, final disposition:
Ready for merge once you've eyeballed the comment commit. 🤖 Generated with Claude Code |
|
…njection Addresses CodeQL alerts #182 and #183 (py/code-injection) and Important findings from /pr-review on PR #166. Critical: - Map steps.extras.outputs.flag to env UV_EXTRAS on both install steps so it reaches bash as a variable value rather than being interpolated into the run: script via GitHub-side template expansion. Template expansion runs before bash sees the line; without env mapping, any shell metacharacters in flag would become script text. The flag derives from inputs.extra-dependencies, a caller-controlled reusable workflow input. - Add #CRITICAL / #VERIFY RAD annotations near the install steps documenting the env-mapping invariant per project CLAUDE.md. Pattern alignment with PRs #156/#158/#160: - Remove NOSONAR(S8541) on the uv-locked install step. The canonical precedent keeps the locked install line bare on the rationale that literal --frozen makes the line scanner-clean; only the uv-no-lock branch carries NOSONAR. Polish: - Strip leading space in FLAG accumulator so the for-loop branch produces the same shape as --all-extras and empty branches. - Escape ] explicitly in poetry detection regex for reader clarity (functional no-op; the original was correct ERE). - Document why the downstream if: conditions use the positive disjunction (state == 'uv-locked' || state == 'uv-no-lock') rather than the shorter negative form; the negative form would incorrectly run downstream steps when steps.detect.outputs.state is empty after an upstream failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous commit (6fa51ff) removed NOSONAR(S8541) on the uv-locked install line on the assumption that it would match the #156/#158/#160 precedent of keeping the locked-install line bare. SonarCloud's Quality Gate on PR #166 empirically rejected this assumption: S8541 (security rating C) fires on this line regardless of the literal --frozen, because $NO_BUILD_FLAG remains a dynamic env var. Why this workflow differs from #156/#158/#160: the install steps in those PRs likely resolve to a literal --no-build, no flag, or no install at all on the locked path. python-sonarcloud.yml's locked install step uses dynamic $NO_BUILD_FLAG (the no-build: workflow input is opt-out by design for PEP 517 consumers like hatchling), so S8541 matches. Restored the inline NOSONAR(S8541) and updated the header comment to document the empirical divergence so a future reader does not re-attempt the same "match precedent" cleanup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(python-sonarcloud): detect repo state instead of hardcoding uv sync --frozen Apply the split-install detect-state pattern established by merged PRs #156-#160. Branches on pyproject.toml + lockfile presence: skip when no pyproject, fail fast on poetry repos with actionable error, use --frozen on uv-locked repos and bare uv sync on uv-no-lock repos. Install step is split into two if-guarded variants so SonarCloud sees literal --frozen on the uv-locked path (S8544 cannot fire). The uv-no-lock variant inlines NOSONAR(S8541,S8544) with rationale; uv.lock does not exist by design on that path. The shell branching on extra-dependencies input is preserved inside each install step (flattening to step variants would obscure intent). The pytest run step uses literal --frozen with a preceding-line NOSONAR(S8541) for --no-build only; this placement is honored when the underlying line is otherwise clean per python-mutation.yml:159-169 precedent. Downstream analysis steps (Verify coverage, SonarCloud Scan, Wait, Check Quality Gate, Quality Gate Summary, Upload coverage artifacts, Fail on Quality Gate) gain detect-state guards so the skip path exits the job cleanly. * fix(python-sonarcloud): inline NOSONAR per uv sync line in uv-no-lock install step Preceding-line NOSONAR(S8541,S8544) inside the uv-no-lock install step's multi-line run block is not honored by SonarCloud's githubactions rule set (documented anti-pattern in docs/sonarcloud-nosonar-patterns.md). Moving suppression to inline trailing comments on each of the three uv sync lines within the block. The step-level rationale moves into the header comment. Verified: SonarCloud PR #166 flagged S8541 L293 + S8544 L293, L299, L301 (the three uv sync lines). Lines 280 and 282 (uv-locked path, literal --frozen) were NOT flagged, confirming preceding-line NOSONAR(S8541) is honored when the underlying line is otherwise clean of S8544. * fix(python-sonarcloud): collapse install steps to single-line for SonarCloud SonarCloud's githubactions rule set ignores NOSONAR (both preceding-line and inline) inside multi-line run: | blocks for S8541/S8544. Even with inline trailing NOSONAR per uv sync line, PR #166 commit bb31ec1 still flagged 5 vulnerabilities (L296, L302, L304). Restructure: extract the EXTRA_DEPENDENCIES branching into a separate Resolve extras flag step that outputs steps.extras.outputs.flag, then collapse each install step to a single-line run: shape. This is the only reliable Pattern A position for SonarCloud (per docs/sonarcloud-nosonar-patterns.md). Two install steps remain (uv-locked, uv-no-lock); the resolve step unconditionally handles all three extras-modes and outputs a literal flag string consumed by both. * fix(python-sonarcloud): map UV_EXTRAS via env to block GHA template injection Addresses CodeQL alerts #182 and #183 (py/code-injection) and Important findings from /pr-review on PR #166. Critical: - Map steps.extras.outputs.flag to env UV_EXTRAS on both install steps so it reaches bash as a variable value rather than being interpolated into the run: script via GitHub-side template expansion. Template expansion runs before bash sees the line; without env mapping, any shell metacharacters in flag would become script text. The flag derives from inputs.extra-dependencies, a caller-controlled reusable workflow input. - Add #CRITICAL / #VERIFY RAD annotations near the install steps documenting the env-mapping invariant per project CLAUDE.md. Pattern alignment with PRs #156/#158/#160: - Remove NOSONAR(S8541) on the uv-locked install step. The canonical precedent keeps the locked install line bare on the rationale that literal --frozen makes the line scanner-clean; only the uv-no-lock branch carries NOSONAR. Polish: - Strip leading space in FLAG accumulator so the for-loop branch produces the same shape as --all-extras and empty branches. - Escape ] explicitly in poetry detection regex for reader clarity (functional no-op; the original was correct ERE). - Document why the downstream if: conditions use the positive disjunction (state == 'uv-locked' || state == 'uv-no-lock') rather than the shorter negative form; the negative form would incorrectly run downstream steps when steps.detect.outputs.state is empty after an upstream failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(python-sonarcloud): re-add NOSONAR(S8541) on uv-locked install line The previous commit (6fa51ff) removed NOSONAR(S8541) on the uv-locked install line on the assumption that it would match the #156/#158/#160 precedent of keeping the locked-install line bare. SonarCloud's Quality Gate on PR #166 empirically rejected this assumption: S8541 (security rating C) fires on this line regardless of the literal --frozen, because $NO_BUILD_FLAG remains a dynamic env var. Why this workflow differs from #156/#158/#160: the install steps in those PRs likely resolve to a literal --no-build, no flag, or no install at all on the locked path. python-sonarcloud.yml's locked install step uses dynamic $NO_BUILD_FLAG (the no-build: workflow input is opt-out by design for PEP 517 consumers like hatchling), so S8541 matches. Restored the inline NOSONAR(S8541) and updated the header comment to document the empirical divergence so a future reader does not re-attempt the same "match precedent" cleanup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…c --frozen Apply the split-install detect-state pattern (see python-mutation.yml:159-169 for the original NOSONAR S8541 precedent, and PR #160 / python-release.yml for the canonical split-install exemplar). Branches on pyproject.toml + lockfile presence: skip when no pyproject, fail fast on poetry repos with actionable error, install with literal --frozen on uv-locked path, install without --frozen on uv-no-lock path (uv sync generates the lockfile). Downstream pre-commit run step uses literal --frozen because the install step guaranteed uv.lock exists by then; preceding-line NOSONAR(S8541) is honored when the underlying line has a literal --frozen token (only the --no-build flag remains dynamic). Avoids the documented anti-pattern: dynamic \$FROZEN_FLAG inside run: | block scalars is not suppressed by preceding-line NOSONAR (empirical finding from PRs #157/#158/#159; see BWCPA/.github docs/sonarcloud-nosonar-patterns.md). Verification: actionlint passes (with -shellcheck= per documented embedded-shellcheck limitation in feedback_actionlint_shellcheck_embed).
…c --frozen (#164) * fix(python-precommit): detect repo state instead of hardcoding uv sync --frozen Apply the split-install detect-state pattern (see python-mutation.yml:159-169 for the original NOSONAR S8541 precedent, and PR #160 / python-release.yml for the canonical split-install exemplar). Branches on pyproject.toml + lockfile presence: skip when no pyproject, fail fast on poetry repos with actionable error, install with literal --frozen on uv-locked path, install without --frozen on uv-no-lock path (uv sync generates the lockfile). Downstream pre-commit run step uses literal --frozen because the install step guaranteed uv.lock exists by then; preceding-line NOSONAR(S8541) is honored when the underlying line has a literal --frozen token (only the --no-build flag remains dynamic). Avoids the documented anti-pattern: dynamic \$FROZEN_FLAG inside run: | block scalars is not suppressed by preceding-line NOSONAR (empirical finding from PRs #157/#158/#159; see BWCPA/.github docs/sonarcloud-nosonar-patterns.md). Verification: actionlint passes (with -shellcheck= per documented embedded-shellcheck limitation in feedback_actionlint_shellcheck_embed). * fix(python-precommit): suppress success summary on skip path When the detect step sets state=skip (no pyproject.toml), the workflow should not emit the generic "All pre-commit hooks passed" summary; the "Skip notice" step already provides the correct user-facing message and the success line is misleading because nothing ran. Gate the Pre-Commit Summary step on state != 'skip' so skipped runs render only the skip notice. Behavior on uv-locked, uv-no-lock, and poetry-not-supported paths is unchanged. Flagged independently by Copilot and CodeRabbit on PR #164 review. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>



Summary
Applies the detect-state pattern from PR #156 (
python-compatibility.yml) and PR #157 (python-fips-compatibility.yml) to both jobs inpython-security-analysis.yml. Repairs Security Analysis across 6 uv repos and surfaces an actionable error on the 4 Poetry repos being migrated.After review (#158 comment), restructured to mirror the proven SonarCloud-safe pattern from
python-compatibility.yml: split install steps into uv-locked / uv-no-lock variants, expose literal--frozenon the Bandituv runstep, and use inlineNOSONAR(S8541,S8544)only on the uv-no-lock install (where nouv.lockexists by design). Seedocs/sonarcloud-nosonar-patterns.mdfor the empirical NOSONAR placement rules.Root cause
Both
codeqlandpython-securityjobs hardcodeduv sync --frozen/uv run --frozen, crashing on:Fix
Detect-state step added to both
codeqlandpython-securityjobs. Logic identical to PR #156 / #157.skipuv-lockeduv sync --frozen $NO_BUILD_FLAG(literal--frozen, no NOSONAR needed for S8544)uv-no-lockuv sync $NO_BUILD_FLAG # NOSONAR(S8541,S8544): ...(single-linerun:so inline NOSONAR is honored)poetry-not-supportedBandit Static Analysis step: literal
uv run --frozen $NO_BUILD_FLAG bandit ...with preceding-line# NOSONAR(S8541). NoFROZEN_FLAGenv indirection (SonarCloud cannot follow it; see PR #157's findings).Notes:
codeqlinstall uses--no-dev,python-security(Bandit) uses--all-extras. Both preserved.Affected downstream repos (10)
audio-processor,dna,fragrance-rater,image-preprocessing-detector,python-libs,rag-processorPromptCraft(#328),ledgerbase(#147),data_ingestor(#38),pp-security-master(#38)Test plan
@maincallers (e.g.,audio-processor,dna): confirm Security Analysis succeedsReference:
docs/audits/cve-scan-coverage-2026-05-25.md(CI Repair Sprint).Related: #155, #156, #157.
Generated with Claude Code