Skip to content

fix(security): harden secret sanitizer boundaries and safe path exclusions (#116) - #203

Merged
dan-petty merged 3 commits into
release/v0.2.18from
fix/116-secret-sanitizer-word-boundaries
Sep 14, 2026
Merged

dan-petty merged 3 commits into
release/v0.2.18from
fix/116-secret-sanitizer-word-boundaries

Conversation

@dan-petty

@dan-petty dan-petty commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Secret Sanitizer Regex Boundary Hardening: Use boundary anchors and negative lookarounds to prevent internal substring matching inside safe task filenames (task-*.md) and paths while preserving underscore-prefixed tokens (my_key_sk-...).
  • Safe Path & Extension Exclusions: Exclude common documentation and code file extensions (.md, .py, .json, .yaml, .yml, .sh, .toml, .txt) from false-positive secret masking.
  • Release Workflow Draft Mode Default: Default devops release prepare --create-pr and devops release pr to draft mode (--draft/--no-draft), ensuring release PRs are not prematurely opened as ready for review.
  • Efficient gh CLI Usage: Decomposed release_pr into single-responsibility helpers strictly adhering to cyclomatic complexity $\le 10$ and maximum nesting depth $\le 5$ while utilizing native gh pr create.

Closes #116.

@dan-petty dan-petty added priority/p0-critical Priority P0: a release blocker or a critical defect scope/security Security linters (trivy, bandit, gitleaks, kubeconform) and Vault type/bug Type bug: the code does not do what it must labels Sep 14, 2026
@dan-petty dan-petty added this to the v0.2.18 milestone Sep 14, 2026

Copilot AI 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.

🟡 Changes recommended

Address the sanitizer leakage and length-boundary issues, add command-level draft assertions, and synchronize task statuses.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR hardens secret sanitization and makes release pull requests draft by default.

Changes:

  • Updates secret boundaries and path/extension exclusions.
  • Adds --draft/--no-draft release options and refactors PR creation.
  • Updates tests, documentation, lockfile, and task tracking.
File summaries
File Description
uv.lock Updates package version.
tests/test_release.py Tests release draft options.
tests/test_consolidation_security_sanitizer.py Adds sanitizer regression coverage.
src/devops_cli/security/sanitizer.py Changes secret matching boundaries and exclusions.
src/devops_cli/commands/release.py Adds draft handling and refactors PR creation.
docs/commands/release.md Documents draft options.
docs/CLI_REFERENCE.md Updates CLI reference documentation.
docs/agent/tasks/task-116-secret-sanitizer-word-boundaries.md Records task objectives and status.
docs/agent/task.md Updates the task index.
Review details

Suppressed comments (3)

docs/agent/task.md:64

  • The index repeats this task as In Progress with PR set to TBD, even though this pull request is already open. Per the repository lifecycle, an opened PR must be represented as In Review and linked from the index; otherwise project/task synchronization reports the wrong state.
| [#116](https://github.com/dan-petty/devops-cli/issues/116) | TBD | Secret sanitizer regex word boundary hardening and artifact name guard | `In Progress` | [`task-116-secret-sanitizer-word-boundaries.md`](tasks/task-116-secret-sanitizer-word-boundaries.md) |

src/devops_cli/commands/release.py:598

  • The added tests only inspect dry-run JSON. The real behavior is in _build_release_pr_command, but no assertion checks that the default invocation passes --draft or that --no-draft omits it, so a regression in the actual gh pr create arguments would still pass. Add command-level assertions for both paths around the mocked subprocess call.
    if draft:
        pr_cmd.append("--draft")

src/devops_cli/security/sanitizer.py:33

  • This quantifier now permits only 19 characters after sk- ({18,} plus the mandatory final alphanumeric), while the issue specifies {20,} and the previous pattern required at least 20. Preserve the stated minimum so shorter identifiers are not newly classified as OpenAI credentials (for example, use {19,} before the final alphanumeric).
            r"(?<![a-zA-Z0-9/\\<])(?<!task-)(?<!subtask-)sk-[A-Za-z0-9_-]{18,}[A-Za-z0-9]\b"
  • Files reviewed: 8/9 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/devops_cli/security/sanitizer.py Resolved
Comment thread src/devops_cli/security/sanitizer.py Resolved
@dan-petty dan-petty added the status/in-review Status In Review: the pull request of the item is open label Sep 14, 2026
@dan-petty dan-petty mentioned this pull request Sep 14, 2026
11 tasks done
@dan-petty
dan-petty merged commit 539fbbc into release/v0.2.18 Sep 14, 2026
4 of 5 checks passed
@dan-petty
dan-petty deleted the fix/116-secret-sanitizer-word-boundaries branch September 14, 2026 14:42
dan-petty added a commit that referenced this pull request Sep 16, 2026
* feat(release): v0.2.18

* fix(security): harden secret sanitizer boundaries and safe path exclusions (#116) (#203)

* fix(security): harden secret sanitizer boundaries and safe path exclusions (#116)

* fix(release): default release PRs to draft mode

* fix(security): harden secret boundaries, remove extension lookahead, and update task status (#116)

* fix(security): remediate devsecops findings and add native rate management (#204)

* test

* fix(security): remediate devsecops findings and add native rate management

* docs(task): update task-204 status to in review and link PR #204

* fix(security): permit token masking in filesystem path arguments

* fix(security): remediate review findings, exclude home in sandbox, and relocate MockProvider (#205) (#206)

* fix(security): remediate review findings, exclude home in sandbox, and relocate MockProvider (#205)

* docs(task): update task-205 status to in review and link PR #206

* test(sandbox): provide explicit tmp_path workspace_dir in test_docker_sandbox_wait_timeout

* fix(rag): support both gitignore and gitwildmatch pathspec factories

* feat(sandbox): multi-tier networking options and decommission task.md (#207) (#208)

* feat(sandbox): multi-tier networking options and decommission task.md index (#207)

* docs(agent): transition task 207 to in-review with PR #208

* test(projects): update test fixtures to eliminate task.md references

* fix(security): replace concrete RFC 1918 and internal homelab endpoints with standard documentation values

* fix(sandbox): harden network containment, secret output masking, and rate limiter caching

* fix(sandbox): remediate egress containment, dns resolution, and output masking findings (#207)

* fix(security): stream sandbox container output directly to sys streams avoiding logger sink cleartext alerts (#207)

* docs(agents): mandate working pull requests from oldest to newest (FIFO)

* docs(roadmap): add v0.2.23 reactive workstation command center and interactive TUI

* docs(agents): mandate root-cause remediation, roadmap synthesis, and interaction improvement

* fix(docs): escape placeholder angle brackets and prune completed roadmap matrix items

* fix(security): stream sandbox output via centralized output writers to resolve codeql cleartext alerts

* fix(k8s): uncap ollama memory limits and elevate daemonset/deployment thresholds (#209) (#210)

* fix(k8s): uncap ollama memory limits and elevate daemonset/deployment thresholds (#209)

* fix(k8s): add CoreDNS resource configs and tighten test assertions (#209)

* fix(github): enforce gh request throttling, disk quota persistence, and diff-only project sync (#211) (#212)

* fix(github): enforce window-budgeted rate pacing, disk quota persistence, and diff-only project sync (#211)

* docs(agent): record PR #212 in task 211 tracking

* fix(github): enforce low-quota circuit breakers, preamble-tolerant JSON parsing, and casing-safe project diffing (#211)

* fix(github): replace quota thresholds with logical exponential backoff (#211)

* test(github): patch run_gh instead of run_subprocess in reconcile tests (#211)

* fix(github): derive rate limit pacing from actual response values without hardcoded windows (#211)

* fix(ci): stop running all of the ci tasks every time a pr is marked ready for review.

* fix(ci): decouple project automation into dedicated workflow and add quota safety guards (#211)

* fix(github): align rate limiter baseline velocity and add quota test coverage (#211)

* refactor(ai): eliminate inline function parameter defaults in favor of defaults submodule

* fix(github): enforce strict non-negative rate quotas, 25% threshold, and remediate review findings (#211)

* fix(typecheck): resolve Path None guard and optional quota remaining in mypy (#211)

* docs: refresh CLI and MCP references for updated commands and errors (#211)

* fix(ci): enforce mandatory pre-push devops ci gate, handle unauthenticated acquire, and expand test coverage (#211)

* fix(pr): align checks fallback to run_subprocess and isolate rate limiter sleep test (#211)

* fix(ci): complete pre-push gate, argo drift tests, and coverage expansion (#211)

* docs(agent): update task-211 documentation with linear window pacing and pre-push quality gate (#211)

* fix(pr): guard pr ready against failing checks and fix project automation uv sync (#211)

* docs(pr): update cli and mcp reference for pr ready --force

* fix(github): address pr 212 review comments on workflows, sandbox, defaults, and rate limiter (#211)

* fix(security): derive artifact version from package metadata and validate whitelist tokens (#211)

* feat(security): sigstore cosign container provenance and image signing (#112) (#213)

* fix(ci): prune all merged PR devcontainer images from ghcr and guard in-flight builds

* feat(security): sigstore cosign container provenance and image signing (#112)

* docs(agent): link PR 213 in task 112 tracking doc

* fix(security): resolve review comments for cosign container provenance (#112)

* ci: re-trigger validation after resolving all review threads

* feat(security): falco ebpf runtime security and anomaly streamer (#113) (#214)

* feat(security): falco ebpf runtime security and anomaly streamer (#113)

* fix(security): resolve review comments for falco ebpf runtime security (#113)

* chore: retrigger validation after resolving all review threads

* feat(security): distributed threat intelligence valkey l2 cache and radar batching (#122) (#215)

* feat(security): distributed threat intelligence valkey l2 cache and radar batching (#122)

* fix(security): resolve review comments for threat intel valkey l2 cache and batching (#122)

* chore: retrigger validation after resolving all review threads

* perf(github): adjust rate limit no-delay used threshold to 30%
@dan-petty dan-petty mentioned this pull request Sep 16, 2026
7 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p0-critical Priority P0: a release blocker or a critical defect scope/security Security linters (trivy, bandit, gitleaks, kubeconform) and Vault status/in-review Status In Review: the pull request of the item is open type/bug Type bug: the code does not do what it must

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants