Skip to content

fix(security): close open CodeQL alerts (0600 lock file, hostname-safe URL asserts, pinned actions)#589

Open
the-data-viking wants to merge 2 commits into
mainfrom
fix/codeql-alert-sweep
Open

fix(security): close open CodeQL alerts (0600 lock file, hostname-safe URL asserts, pinned actions)#589
the-data-viking wants to merge 2 commits into
mainfrom
fix/codeql-alert-sweep

Conversation

@the-data-viking

Copy link
Copy Markdown
Collaborator

Closes out the CodeQL alerts surfaced when #587 re-attributed pre-existing lines.

Code fixes

  • py/overly-permissive-file (src/althing/checkpoint.py:172): the checkpoint .lock file was created 0o644; now 0o600. Verified locally that the file lands on disk as 0600.
  • py/incomplete-url-substring-sanitization:
    • tests/test_credentials.py: "console.anthropic.com" in msg → extract URLs from the message and compare urlparse(...).hostname.
    • tests/test_pack_calibrate.py: startswith("https://althing.dev") (spoofable by althing.dev.evil.com) → assert parsed scheme + hostname equal ("https", "althing.dev").
  • actions/unpinned-tag: pinned third-party actions to commit SHAs with version comments —
    • publish.yml: pypa/gh-action-pypi-publishba38be9e (v1.14.1, the current release/v1 head; matches the pin style already used in publish-test.yml)
    • docker.yml: docker/setup-qemu-action → v4.2.0, docker/setup-buildx-action → v4.2.0, docker/login-action → v4.4.0, docker/build-push-action → v7.3.0

Dismissed as false positives (not fixed in code)

The three py/clear-text-logging-sensitive-data alerts are name-heuristic hits, not actual secret/PII logging, and were dismissed with comments:

  • cli/commands.py pack-diff output (2 alerts): prints the aggregate gender composition of synthetic persona packs — the gender_split field name trips CodeQL's "private" heuristic. Masking it would gut althing pack diff.
  • cli/commands.py SynthBench submit guard (1 alert): prints the name of the required env var (SYNTHBENCH_API_KEY) in a "set this variable" error; the key's value is never read into the message.

Verification

  • Full suite on this branch after rebase onto post-rename main: 3482 passed, 7 skipped, coverage 87.7%.
  • ruff check / ruff format --check clean on touched files.
  • Lock-file permission change exercised directly (_acquire_dir_lockstat0o600).

🤖 Generated with Claude Code

…L asserts, pinned actions

- checkpoint.py: create the checkpoint lock file 0600 instead of 0o644
  (py/overly-permissive-file).
- tests: replace URL substring/prefix assertions with urllib.parse
  hostname comparisons in test_credentials and test_pack_calibrate
  (py/incomplete-url-substring-sanitization).
- workflows: pin pypa/gh-action-pypi-publish and the four docker/*
  actions to commit SHAs (actions/unpinned-tag).

The py/clear-text-logging-sensitive-data alerts (pack-diff gender
composition of synthetic personas; printing the *name* of the
SynthBench API key env var) are heuristic false positives and were
dismissed with comments rather than masked.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@the-data-viking the-data-viking added the semver:patch Bump patch version on merge label Jul 20, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deploying synthpanel with  Cloudflare Pages  Cloudflare Pages

Latest commit: d050d99
Status: ✅  Deploy successful!
Preview URL: https://45b76f33.synthpanel.pages.dev
Branch Preview URL: https://fix-codeql-alert-sweep.synthpanel.pages.dev

View logs

Comment thread tests/test_credentials.py Fixed
…satisfy CodeQL

'"console.anthropic.com" in linked_hosts' is exact-match against a
list of parsed hostnames, but py/incomplete-url-substring-sanitization
flags any 'in' test with a hostname-like literal. Use an explicit ==
comparison instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver:patch Bump patch version on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants