Skip to content

fix(security): clear SonarCloud new-code Security Rating - #30

Merged
kgrizz-git merged 9 commits into
mainfrom
fix/sonar-newcode-security-rating
Jul 25, 2026
Merged

kgrizz-git merged 9 commits into
mainfrom
fix/sonar-newcode-security-rating

Conversation

@kgrizz-git

@kgrizz-git kgrizz-git commented Jul 25, 2026 •

Copy link
Copy Markdown
Owner

Why

main shows a red ❌ because SonarCloud's quality gate fails on Security Rating on New Code (required ≥ A). All GitHub Actions CI jobs are green; the red is purely SonarCloud. New-code analysis flagged MAJOR "vulnerabilities" from its new (2025) AI/taint rules.

This PR fixes the Python/path/URL findings in code. The remaining ~21 findings are GitHub Actions pip install rules (S8541 unpinned/--only-binary, S8544) that are unavoidable for editable/dev installs — those are handled separately via SonarCloud triage (mark Accepted / disable rule).

Changes (dev-tooling hardening only; runtime unchanged)

  • mpfb_generate / run_catalog — route catalog + JSON-report paths through path_safety.resolve_under_roots (S8707).
  • check_feature_doc_matrix — confine the changed-paths file under the repo root and validate the --against-ref git ref against a conservative pattern (S8707 / S8705).
  • audit_dependencies — reject passthrough audit args containing shell metacharacters before the (shell-less) subprocess call (S8705).
  • check_doc_freshness — match external-link schemes without embedding a clear-text http:// literal (S5332).

Validation

  • ruff check clean on all touched files.
  • pytest green: test_phantom_gen_pipeline (18 passed), plus test_audit_dependencies / test_check_doc_freshness / test_check_feature_doc_matrix (31 passed).
  • check_feature_doc_matrix.py --against-ref HEAD~1 runs end-to-end.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes / Security

    • Enforced stronger notebook embedded-visual review requirements (approval alone no longer clears checks without complete image/text review).
    • Hardened safety across development tooling, including validation of unsafe CLI arguments, filesystem paths, and git refs.
    • Improved secure handling of external-link detection, dependency/audit safety, and scan gating related to security findings.
  • Build & Release

    • Updated CI to use locked uv installs and a pinned Codecov action; improved scan/tool execution.
    • Switched PyPI publishing to Trusted Publishing via GitHub OIDC (removed API key secret).
  • Documentation

    • Updated security-focused changelog guidance and added/updated PyPI release documentation.

…rating

Route remaining CLI-derived paths through validation and allowlist untrusted
subprocess inputs so SonarCloud's new-code Security Rating returns to A:

- mpfb_generate/run_catalog: resolve catalog + report paths via
  path_safety.resolve_under_roots (S8707)
- check_feature_doc_matrix: confine changed-paths file under repo root and
  validate the git ref against a conservative pattern (S8707/S8705)
- audit_dependencies: reject passthrough args with shell metacharacters (S8705)
- check_doc_freshness: match link schemes without a clear-text URL literal (S5332)

Dev-tooling hardening only; runtime behavior unchanged.
@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 15 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f1d35921-8943-408b-9d88-4984e1f15ec5

📥 Commits

Reviewing files that changed from the base of the PR and between fa1d7fd and b088e5d.

📒 Files selected for processing (9)
  • .github/workflows/release.yml
  • .sonarcloud.properties
  • CHANGELOG.md
  • PUBLISHING.md
  • dev-docs/approved_asset_inventory.md
  • scripts/audit_dependencies.py
  • scripts/check_feature_doc_matrix.py
  • scripts/phantom_gen/mpfb_generate.py
  • scripts/render_asset_inventory.py
📝 Walkthrough

Walkthrough

Notebook embedded-visual assets now require explicit review fields. Developer tooling validates paths, refs, arguments, and URI schemes. CI uses locked uv environments, release publishing uses OIDC Trusted Publishing, and SonarCloud analysis scope is expanded and documented.

Changes

Notebook review gate

Layer / File(s) Summary
Notebook review contract and validation
scripts/check_sensitive_content.py, tests/unittests/test_check_sensitive_content.py
Notebook embedded-visual inventory entries require both review fields to be true, with tests covering incomplete and completed checklists.
Notebook review rendering and policy
scripts/render_asset_inventory.py, dev-docs/*, CHANGELOG.md
Rendered checklists, policy guidance, approved inventory metadata, and changelog entries record the notebook review requirement.

Security and release hardening

Layer / File(s) Summary
Dev tooling input hardening
scripts/check_feature_doc_matrix.py, scripts/phantom_gen/*, scripts/audit_dependencies.py, scripts/check_doc_freshness.py
Filesystem paths are confined, git refs and audit arguments are validated, and external links are detected by URI scheme.
SonarCloud analysis scope
.sonarcloud.properties, sonar-project.properties, CHANGELOG.md
SonarCloud exclusions and project identity are updated, with the hardening recorded in the changelog.
Locked CI execution
.github/workflows/ci.yml, CHANGELOG.md
Build and scan jobs use locked uv environments, uv run --no-sync, and a pinned Codecov action.
OIDC release publishing
.github/workflows/release.yml, PUBLISHING.md
The release workflow builds with uv and publishes through PyPI Trusted Publishing using GitHub OIDC; setup and operation are documented.

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

Sequence Diagram(s)

sequenceDiagram
  participant ReleaseWorkflow
  participant uv
  participant PyPITrustedPublishing
  ReleaseWorkflow->>uv: build source distribution and wheel
  ReleaseWorkflow->>PyPITrustedPublishing: publish artifacts with GitHub OIDC
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main goal of fixing SonarCloud new-code security rating issues through security hardening.
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
  • Commit unit tests in branch fix/sonar-newcode-security-rating

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 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 `@CHANGELOG.md`:
- Around line 15-22: Align the changelog entry with the checks actually enforced
by audit_dependencies: either implement validation for general shell
metacharacters on both the primary and pip-audit fallback argument paths, or
narrow the entry’s claim to the existing validation behavior. Update the wording
around “audit-arg allowlisting” and “rejects passthrough args with shell
metacharacters” without changing unrelated entries.

In `@scripts/audit_dependencies.py`:
- Around line 121-125: Centralize audit-argument validation in
scripts/audit_dependencies.py before selecting either uv or pip-audit, applying
an explicit policy for rejected inputs and emitting sanitized error messages;
update CHANGELOG.md lines 15-22 to document only the inputs actually rejected
unless broader hardening is added.

In `@scripts/check_feature_doc_matrix.py`:
- Around line 21-26: Sanitize validation exceptions in _resolve_within and the
additionally affected validation paths so they do not interpolate raw
CLI-supplied paths or Git refs. Replace values such as path and ref identifiers
in raised error messages with generic, constant descriptions while preserving
the existing validation and failure behavior.

In `@scripts/phantom_gen/mpfb_generate.py`:
- Around line 224-226: Validate args.catalog_id before constructing out_obj,
requiring it to be a single safe filename component via an explicit allowlist
that rejects path separators and traversal segments. Preserve the resolved
out_dir behavior, and fail clearly before any output file is created when the ID
is invalid.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d5523e99-fe00-4d3a-994e-0875ca631faf

📥 Commits

Reviewing files that changed from the base of the PR and between c5318bd and ad8f33c.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • scripts/audit_dependencies.py
  • scripts/check_doc_freshness.py
  • scripts/check_feature_doc_matrix.py
  • scripts/phantom_gen/mpfb_generate.py
  • scripts/phantom_gen/run_catalog.py

Comment thread CHANGELOG.md Resolved
Comment thread scripts/audit_dependencies.py Resolved
Comment thread scripts/check_feature_doc_matrix.py Resolved
Comment thread scripts/phantom_gen/mpfb_generate.py Resolved
…hing (OIDC)

Replace the unpinned `pip install setuptools wheel twine build` + `python -m build`
with `uv build` (pinned uv toolchain already installed in the job), clearing
SonarCloud S8544/S8541 on the release path and dropping unused build tools.

Switch the PyPI publish step to Trusted Publishing (OIDC): remove the stored
PYPI_DEPLOY_API_KEY secret and add workflow `id-token: write`, so releases
authenticate with a short-lived token instead of a long-lived key. The step stays
inert until a GitHub Release is created and a PyPI trusted publisher is registered.

Add PUBLISHING.md documenting the (optional) one-time PyPI setup; note the pipeline
is inherited upstream cruft and unused by this fork.
… unpinned pip

Convert the `build` matrix job and the main-only `cloud-scans-after-gates` job to
`uv sync --extra dev --locked` + `uv run --no-sync` (cross-OS: no hardcoded
.venv/bin vs .venv/Scripts), and replace `pip install codecov` with the pinned
codecov/codecov-action. Clears SonarCloud S8544 (unpinned deps) on those jobs;
safety/pytest/coverage now come from the locked env. The intentionally unpinned
ci-latest.yml sweep is left as-is by design.
Automatic Analysis ignores sonar-project.properties, so add the file it does read
(.sonarcloud.properties) with exclusions for data/asset dirs where private data is
most likely to land (example_data, phantom_data, table_data, *.dcm, notebooks) plus
build noise. Mirror the same exclusions into sonar-project.properties (local/CI
sonar-scanner). Scan hygiene + defense-in-depth; not a privacy control.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 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 @.github/workflows/ci.yml:
- Around line 195-198: Update the “Install uv” setup-uv step to use the same
exact uv version and SHA256 checksum as the other setup-uv step, replacing the
range-based version input with matching version and checksum values while
preserving the existing action reference.

In @.github/workflows/release.yml:
- Around line 48-53: Extend the release workflow after the `uv build` and Grype
scan steps to generate and store an SBOM for `dist/`, attest build provenance,
sign every distribution artifact, and verify the signatures before the existing
publish step. Keep these controls as mandatory gates so publishing cannot
proceed when SBOM generation, attestation, signing, or verification fails.
- Around line 71-77: Correct the misleading pre-registration comment in the
“Publish distribution to PyPI (Trusted Publishing / OIDC)” step: either state
that tagged releases attempt publication and fail without a registered trusted
publisher, or add an explicit preflight condition that skips the step until
registration is complete. Keep the existing tag-based release behavior unless
implementing the gate.
- Line 12: Move id-token: write out of the workflow-wide permissions and into
the PyPI publish-only job. Split the production build and artifact-scanning
steps from publishing so the build job retains only the permissions it needs,
while the publish job explicitly grants id-token: write for Trusted Publishing.

In @.sonarcloud.properties:
- Around line 15-22: Remove the wildcard-based exclusion settings from
.sonarcloud.properties, including sonar.exclusions, sonar.test.exclusions, and
sonar.coverage.exclusions, and configure the intended patterns through SonarQube
Cloud Automatic Analysis or a CI/CD sonar-scanner/sonar-project.properties
configuration instead.

In `@PUBLISHING.md`:
- Around line 15-36: Update the Trusted Publishing setup guidance around the “no
PYPI_* secret” claim to include a one-time cleanup step: after verifying Trusted
Publishing works, delete the legacy PYPI_DEPLOY_API_KEY GitHub secret and revoke
its corresponding PyPI token. Make the documentation state that the no-secret
claim applies after this cleanup.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 374ee637-8c7d-4ad3-98cb-55d62fd57f53

📥 Commits

Reviewing files that changed from the base of the PR and between ad8f33c and d8f651a.

📒 Files selected for processing (6)
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • .sonarcloud.properties
  • CHANGELOG.md
  • PUBLISHING.md
  • sonar-project.properties

Comment thread .github/workflows/ci.yml
Comment on lines +195 to +198
- name: Install uv
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
with:
version: ">=0.11.19"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Workflow excerpt:"
if [ -f .github/workflows/ci.yml ]; then
  nl -ba .github/workflows/ci.yml | sed -n '170,255p'
else
  echo ".github/workflows/ci.yml not found"
fi

echo
echo "Relevant occurrences in workflows:"
rg -n "setup-uv|version:|pythonVersion|uv lock|uv lock --check|SBOM|provenance|cosign|sigstore|slsa|attest|dependency-audit|audit|SCA|SAST|zizmor|npm ci|npm install" .github/workflows || true

echo
echo "Lockfiles:"
git ls-files | rg '(^|/)(uv\.lock|uv.lock|requirements.*\.txt|poetry\.lock|pyproject\.toml|package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$' || true

Repository: kgrizz-git/MyPySkinDose

Length of output: 219


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "GitHub Actions workflow files:"
find .github/workflows -maxdepth 1 -type f -print 2>/dev/null | sort || true

echo
echo "Workflow excerpt:"
if [ -f .github/workflows/ci.yml ]; then
  awk '{printf "%4d\t%s\n", NR, $0}' .github/workflows/ci.yml | sed -n '170,255p'
else
  echo ".github/workflows/ci.yml not found"
fi

echo
echo "Relevant occurrences in workflows:"
rg -n "setup-uv|version:|pythonVersion|uv lock|uv lock --check|SBOM|provenance|cosign|sigstore|slsa|attest|dependency-audit|audit|SCA|SAST|zizmor|npm ci|npm install" .github/workflows || true

echo
echo "Lockfiles and build config:"
git ls-files | rg '(^|/)(uv\.lock|uv.lock|requirements.*\.txt|poetry\.lock|pyproject\.toml|package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$' || true

Repository: kgrizz-git/MyPySkinDose

Length of output: 7053


🌐 Web query:

astral-sh setup-uv version input pinned version checksum

💡 Result:

When using the astral-sh/setup-uv GitHub Action, you can specify both a pinned version of uv and a corresponding SHA256 checksum to ensure the security and determinism of your CI environment [1][2]. Action Configuration To pin a version and verify its integrity, use the version and checksum inputs in your workflow file [2][3]: - name: Install a specific version and validate the checksum uses: astral-sh/setup-uv@v9.0.0 with: version: "0.3.1" checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8" Version Management The action automatically verifies checksums for the default version it installs [2][4]. If you specify a version that is not yet known to the action, you must provide the checksum input to perform validation [2][4]. You can find the correct SHA256 hashes for any release on the official astral-sh/uv GitHub releases page [2]. Alternatively, you can rely on the action's built-in version resolution by pointing it to a configuration file, such as a uv.lock file or pyproject.toml, using the version-file input [1][5]. This is recommended for maintaining deterministic CI runs [1]. Security Best Practices For environments where you must avoid piping remote scripts directly into a shell (e.g., curl | sh), you can manually download a pinned release tarball from the astral-sh/uv releases page, verify its checksum using standard tools like sha256sum, and extract the binary to your desired path [6]. Official uv installer scripts now also support and embed checksum verification for increased security [7][8].

Citations:


Pin the uv download to an exact release with checksum validation.

The CI job uses version: ">=0.11.19", so these workflow runs can resolve different uv binaries even though dependency installs are locked. Use the same exact uv version and SHA256 checksum in the other setup-uv step (lines 228-231); setup-uv supports version plus checksum inputs.

🤖 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 @.github/workflows/ci.yml around lines 195 - 198, Update the “Install uv”
setup-uv step to use the same exact uv version and SHA256 checksum as the other
setup-uv step, replacing the range-based version input with matching version and
checksum values while preserving the existing action reference.

Comment thread .github/workflows/release.yml Outdated
permissions:
contents: read
actions: read
id-token: write # PyPI Trusted Publishing (OIDC): short-lived token, no stored secret

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files:"
git ls-files .github/workflows 2>/dev/null || true

echo
echo "release.yml with line numbers:"
if [ -f .github/workflows/release.yml ]; then
  nl -ba .github/workflows/release.yml | sed -n '1,140p'
fi

echo
echo "Security/distribution permissions and id-token references:"
rg -n "permissions:|id-token:|permissions:" .github/workflows/release.yml || true

Repository: kgrizz-git/MyPySkinDose

Length of output: 421


🏁 Script executed:

#!/bin/sh
set -euo pipefail

echo "release.yml with line numbers:"
awk '{printf "%6d\t%s\n", NR, $0}' .github/workflows/release.yml | sed -n '1,180p'

echo
echo "Relevant workflow sections:"
awk '{printf "%6d\t%s\n", NR, $0}' .github/workflows/release.yml | sed -n '1,35p;40,80p'

Repository: kgrizz-git/MyPySkinDose

Length of output: 8063


🌐 Web query:

GitHub Actions workflow permissions jobs job-id override parent scope id-token write read

💡 Result:

In GitHub Actions, you can define permissions at either the workflow level (applying to all jobs) or the job level (applying only to that specific job) [1][2]. When you specify permissions within a specific job, it completely overrides any workflow-level permissions [2]. The job-level permissions do not merge with or inherit from the workflow-level settings; they replace them entirely [2]. Regarding the id-token permission: - The valid values for id-token are write and none [3]. - You cannot set id-token to read [3]. Attempting to do so is invalid as there are no id-token resources to read [3]. - Setting id-token: write is required to allow a job to request and generate an OpenID Connect (OIDC) JSON Web Token (JWT) for authentication with external services (such as cloud providers) [4][5]. This permission does not grant the ability to modify or write to repository resources [4]. Example of a job-level override: jobs: my-job: runs-on: ubuntu-latest permissions: id-token: write # Overrides any workflow-level permissions for this job steps: - name: Get OIDC Token run: echo "Requesting OIDC token"

Citations:


Move id-token: write to the publish-only job.

Currently the workflow-wide permission makes checkout, the release gate, uv build, and artifact-scanning steps eligible to mint the PyPI OIDC token. Split production build/scan from PyPI publishing and set permissions: ... id-token: write only on the publish job; keep the build job at least privilege.

🤖 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 @.github/workflows/release.yml at line 12, Move id-token: write out of the
workflow-wide permissions and into the PyPI publish-only job. Split the
production build and artifact-scanning steps from publishing so the build job
retains only the permissions it needs, while the publish job explicitly grants
id-token: write for Trusted Publishing.

Comment on lines +48 to +53
# Build with the pinned uv toolchain already installed above (uv resolves
# build deps from the project) instead of an unpinned `pip install build`.
# Removes the SonarCloud S8544 (unpinned deps) finding on the release path and
# drops the unused setuptools/wheel/twine installs (gh-action-pypi-publish
# uploads on its own).
run: uv build

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Add release-artifact provenance controls before publishing.

The shown release path builds and Grype-scans dist/, but does not generate/store an SBOM, attest provenance, or sign and verify the distributions before upload. Add these gates before the publish job.

As per coding guidelines, CI/CD must generate SBOMs, attest provenance, and sign/verify artifacts before deployment.

🤖 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 @.github/workflows/release.yml around lines 48 - 53, Extend the release
workflow after the `uv build` and Grype scan steps to generate and store an SBOM
for `dist/`, attest build provenance, sign every distribution artifact, and
verify the signatures before the existing publish step. Keep these controls as
mandatory gates so publishing cannot proceed when SBOM generation, attestation,
signing, or verification fails.

Source: Coding guidelines

Comment thread .github/workflows/release.yml Resolved
Comment thread .sonarcloud.properties Resolved
Comment thread PUBLISHING.md Resolved
Add dev-docs, *.log, *.txt, and image globs to the Sonar exclusion lists (both
.sonarcloud.properties and sonar-project.properties). Align the stale local
scanner file to projectKey/name kgrizz-git_MyPySkinDose / MyPySkinDose and add
sonar.organization so it can actually run. Scan hygiene only; the commit/CI
privacy gates remain the PHI/PII control.
…ok assets

notebook_embedded_visual inventory entries now need a notebook_review block with
embedded_images_reviewed + burned_in_text_reviewed both true; an approved status
alone no longer clears a notebook with rendered image/PDF outputs
(NOTEBOOK_REVIEW_FIELDS_INCOMPLETE). Mirrors the DICOM/container checklists so
embedded outputs get an explicit human PII/PHI review. Updates the checker,
inventory template, render checklist, the getting_started entry, docs, and tests.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
tests/unittests/test_check_sensitive_content.py (1)

265-283: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Test incomplete notebook checklist values.

These tests cover a missing notebook_review object and the all-true case, but not a present checklist with one flag set to False or a non-boolean value. Add negative cases to protect the strict is True admission-gate contract.

🤖 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 `@tests/unittests/test_check_sensitive_content.py` around lines 265 - 283, Add
negative tests alongside test_notebook_embedded_visual_requires_review_checklist
and test_notebook_embedded_visual_with_completed_review_passes for a present
notebook_review checklist containing a False flag and a non-boolean value.
Assert both cases produce NOTEBOOK_REVIEW_FIELDS_INCOMPLETE, preserving the
strict is True admission-gate behavior.
🤖 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 `@dev-docs/approved_asset_inventory.md`:
- Line 24: Update the generated inventory instructions preceding the table to
reference notebook and container checklists alongside the DICOM checklist, then
regenerate dev-docs/approved_asset_inventory.md so its content reflects the
updated generator output.

---

Nitpick comments:
In `@tests/unittests/test_check_sensitive_content.py`:
- Around line 265-283: Add negative tests alongside
test_notebook_embedded_visual_requires_review_checklist and
test_notebook_embedded_visual_with_completed_review_passes for a present
notebook_review checklist containing a False flag and a non-boolean value.
Assert both cases produce NOTEBOOK_REVIEW_FIELDS_INCOMPLETE, preserving the
strict is True admission-gate behavior.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9db085e5-8927-4518-b4d9-633e50751253

📥 Commits

Reviewing files that changed from the base of the PR and between 6626912 and fa1d7fd.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • dev-docs/PRIVACY_AND_SENSITIVE_ASSETS.md
  • dev-docs/approved_asset_inventory.json
  • dev-docs/approved_asset_inventory.md
  • scripts/check_sensitive_content.py
  • scripts/render_asset_inventory.py
  • tests/unittests/test_check_sensitive_content.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Comment thread dev-docs/approved_asset_inventory.md Resolved
- .sonarcloud.properties: wildcards are unsupported by Automatic Analysis, so
  drop the inert glob exclusions and point to the SonarCloud UI / sonar-project
  .properties (CLI) instead.
- check_feature_doc_matrix: sanitize validation errors (no raw path/ref echoed).
- mpfb_generate: validate catalog_id as a safe filename stem before use.
- audit_dependencies + CHANGELOG: narrow wording to the control-char/whitespace
  check actually enforced on the shell-less uv audit call.
- release.yml: scope id-token:write to the publish job; correct the publish-step
  comment (fails, not "inert", without a trusted publisher).
- PUBLISHING.md: add one-time legacy-token delete/revoke step; afterward.
- render_asset_inventory: intro now names DICOM/container/notebook checklists;
  regenerated the inventory Markdown.
…operties

TEMPORARY experiment (to be reverted): add docs/sonar_probe/probe_control.py (not
excluded) and probe_excluded.py (matched by `sonar.exclusions=**/probe_excluded.py`),
each carrying a Sonar S1192 duplicated-literal signal. The PR's Automatic Analysis
scans new files, so comparing whether the excluded probe is analyzed vs the control
tells us empirically if wildcard exclusions in .sonarcloud.properties are honored.
…lusions

The PR probe proved wildcard sonar.exclusions ARE honored by Automatic Analysis
for this project (probe_excluded.py dropped, control analyzed), contradicting the
docs. Remove the temporary probe files and restore the real glob exclusions in
.sonarcloud.properties with a note on the doc-vs-observed-behavior gap.
@sonarqubecloud

Copy link
Copy Markdown

@kgrizz-git
kgrizz-git merged commit b5e42f6 into main Jul 25, 2026
13 checks passed
@kgrizz-git
kgrizz-git deleted the fix/sonar-newcode-security-rating branch September 5, 2026 05:09
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