Skip to content

Resolve open code scanning alerts - #489

Open
lelia wants to merge 1 commit into
mainfrom
fix/code-scanning-alerts
Open

lelia wants to merge 1 commit into
mainfrom
fix/code-scanning-alerts

Conversation

@lelia

@lelia lelia commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Resolves the five open code scanning alerts.

Cache poisoning in pr-preview.yml (alerts 3–6)

A workflow_dispatch run executes from the default branch, so the build job checked out and ran pull request code (sync_version.py, hatch version, hatch build, the wheel smoke test) with write access to the default branch's GitHub Actions cache. CodeQL has no access check that mitigates this for workflow_dispatch, and the run-from-default-branch guard is what put the job in that scope.

This removes the manual dispatch trigger and its inputs. The publish-preview and publish-docker-preview label triggers are unchanged; they run on pull_request, in the pull request's own cache scope. Nothing in the repository restores an Actions cache today, so this closes a latent path rather than an exploitable one.

What goes away:

  • Publishing TestPyPI and Docker previews in one run. Apply both labels instead; that starts two runs.
  • The sdk_preview_version input for Docker previews. Dockerfile.preview still accepts --build-arg SDK_PREVIEW_VERSION=... for local builds.

CONTRIBUTING.md is updated to match.

Clear-text logging in output.py (alert 7)

False positive. CodeQL's sensitive-data heuristic matches "confidential", so props.get("confidentialityImpact") in the FOSSA CVSS metric builder was treated as secret data. That taint followed the FOSSA payload into the JSON report written by output_console_json. The value is a public CVSS base metric.

_build_metrics now reads the prop keys from a module-level _CVSS_METRIC_FIELDS table instead of eight inline props.get("...") literals. The output is unchanged. CodeQL only treats a lookup key as sensitive when a string literal reaches it through local flow, so this clears the alert. If you'd rather not change code for a heuristic, dismissing alert 7 as a false positive also works.

Version

Bumped to 2.15.11 (2.15.10 is on PyPI), with a changelog entry.

Testing

  • uv run --extra test pytest tests/unit: 730 passed
  • actionlint: no new findings (it still reports the existing $/ self-repo uses: syntax)
  • zizmor --offline .github/workflows/pr-preview.yml: no findings
  • The CodeQL run on this PR should show alerts 3–7 as fixed.

Remove the workflow_dispatch trigger from the PR preview workflow. A
dispatch runs from the default branch, so the build job ran pull request
code with write access to the default branch's Actions cache. Label
events run in the pull request's own cache scope and stay as the only
way to publish previews.

Drive the FOSSA CVSS metric lookup from a table of prop keys. CodeQL
treated the literal "confidentialityImpact" lookup as secret data and
flagged the JSON report written to the console; the value is a public
CVSS metric.

Bump the version to 2.15.11.
@lelia
lelia requested a review from a team as a code owner December 5, 2026 02:22
@cursor

cursor Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes how trusted preview artifacts are published in CI and touches a security-sensitive workflow; runtime FOSSA output should be unchanged.

Overview
Security and CodeQL fixes for the PR preview workflow and FOSSA CVSS output, releasing 2.15.11.

The Publish PR Preview workflow no longer supports manual workflow_dispatch. Previews run only when publish-preview or publish-docker-preview is applied to an open in-repo PR. Related dispatch inputs, default-branch guards, combined publish conditions, and the Docker SDK_PREVIEW_VERSION build-arg are removed; CONTRIBUTING.md documents the cache-scope rationale.

In fossa_compat, CVSS base metrics are driven by a module-level _CVSS_METRIC_FIELDS table instead of inline props.get("confidentialityImpact")-style lookups. Emitted FOSSA metrics are unchanged; the refactor clears a CodeQL false positive on sensitive-data logging.

Reviewed by Cursor Bugbot for commit 0d0e97f. Configure here.

@lelia
lelia deployed to socket-firewall December 5, 2026 02:23 — with GitHub Actions Active

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0d0e97f. Configure here.

Comment thread CHANGELOG.md
- Removed the manual dispatch trigger from the pull request preview workflow. A
dispatch ran pull request code with write access to the default branch's
GitHub Actions cache. Previews are now published only from the
`publish-preview` and `publish-docker-preview` labels.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Changelog narrates workflow incident

Low Severity

The 2.15.11 notes violate the user-facing changelog rule. They recount how manual dispatch ran pull request code against the default branch Actions cache, which is incident and workflow rationale rather than product, dashboard, or CI-log behavior. The published CLI is unchanged, so the Security heading overstates what this release does.

Fix in Cursor Fix in Web

Triggered by learned rule: CHANGELOG is user-facing — short bullets only

Reviewed by Cursor Bugbot for commit 0d0e97f. Configure here.

This branch was successfully deployed

1 active deployment
socket-firewall — 0d0e97f7 Deployed Dec 5, 2026 by lelia via python-sfw-smoke-enterprise #748
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