Skip to content

ci: pin actions, read-only perms, secret scan, parser tests#4

Closed
muhammademanaftab wants to merge 3 commits into
security-hardeningfrom
ci-tests
Closed

ci: pin actions, read-only perms, secret scan, parser tests#4
muhammademanaftab wants to merge 3 commits into
security-hardeningfrom
ci-tests

Conversation

@muhammademanaftab

Copy link
Copy Markdown
Owner

Second of four staged hardening PRs. Stacked on #3 (base branch security-hardening); rebase to develop once #3 merges.

What and why

The transcript parser (the most fragile code in the repo) and the new redaction pass had no tests, and CI ran with default write permissions, unpinned actions, and no secret scan.

  • test_capture.py: stdlib, fixture-driven. Covers extraction of the last real prompt/response, skipping auto-injected prompts, tool_use field filtering (content/old_string/new_string dropped), pending-background skip, and redaction/truncation for every pattern class. Runs in CI.
  • ci.yml: permissions: contents: read; actions/checkout and actions/setup-python pinned to commit SHAs (version in a comment); a gitleaks job scanning full history so HARD rule security: redact secrets, enforce https, harden the ingest backend #3 (grep the diff before push) is machine-enforced.

Verification

  • python3 skills/setup/test_capture.py -> 9 passed locally.
  • Existing digest/synth CI steps unchanged.

🤖 Generated with Claude Code

muhammademanaftab and others added 3 commits July 6, 2026 12:32
The transcript parser (the most fragile code in the repo) and the new
redaction pass had no tests, and CI could neither catch a committed
secret nor ran with least privilege.

- test_capture.py: fixture-driven tests for the transcript parser
  (extraction, auto-injected-prompt skipping, tool_use field filtering,
  pending-background skip) and for redaction / truncation. Runs in CI.
- ci.yml: top-level `permissions: contents: read`; actions pinned to
  commit SHAs with a version comment; a gitleaks job scanning full
  history so the "grep the diff before push" rule is machine-enforced.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The parser tests embed deliberately fake secrets (fake AWS/GitHub/
OpenAI keys) so the redaction pass can be exercised. Add a gitleaks
config that extends the default ruleset and allowlists that one test
file, so the secret-scan job does not flag its fixtures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Remove the vacuous exemption on the secret-is-gone assertion (both
exempted kinds pass without it), add cases for prefixed env-var
assignments (GITHUB_TOKEN=, DB_PASSWORD=, STRIPE_SECRET_KEY:,
AWS_SECRET_ACCESS_KEY=), and cover the https-only refusal in
load_env().

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant