[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DDJ3Z86RTM7YBDFF4QED1A":3,"skill-same:01M7DDJ3Z86RTM7YBDFF4QED1A":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":13,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7DDJ3Z86RTM7YBDFF4QED1A","security-hardening",null,"Audit and harden repository security — supply chain, CI\u002FCD scanners, secrets, credentials","AgentParadise\u002Fagentic-workspace","AgentParadise","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F242330113?v=4","01M6C52MXXSE01NH5GKMC3N7JA","01M7DDFCPP7TW5GGJZYGFPKMK2",0,"MIT","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fsecurity-hardening\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\ndescription: Audit and harden repository security — supply chain, CI\u002FCD scanners, secrets, credentials\nargument-hint: \"[audit|fix|both] - default: both\"\nmodel: opus\nallowed-tools: Read, Grep, Glob, Bash, Edit, Write\n---\n\n# Security Hardening\n\nAudit a codebase for security vulnerabilities and implement fixes. Three modes:\n\n- **audit** — read-only scan, produces a prioritized findings report\n- **fix** — implements the fixes (confirm with user before each change)\n- **both** (default) — audit first, then fix\n\n## Variables\n\nMODE: $1 || \"both\"\n\n---\n\n## Threat Model\n\nThis skill covers eleven attack surface areas. Each has a concrete historical incident:\n\n### 1. Supply Chain — Tag Repointing (XZ-utils, 2024)\n\nA GitHub Actions workflow step runs inside CI with access to repository secrets and write\npermissions. If a third-party Action is pinned to a mutable version tag (`@v4`), a\ncompromised maintainer can silently move that tag to an attacker-controlled commit — every\nrepo using the tag now executes malicious code on the next push with no diff in that repo.\n\nThe XZ-utils backdoor (CVE-2024-3094) demonstrated exactly this social engineering + supply\nchain path: a patient attacker gained maintainer trust over years, then inserted a backdoor.\n\n**Defense:** Every `uses:` line pins to an **immutable commit SHA** with the version as an\ninline comment for human readability. Any update requires an explicit SHA change — producing\na reviewable diff.\n\n```yaml\n# SAFE — SHA cannot be repointed; update is a visible diff\n- uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4\n\n# UNSAFE — tag can be silently moved to a malicious commit overnight\n- uses: actions\u002Fcheckout@v4\n```\n\nTo update: `gh api repos\u002Factions\u002Fcheckout\u002Fgit\u002Fref\u002Ftags\u002Fv4 --jq '.object.sha'`\n(If the tag is annotated, dereference: `gh api repos\u002F\u003Cowner>\u002F\u003Crepo>\u002Fgit\u002Ftags\u002F\u003Csha> --jq '.object.sha'`)\n\n### 2. Supply Chain — Postinstall Hook Injection (event-stream 2018, ua-parser-js 2021)\n\n`npm install` and `pnpm install` execute `preinstall`\u002F`postinstall` scripts from every\npackage in the dependency tree by default — including transitive dependencies you never\nexplicitly chose. An attacker who compromises or publishes a malicious version of any\npackage in your tree can run arbitrary code in CI (with access to secrets) during install.\n\nThe event-stream incident: a trusted npm package was transferred to a malicious actor who\nadded a dependency that exfiltrated cryptocurrency wallet credentials via postinstall.\n\n**Two defenses — choose based on the project:**\n\n```yaml\n# OPTION A: Blanket block — safe for pure JS build tools that don't need native binaries\n- run: npm ci --ignore-scripts\n  # ^ Blocks ALL postinstall\u002Fpreinstall hooks. Works for most dashboard\u002Fdocs builds.\n  #   Vite 7.x sources esbuild via optional platform packages, not postinstall,\n  #   so this is safe for Vite projects.\n\n# OPTION B: Allowlist (preferred for pnpm projects with native deps like esbuild\u002Fsharp)\n# In package.json:\n# \"pnpm\": { \"onlyBuiltDependencies\": [\"esbuild\", \"sharp\", \"@img\u002Fsharp-linux-x64\"] }\n# Then: pnpm install (no flag needed — allowlist enforces it)\n#\n# Why prefer allowlist over --ignore-scripts when native deps exist:\n# --ignore-scripts breaks packages that legitimately need a build step (native addons,\n# platform-specific binaries). The allowlist is explicit, code-reviewed, and auditable —\n# you can see exactly which packages are allowed to run install scripts and why.\n```\n\n### 3. Dependency Vulnerabilities — Known CVEs (Log4Shell 2021, requests CVE-2023-32681)\n\nDependencies drift out of date and accumulate published CVEs. Without automated scanning,\nteams only discover vulnerabilities reactively — after exploitation or incident disclosure.\n\n**Defense:** Automated SCA (Software Composition Analysis) on every push and PR:\n\n- **OSV Scanner** — checks all lock files against the OSV database (covers PyPI, npm,\n  crates.io, Go, Maven). Single tool, multiple ecosystems.\n- **dependency-review-action** — GitHub-native, blocks PRs that introduce newly vulnerable\n  packages. Requires GitHub Advanced Security (free for public repos).\n- **Dependabot** — automated PRs for outdated\u002Fvulnerable dependencies.\n\n### 4. Excessive CI Permissions (blast radius amplification)\n\nBy default, GitHub Actions runs with `write-all` permissions — a compromised or buggy step\ncan push to branches, create releases, modify packages, or read\u002Fwrite Actions secrets.\nLeast-privilege defaults contain the blast radius of any single compromised step.\n\n**Defense:** Top-level `permissions: contents: read` in every workflow. Jobs that need\nwrite access declare it explicitly at the job level, creating a clear audit trail.\n\n```yaml\n# At top of workflow file — least-privilege default\npermissions:\n  contents: read\n\njobs:\n  release:\n    # Only this job needs write — visible, reviewable, scoped\n    permissions:\n      contents: write\n      packages: write\n```\n\n### 5. Credential Exposure (Codecov breach 2021, dozens of accidental git commits)\n\nSecrets committed to git are permanently exposed — even if deleted in a follow-up commit,\nthey exist in git history, forks, CI logs, and any clone made during the exposure window.\n\n**Defenses (layered):**\n- `.gitignore` patterns for key\u002Fcert extensions (passive safety net)\n- Pre-commit secret scanning — `gitleaks` or `detect-secrets` blocks the commit before\n  it ever reaches git history (active gate)\n- GitHub secret scanning — catches exposed secrets in pushes even without pre-commit hook\n- CODEOWNERS restricting who can modify high-risk paths\n\n### 6. Static Application Security Testing — Code Vulnerabilities\n\nSQL injection, XSS, insecure deserialization, path traversal, hardcoded credentials in\nsource code — these require SAST tooling to catch systematically.\n\n**Defense:**\n\n- **CodeQL** — GitHub-native, free for public repos. Covers Python, JavaScript\u002FTypeScript,\n  Java, Go, C\u002FC++, C#, Ruby, Swift. Runs as a workflow job.\n- **Semgrep** — OSS rules engine with security-focused rulesets. Faster than CodeQL,\n  easier to add custom rules.\n- **Bandit** — Python-specific SAST. Fast, no config needed.\n- **ESLint `plugin:security`** — JavaScript\u002FTypeScript security rules.\n\n### 7. Container Vulnerabilities — Image CVEs\n\nDocker images accumulate OS-level CVEs in base image packages over time. OSV Scanner\ncovers app-layer dependencies (Python, npm, etc.) in lock files. For OS-layer CVEs,\nuse **Docker Scout**.\n\n**Why Docker Scout over alternatives:** You already trust Docker for the container runtime —\nScout extends that existing trust rather than introducing a new third-party security\ndependency. Trivy (aquasecurity) is commonly cited but aquasecurity has had multiple\nsecurity incidents; a compromised scanner is a supply chain risk that undermines the\nwhole point. Scout is maintained by the same team that ships the runtime, keeping the\ntrust chain short.\n\n### 8. Version Pinning — Lock File Discipline\n\n`npm install` (not `ci`) or `pip install` (not from lock file) resolve \"latest compatible\"\nversions, meaning a build on Tuesday may install a different dep than Monday's build —\nsilently picking up a newly published malicious or broken version.\n\n**Defenses:**\n- Always commit lock files (`uv.lock`, `package-lock.json`, `pnpm-lock.yaml`, `Cargo.lock`)\n- Use `npm ci` (not `npm install`) — enforces exact lock file versions, fails on mismatch\n- Use `pnpm install --frozen-lockfile` in CI\n- Use `uv sync --frozen` in CI — fails if `uv.lock` is out of sync with `pyproject.toml`\n- Pin Python version explicitly: `python-version: \"3.12\"` not `\"3.x\"` in CI\n\n```yaml\n# SAFE — exact versions from lock file, fails if lock file is stale\n- run: npm ci --ignore-scripts\n\n# UNSAFE — resolves fresh, may pick up new malicious version\n- run: npm install\n```\n\n### 9. Transitive Dependency Poisoning (litellm 2026, Shai-Halud 2025)\n\nAn attacker gains access to a package maintainer's credentials — via phishing, token theft,\nor account takeover — and publishes a malicious version of a package. The payload doesn't\nneed to be in a package you directly depend on. It can be buried anywhere in the transitive\ndependency tree: if package A depends on B which depends on C, and C is poisoned, everyone\nwho installs A is compromised.\n\nThe attack vectors evolve faster than defenses:\n- **Python `.pth` files** (litellm 1.82.8, 2026): A `.pth` file in `site-packages` executes\n  arbitrary Python on interpreter startup — before your code even imports anything. This\n  bypasses `--ignore-scripts` because it's not an install hook, it's a Python runtime feature.\n  The litellm attack base64-encoded instructions to exfiltrate SSH keys, cloud credentials,\n  Kubernetes configs, shell history, and crypto wallets to a remote server.\n- **`__init__.py` injection**: Malicious code added to a package's `__init__.py` runs on\n  first import. No install hooks needed.\n- **npm postinstall** (event-stream 2018, ua-parser-js 2021): Covered in threat model #2,\n  but the credential theft pattern is identical.\n- **Shai-Halud** (2025): Supply chain attack targeting AI\u002FML ecosystem packages with\n  credential exfiltration payloads.\n\nThe contagion is the real danger: litellm has 97M downloads\u002Fmonth, but the blast radius\nextends to every project that depends on litellm (e.g., `pip install dspy` also pulled in\nthe poisoned version). One compromised package deep in a dependency tree can affect thousands\nof downstream projects.\n\n**Defenses (layered):**\n- **Hash verification**: Pin not just versions but content hashes. Even if an attacker\n  publishes a new artifact for the same version, the hash won't match.\n- **Native ecosystem audits**: `pip-audit` and `pnpm audit` check for known-compromised\n  versions beyond what OSV Scanner covers.\n- **Dependency minimization**: The only dependency that can't be poisoned is one you don't\n  have. Fewer dependencies = smaller attack surface. See threat model #10.\n- **Vendoring critical deps**: For small, critical packages, copy the source into your repo.\n  You now control the code and review changes via normal PR review.\n- **Lock file discipline**: Covered in threat model #8 — ensures reproducible installs.\n\n### 10. Dependency Sprawl — Attack Surface Proportional to Dependency Count\n\nEvery dependency is a trust relationship. Every *transitive* dependency is a trust\nrelationship you didn't explicitly agree to. A project with 500 npm packages has 500\npotential supply chain entry points — and you've probably reviewed zero of the transitive\nones.\n\nThe goal is to **minimize dependencies toward zero**. This isn't about reinventing wheels —\nit's about recognizing that each dependency carries ongoing risk that compounds over time:\n- Maintainer accounts can be compromised\n- Projects can be transferred to malicious actors\n- Abandoned packages accumulate unpatched CVEs\n- Deep dependency trees create blast radius you can't predict\n\n**Strategies:**\n- **Prefer stdlib**: Python's standard library and Node's built-in modules cover more than\n  most developers realize. `urllib`, `json`, `pathlib`, `subprocess`, `http.server`, etc.\n- **Yoink simple functionality**: When a dependency provides a small, well-understood function,\n  use an LLM to rewrite it locally. A 50-line utility you own is safer than a package with\n  200 transitive dependencies.\n- **Regular dependency audits**: `uv tree --depth 3` and `pnpm why \u003Cpackage>` to understand\n  what you're actually pulling in and whether each dependency earns its place.\n- **Remove unused deps**: Dependencies accumulate. Periodically run `deptry` (Python) or\n  `depcheck` (Node) to find packages that are imported nowhere.\n- **Consolidate overlapping deps**: If two packages serve similar purposes (e.g., `recharts`\n  and `@nivo\u002F*` for charts), pick one and remove the other.\n- **Question heavy transitive trees**: A package with 3 direct deps that pulls in 150\n  transitive deps is a red flag. Look for lighter alternatives or vendor the functionality.\n\n\n### 11. Runtime Exposure — Published Ports Bypass the Host Firewall (observed incident, 2026)\n\nEvery area above concerns code *entering* the system. This one concerns a service already\nrunning and reachable — the surface an audit of the repository never sees, because nothing\nin the repository is wrong.\n\n**The observed incident.** A `postgres:16` container was started by hand on a public VPS\nwith `-p 5433:5432`, to hold throwaway test fixtures. Timeline from its own logs:\n\n```\n02:20:09  container starts\n02:51:37  first connection from the internet matches pg_hba \"host all all all\"\n02:55:50  remote code execution\n12:00     XMRig-derived Monero miner running as \u002Ftmp\u002Fsystemd\n```\n\nThirty-five minutes from start to compromise. It then consumed ~8 of 16 cores for 21 days\nbefore anyone noticed, and it was noticed only because someone asked why the machine was\nslow.\n\n**Failure one: the firewall was enabled and did nothing.** `ufw` reported default-deny\nincoming with only SSH and Tailscale allowed. Docker publishes a port by writing its own\nNAT rule; traffic is rewritten to the container address *before* the routing decision, so\nit is forwarded and never traverses the INPUT chain ufw manages. Docker provides\n`DOCKER-USER` as the hook for exactly this and ships it empty:\n\n```\n-A DOCKER ! -i docker0 -p tcp --dport 5433 -j DNAT --to-destination 172.17.0.2:5432\n\n$ iptables -S DOCKER-USER\n-N DOCKER-USER          # no rules\n```\n\nScope that claim precisely: it holds for traffic DNATed to a bridge-network container.\n`ufw` *can* manage forwarding policy — the problem is that a default-deny **incoming**\npolicy, which is what everyone configures and everyone checks, does not govern this path.\n\nA host firewall that reports a rule it does not enforce is worse than no firewall, because\nit terminates the investigation.\n\n**Failure two: a database superuser can run programs as the server's OS user.** The\nattacker did not exploit a vulnerability. `COPY ... FROM PROGRAM` is documented\nfunctionality for ETL, available to superusers and to members of\n`pg_execute_server_program`. It runs the command with the OS credentials of the PostgreSQL\nserver process.\n\n```sql\nCOPY tests FROM PROGRAM 'echo \u003Cbase64>|base64 -d|bash';\n```\n\nBe precise about the ceiling, because the imprecise version leads people to the wrong fix.\nA superuser is *not* automatically host root; it obtains the privileges of the account the\nserver runs as, subject to container and OS confinement. Related but distinct capabilities:\n`pg_read_server_files` **reads** files that account can read - it does not execute anything -\nwhile untrusted procedural languages and C extensions can reach native execution where the\nextension is available and loadable. Different doors, one blast radius.\n\nThere is no patch for this because nothing was violated. Which is exactly why an exposed\nPostgreSQL is not \"a database at risk\" but \"the server's OS account at risk\".\n\n**This was not CVE-2025-1094**, and the distinction matters in both directions. That CVE is\nan input-escaping flaw in PostgreSQL\u002Flibpq quoting functions that can produce SQL injection\nunder affected encodings; upgrading fixes it, and you should. What upgrading does *not* do\nis remove an authenticated superuser's documented ability to run server-side programs.\nEstablish the initial-access path from the logs before classifying: an attacker who\nauthenticated and then used `COPY PROGRAM` is a different incident from an escaping bug.\n\nEquivalents elsewhere, each with the qualification that makes it true:\n\n- **Redis** - a chain, not a one-liner. `CONFIG SET dir` plus `dbfilename` plus a forced\n  save can write an SSH key or cron entry, but only where filesystem permissions allow and\n  the version\u002Fconfig still permits those protected settings. Modern Redis restricts this.\n- **MongoDB with authentication disabled** - full data read\u002Fwrite; not code execution by\n  itself.\n- **Docker API on 2375** - the worst of the set: it *is* host root, immediately, via a\n  privileged container with the host filesystem mounted.\n- **Elasticsearch** - historical script-execution paths, largely closed in current versions;\n  treat as version-dependent rather than assumed.\n\n**Failure three: an image default widened the surface.** Three layers are involved and\ncollapsing them produces the wrong mental model. Upstream PostgreSQL defaults to\n`listen_addresses='localhost'` (`initdb` initializes a cluster; it does not listen). On\n**first initialization of a data directory**, the official Docker image configures network\nlistening and appends `host all all all \u003Cmethod>` to `pg_hba.conf` - with PostgreSQL 16 and\nno explicit `POSTGRES_HOST_AUTH_METHOD`, that method is normally `scram-sha-256`. Both\nlayers must line up for exposure: listening beyond loopback *and* an HBA rule that\nauthorizes the remote address.\n\nNote this applies to a *new* cluster. Changing the environment later does not rewrite an\nexisting data directory, so an inherited volume keeps whatever it was born with. Verify\nrather than assume:\n\n```sql\nSHOW listen_addresses;  SHOW password_encryption;  SHOW hba_file;\n```\n\nSensible on a private compose network; a loaded gun the moment the port is published. Each\ndefault is defensible alone.\n\n**What limited the damage, and what would not have.** The container had no\n`\u002Fvar\u002Frun\u002Fdocker.sock`, no host bind mounts, no added capabilities, was not privileged, and\nsat alone on the default bridge with no secrets in its environment. Result: stolen CPU\nrather than a compromised host.\n\nThat list is the minimum, not the whole set. Also check each of these - `docker.sock` and\n`--privileged` are host root outright; the rest widen the blast radius and each opens a\nplausible path to one: **host PID or network namespace** (`--pid=host`,\n`--network=host`), **added capabilities** (`CAP_SYS_ADMIN`, `CAP_SYS_PTRACE`,\n`CAP_NET_ADMIN`), **device passthrough** (`--device`), **other runtime sockets**\n(containerd, podman, a kubelet), **sensitive host paths** mounted at all (`\u002F`, `\u002Fetc`,\n`\u002Froot`, `~\u002F.ssh`, cloud credential directories), and a **shared network with a service\nworth pivoting to**. A mounted Docker socket is the most common of these, not the only one.\n\nContainment is what made\nthis survivable; do not treat \"it was only a container\" as reassurance, because code\nexecuted on that kernel, on host CPU, opening outbound connections from the host's address.\n\n**Defense, in priority order:**\n\n1. **Never write a bare `-p`.** Name the interface so private is the default.\n   ```\n   -p 5433:5432                   # every interface, including public\n   -p 127.0.0.1:5433:5432         # loopback only\n   -p 100.64.0.2:5433:5432        # VPN address only\n   ```\n2. **Fill in `DOCKER-USER`** so a forgotten bare `-p` cannot reach the internet, and persist\n   it (`iptables-persistent` or the provisioning scripts) so a rebuild cannot silently drop\n   it.\n\n   ```bash\n   # Match only NEW inbound connections. Replies to container-initiated traffic are\n   # ESTABLISHED, so they never match this rule and keep working - no companion\n   # \"allow established\" rule is needed, and adding one is worse than useless:\n   # ACCEPT is a terminal verdict, so an unscoped ACCEPT in DOCKER-USER would\n   # short-circuit all later FORWARD processing, including non-Docker forwarding.\n   # If you keep such a rule anyway, use RETURN (resume FORWARD), never ACCEPT.\n   iptables -I DOCKER-USER 1 -i \u003Cpublic-if> -m conntrack --ctstate NEW \\\n     ! -s \u003Ctrusted-cidr> -j DROP\n   ```\n\n   **Do not use `iptables -C` as proof this is done.** `-C` searches the whole chain and\n   says nothing about position; a matching rule sitting at position 5 passes the check while\n   traffic is already accepted above it. Order is the whole point of this rule. Assert on\n   numbered output instead, and rebuild the managed block when it has drifted:\n   ```bash\n   iptables -L DOCKER-USER -n --line-numbers\n   ```\n\n   Scope conditions, each of which silently produces a false sense of coverage:\n   - This is the **iptables** backend. Docker's **nftables** backend has no `DOCKER-USER`;\n     you need a forward hook at an earlier priority.\n   - **IPv6 is separate.** Where Docker IPv6 is enabled, an equivalent `ip6tables` policy is\n     required or the rule covers half your attack surface.\n   - Chain **existence is not attachment** - confirm `FORWARD` actually jumps to\n     `DOCKER-USER` (`iptables -S FORWARD`), not merely that the chain exists.\n   - Verify all three outcomes, not just the first: untrusted client blocked, trusted client\n     allowed, **and a container can still make an outbound request and receive the reply.**\n\n   This is defence in depth. Binding to loopback or a private address (1) remains the\n   primary control.\n3. **Set `POSTGRES_HOST_AUTH_METHOD`\u002F`pg_hba.conf` deliberately** rather than inheriting the\n   image default, and never reuse a database password that also exists elsewhere.\n4. **Ask what OS account a datastore's admin role can reach**, and let that decide what may\n   connect to it - not the sensitivity of the data it holds. The compromised database here\n   contained nothing of value.\n5. **Alert on sustained CPU with no corresponding workload.** The one signal that would have\n   caught this in hour one rather than week three.\n\n**Audit script** (run per host, not per repository). Written as one script rather than\nloose one-liners, because the failure mode this section warns about - an empty result\nreading as a clean result - is exactly what unguarded pipelines produce:\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\nset -Eeuo pipefail\n# Every check must distinguish three outcomes: hazard found, verified clean, and\n# NOT CHECKED. Collapsing the last two is the failure this whole section is about.\n\necho \"== 1. containers published to every interface ==\"\nif ! names=$(docker ps --format '{{.Names}}'); then\n  echo \"  NOT CHECKED: docker unavailable\"; exit 1\nfi\nhits=$(docker ps --format '{{.Names}}\\t{{.Ports}}' | grep -E '0\\.0\\.0\\.0|\\[::\\]' || true)\necho \"${hits:-  OK: docker queried, 0 wildcard publications}\"\n\necho \"== 2. is the firewall hook attached, and does it cover v6 ==\"\nsudo iptables -S FORWARD | grep -q DOCKER-USER \\\n  && echo \"  FORWARD -> DOCKER-USER: attached\" \\\n  || echo \"  WARN: FORWARD does not jump to DOCKER-USER - the chain is inert\"\nsudo iptables -L DOCKER-USER -n --line-numbers || echo \"  WARN: no DOCKER-USER (nftables backend?)\"\nsudo ip6tables -L DOCKER-USER -n --line-numbers 2>\u002Fdev\u002Fnull \\\n  || echo \"  NOTE: no IPv6 chain - fine only if Docker IPv6 is off\"\n\necho \"== 3. executables in container \u002Ftmp ==\"\n# All three execute positions, including setuid\u002Fsetgid\u002Fsticky (s\u002Ft). Prints the whole\n# listing on request so an interpreted script with no execute bit is still reviewable.\nfor c in $names; do\n  if out=$(docker exec \"$c\" sh -c 'ls -la \u002Ftmp 2>\u002Fdev\u002Fnull' 2>&1); then\n    printf '%s\\n' \"$out\" | grep -E '^-([r-][w-][xst]|[r-][w-][r-][r-][w-][xst]|[r-][w-][r-][r-][w-][r-][r-][w-][xst])' \\\n      | sed \"s|^|  $c: |\" || true\n  else\n    echo \"  $c: NOT CHECKED ($(printf '%s' \"$out\" | head -1))\"\n  fi\ndone\n\necho \"== 4. CPU that no workload explains ==\"\n# No `| head`: under pipefail a short reader makes the pipeline exit 141 and, with\n# set -e, silently ends the audit on any host with more than ten containers.\nif ! stats=$(docker stats --no-stream --format '{{.CPUPerc}}\\t{{.Name}}'); then\n  echo \"  NOT CHECKED: docker stats failed\"; exit 1\nfi\nprintf '%s\\n' \"$stats\" | sort -rn | head -10 || true\necho \"  Compare each against what that container should be doing. In this incident every\"\necho \"  real postgres worker sat at 0.0% while \u002Ftmp\u002Fpostgresql held 787%.\"\n\necho \"== 5. host listeners (catches what check 1 cannot) ==\"\n# -H drops the header, so 'no matches' is genuinely empty rather than a surviving title row.\nif ! listeners=$(sudo ss -H -lntup); then\n  echo \"  NOT CHECKED: ss failed\"; exit 1\nfi\nprintf '%s\\n' \"$listeners\" | grep -vE '127\\.0\\.0\\.|\\[::1\\]' || echo \"  OK: none beyond loopback\"\n\necho \"== 6. blast-radius multipliers ==\"\n# Per-container, so a failed inspect prints NOT CHECKED instead of vanishing into a\n# pipeline whose `|| echo \"none found\"` would report the host as clean.\nfound=0\nfor c in $names; do\n  if ! insp=$(docker inspect \"$c\" --format \\\n      '{{.Name}} priv={{.HostConfig.Privileged}} caps={{.HostConfig.CapAdd}} pid={{.HostConfig.PidMode}} net={{.HostConfig.NetworkMode}} devs={{len .HostConfig.Devices}} mounts={{range .Mounts}}{{.Source}},{{end}}'); then\n    echo \"  $c: NOT CHECKED (inspect failed)\"; found=1; continue\n  fi\n  printf '%s\\n' \"$insp\" | grep -E 'priv=true|caps=\\[[^]]|pid=host|net=host|devs=[1-9]|docker\\.sock|containerd\\.sock|\u002Fetc,|\u002Froot,|\\.ssh|\u002F,' \\\n    && found=1 || true\ndone\n[ \"$found\" -eq 0 ] && echo \"  OK: all $(printf '%s\\n' \"$names\" | wc -l) containers inspected, no multipliers found\"\necho \"  docker.sock or --privileged is host root outright. Host PID\u002Fnetwork, added\"\necho \"  capabilities, device passthrough and sensitive mounts widen the blast radius and\"\necho \"  each opens a plausible path to one - treat any hit as needing a reason to exist.\"\n```\n\n**On log-grepping for the technique.** This is evidence collection, never proof of absence -\nPostgreSQL does not log successful statements unless `log_statement` is set, so a successful\n`COPY ... PROGRAM` may leave no trace at all:\n\n```bash\n: \"${PG_CONTAINER:?set PG_CONTAINER}\"\ndocker logs \"$PG_CONTAINER\" 2>&1 \\\n  | grep -iE 'COPY .*PROGRAM|WITH SUPERUSER|pg_execute_server_program' \\\n  || echo \"no matches - which means nothing unless log_statement was enabled\"\n```\n\n**A note on verifying a clean result.** During this investigation a role check returned\nempty output and read as \"no attacker accounts present\". The command had in fact failed —\nthat image sets `POSTGRES_USER=sessions`, so `psql -U postgres` errored — and a failed\ncommand and a clean result are indistinguishable when you grep the output. Make each check\nprove it ran: assert on an expected header, a non-empty baseline, or an exit code. This\napplies to every command in this skill.\n\n---\n\n## Audit Workflow\n\n### Step 1: Discover Project Structure\n\n```bash\necho \"=== Workflows ===\"\nls .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull || echo \"No GitHub Actions workflows\"\n\necho \"\"\necho \"=== Lock files (must ALL be committed) ===\"\nfind . -maxdepth 5 \\( \\\n  -name \"package-lock.json\" -o \\\n  -name \"pnpm-lock.yaml\" -o \\\n  -name \"yarn.lock\" -o \\\n  -name \"uv.lock\" -o \\\n  -name \"Cargo.lock\" \\\n\\) -not -path \"*\u002Fnode_modules\u002F*\" -not -path \"*\u002F.git\u002F*\"\n\necho \"\"\necho \"=== Container files ===\"\nfind . -maxdepth 5 -name \"Dockerfile*\" -o -name \"docker-compose*.yml\" \\\n  | grep -v \".git\" | head -20\n```\n\n### Step 2: GitHub Actions SHA Pinning\n\n```bash\necho \"=== Actions with MUTABLE tags (MUST FIX) ===\"\n# Matches @v1, @v2.3, @main, @master, @latest, @stable\ngrep -rn \"uses:.*@\\(v[0-9]\\|\\\u003Cmain\\>\\|\\\u003Cmaster\\>\\|\\\u003Clatest\\>\\|\\\u003Cstable\\>\\)\" \\\n  .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull || echo \"None found ✅\"\n\necho \"\"\necho \"=== Actions with SHA pins (safe) ===\"\ngrep -rn \"uses:.*@[0-9a-f]\\{40\\}\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull | wc -l\necho \" SHA-pinned action lines\"\n```\n\n### Step 3: Workflow Permissions\n\n```bash\necho \"=== Workflows missing top-level permissions (risky) ===\"\nfor f in .github\u002Fworkflows\u002F*.yml .github\u002Fworkflows\u002F*.yaml; do\n  [ -f \"$f\" ] || continue\n  if ! grep -q \"^permissions:\" \"$f\"; then\n    echo \"  ❌ MISSING: $f\"\n  else\n    echo \"  ✅ $f\"\n  fi\ndone\n```\n\n### Step 4: Install Hygiene (Postinstall Hook Blocking)\n\n```bash\necho \"=== npm\u002Fpnpm install commands in CI ===\"\ngrep -rn \"npm install\\b\\|npm ci\\b\\|pnpm install\\b\\|yarn install\\b\" \\\n  .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull\n\necho \"\"\necho \"=== Missing script blocking (flag for review) ===\"\ngrep -rn \"npm ci\\b\\|npm install\\b\\|pnpm install\\b\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull \\\n  | grep -v \"ignore-scripts\\|frozen-lockfile\" \\\n  || echo \"All installs have script\u002Fversion blocking ✅\"\n\necho \"\"\necho \"=== pnpm onlyBuiltDependencies (allowlist approach) ===\"\ngrep -rn \"onlyBuiltDependencies\" . --include=\"package.json\" \\\n  --exclude-dir=node_modules 2>\u002Fdev\u002Fnull || echo \"Not configured\"\n```\n\n### Step 5: Lock File Discipline\n\n```bash\necho \"=== Lock files tracked by git (must be committed) ===\"\ngit ls-files | grep -E \"uv\\.lock|package-lock\\.json|pnpm-lock\\.yaml|yarn\\.lock|Cargo\\.lock\"\n\necho \"\"\necho \"=== Lock files in .gitignore (BAD — should be committed) ===\"\ngrep -E \"uv\\.lock|package-lock|pnpm-lock|yarn\\.lock|Cargo\\.lock\" .gitignore 2>\u002Fdev\u002Fnull \\\n  || echo \"None ignored ✅\"\n\necho \"\"\necho \"=== CI using npm install instead of npm ci ===\"\ngrep -rn \"npm install\\b\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull \\\n  | grep -v \"#\" || echo \"None found ✅\"\n```\n\n### Step 6: Vulnerability \u002F SCA Scanning\n\n```bash\necho \"=== OSV Scanner ===\"\ngrep -rn \"osv-scanner\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull || echo \"❌ NOT CONFIGURED\"\n\necho \"\"\necho \"=== Dependency Review Action ===\"\ngrep -rn \"dependency-review-action\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull || echo \"❌ NOT CONFIGURED\"\n\necho \"\"\necho \"=== Dependabot ===\"\ncat .github\u002Fdependabot.yml 2>\u002Fdev\u002Fnull || echo \"❌ NOT CONFIGURED\"\n```\n\n### Step 6.5: Native Ecosystem Audits\n\nOSV Scanner checks lock files against a vulnerability database, but native ecosystem tools\n(`pip-audit`, `pnpm audit`) cover additional advisories specific to each package registry.\nRun both for defense in depth.\n\n```bash\necho \"=== pip-audit (Python) ===\"\nif command -v pip-audit &>\u002Fdev\u002Fnull; then\n  # Export locked deps, then audit against PyPI advisory DB.\n  # --disable-pip: use the PyPI JSON API directly (faster, no pip subprocess).\n  uv export --format requirements-txt --no-hashes --quiet \\\n    | pip-audit --disable-pip -r \u002Fdev\u002Fstdin 2>&1 \\\n    || echo \"⚠️ pip-audit found issues (see above)\"\nelse\n  echo \"❌ pip-audit not installed. Install: uv tool install pip-audit\"\nfi\n\necho \"\"\necho \"=== pnpm audit (Node.js) ===\"\n# --prod: only audit production dependencies (devDependencies aren't deployed).\n# Run per-app because each has its own lock file and dependency tree.\nfind . -maxdepth 4 \\( -name pnpm-lock.yaml -o -name package-lock.json \\) \\\n  -not -path '*\u002Fnode_modules\u002F*' -print | sort -u | while IFS= read -r lockfile; do\n  dir=\"$(dirname \"$lockfile\")\"\n  echo \"--- $dir ---\"\n  (cd \"$dir\" && pnpm audit --prod 2>&1) || echo \"⚠️ audit issues in $dir\"\ndone\n```\n\n### Step 6.6: Dependency Tree Review\n\nUnderstand what you're actually pulling in. Heavy transitive trees are supply chain risk —\neach package is a trust relationship. The goal is to identify reduction targets.\n\n```bash\necho \"=== Python dependency tree (direct deps + first 2 levels) ===\"\nuv tree --depth 2 2>\u002Fdev\u002Fnull || echo \"Run from project root with uv.lock present\"\n\necho \"\"\necho \"=== Python: total package count ===\"\ngrep -c '^\\[\\[package\\]\\]' uv.lock 2>\u002Fdev\u002Fnull || echo \"No uv.lock found\"\n\necho \"\"\necho \"=== Node.js: total package count per project ===\"\nfind . -maxdepth 4 \\( -name \"pnpm-lock.yaml\" -o -name \"package-lock.json\" \\) \\\n  -not -path '*\u002Fnode_modules\u002F*' -print | sort -u | while IFS= read -r lockfile; do\n  dir=\"$(dirname \"$lockfile\")\"\n  if [ -f \"$dir\u002Fpnpm-lock.yaml\" ]; then\n    count=$(grep -c 'resolution:' \"$dir\u002Fpnpm-lock.yaml\" 2>\u002Fdev\u002Fnull || echo \"?\")\n    echo \"  $dir: ~$count packages\"\n  elif [ -f \"$dir\u002Fpackage-lock.json\" ]; then\n    count=$(grep -c '\"resolved\":' \"$dir\u002Fpackage-lock.json\" 2>\u002Fdev\u002Fnull || echo \"?\")\n    echo \"  $dir: ~$count packages\"\n  fi\ndone\n\necho \"\"\necho \"=== Heaviest transitive dependency chains (investigate these) ===\"\necho \"Use 'pnpm why \u003Cpackage>' to trace why a package is in your tree.\"\necho \"Use 'uv tree --invert \u003Cpackage>' to trace Python reverse dependencies.\"\n```\n\n### Step 7: SAST — Static Security Analysis\n\n```bash\necho \"=== CodeQL ===\"\ngrep -rn \"codeql\\|github\u002Fcodeql-action\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull \\\n  || echo \"❌ NOT CONFIGURED\"\n\necho \"\"\necho \"=== Semgrep ===\"\ngrep -rn \"semgrep\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull || echo \"Not configured\"\n\necho \"\"\necho \"=== Bandit (Python SAST) ===\"\ngrep -rn \"bandit\" .github\u002Fworkflows\u002F pyproject.toml 2>\u002Fdev\u002Fnull || echo \"Not configured\"\n\necho \"\"\necho \"=== ESLint security plugin (JS\u002FTS) ===\"\ngrep -rn \"plugin:security\\|eslint-plugin-security\" . \\\n  --include=\".eslintrc*\" --include=\"package.json\" \\\n  --exclude-dir=node_modules 2>\u002Fdev\u002Fnull || echo \"Not configured\"\n```\n\n### Step 8: Container Scanning\n\n```bash\necho \"=== Dockerfile count ===\"\nfind . -name \"Dockerfile*\" -not -path \"*\u002F.git\u002F*\" | wc -l\n\necho \"\"\necho \"=== Docker Scout (container scanning) ===\"\ngrep -rn \"docker-scout\\|docker\u002Fscout-action\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull \\\n  || echo \"Not configured\"\n```\n\n### Step 9: Secret Scanning\n\n```bash\necho \"=== Pre-commit config ===\"\ncat .pre-commit-config.yaml 2>\u002Fdev\u002Fnull || echo \"No .pre-commit-config.yaml\"\n\necho \"\"\necho \"=== gitleaks in CI ===\"\ngrep -rn \"gitleaks\\|zricethezav\u002Fgitleaks\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull \\\n  || echo \"Not configured in CI\"\n\necho \"\"\necho \"=== GitHub secret scanning ===\"\n# Cannot check programmatically — requires repo Settings > Security > Secret scanning\necho \"Check: Settings > Security > Secret scanning > Enable\"\n\necho \"\"\necho \"=== Potential hardcoded secrets (heuristic) ===\"\ngrep -rn \\\n  -e \"api_key\\s*=\\s*['\\\"][^'\\\"]\\{10,\\}\" \\\n  -e \"secret\\s*=\\s*['\\\"][^'\\\"]\\{10,\\}\" \\\n  -e \"password\\s*=\\s*['\\\"][^'\\\"]\\{8,\\}\" \\\n  -e \"token\\s*=\\s*['\\\"][^'\\\"]\\{10,\\}\" \\\n  --include=\"*.py\" --include=\"*.ts\" --include=\"*.js\" --include=\"*.yml\" --include=\"*.yaml\" \\\n  --exclude-dir=\".git\" --exclude-dir=\"node_modules\" --exclude-dir=\".venv\" \\\n  . 2>\u002Fdev\u002Fnull \\\n  | grep -v \"example\\|placeholder\\|your_\\|\u003C\\|env\\.\\|os\\.\\|process\\.env\\|getenv\\|secret_key\\s*=\" \\\n  || echo \"No obvious hardcoded secrets ✅\"\n\necho \"\"\necho \"=== .env files accidentally tracked ===\"\ngit ls-files | grep -E \"^\\.env$|^\\.env\\.\" | grep -v \".example\" \\\n  || echo \"None tracked ✅\"\n```\n\n### Step 10: .gitignore Credential Patterns\n\n```bash\necho \"=== Credential patterns in .gitignore ===\"\nfor pattern in \"*.pem\" \"*.key\" \"*.p12\" \"id_rsa\" \"id_ed25519\" \"*.cer\" \"*.crt\" \".env\"; do\n  if grep -q \"$pattern\" .gitignore 2>\u002Fdev\u002Fnull; then\n    echo \"  ✅ $pattern\"\n  else\n    echo \"  ❌ MISSING: $pattern\"\n  fi\ndone\n```\n\n### Step 11: CODEOWNERS\n\n```bash\necho \"=== CODEOWNERS protection of high-risk paths ===\"\nfor path in \".github\u002F\" \"docker\u002F\" \"infra\u002F\" \".gitmodules\"; do\n  if grep -q \"$path\" .github\u002FCODEOWNERS 2>\u002Fdev\u002Fnull; then\n    echo \"  ✅ $path\"\n  else\n    echo \"  ❌ NOT PROTECTED: $path\"\n  fi\ndone\n```\n\n---\n\n### Step 12: Runtime Exposure (per HOST, not per repo)\n\nEvery step above reads the repository. This one cannot be answered from a repository at all\n— the exposure exists on a machine, and a clean repo audit is compatible with a fully\ncompromised host. Run the audit script in **Area 11** against each host that runs\ncontainers, and treat any of these as a finding:\n\n- a container published to `0.0.0.0` \u002F `[::]` on a host with a public address\n- `FORWARD` not jumping to `DOCKER-USER`, or `DOCKER-USER` empty\n- an executable under a container's `\u002Ftmp`\n- sustained CPU with no workload that accounts for it\n- `docker.sock`, `--privileged`, host PID\u002Fnetwork, or a sensitive host path on any container\n\n## Fix Recipes\n\nOnly apply when MODE is \"fix\" or \"both\". Walk through each finding with the user.\n\n### Fix: Pin an Action to SHA\n\n```bash\n# Resolve SHA for a tag:\ngh api repos\u002Factions\u002Fcheckout\u002Fgit\u002Fref\u002Ftags\u002Fv4 --jq '.object.sha'\n# If the result is a tag object (annotated), dereference one more time:\ngh api repos\u002Factions\u002Fcheckout\u002Fgit\u002Ftags\u002F\u003Csha-from-above> --jq '.object.sha'\n```\n\nReplace in workflow:\n```yaml\n# Before\n- uses: actions\u002Fcheckout@v4\n\n# After — SHA pinned, version visible in comment\n- uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4\n```\n\n### Fix: Add Workflow Permissions\n\nAdd before `jobs:` in each workflow:\n```yaml\n# Least-privilege default — limits blast radius if a step is compromised.\n# Jobs needing write access declare it explicitly at the job level.\npermissions:\n  contents: read\n```\n\n### Fix: Add --ignore-scripts\n\n```yaml\n# npm — blocks postinstall hooks (event-stream\u002Fua-parser-js attack vector)\n- run: npm ci --ignore-scripts\n\n# pnpm — blanket approach\n- run: pnpm install --ignore-scripts\n\n# pnpm — allowlist approach (preferred when native deps like esbuild need build steps)\n# Add to package.json:\n# \"pnpm\": { \"onlyBuiltDependencies\": [\"esbuild\", \"sharp\"] }\n```\n\n### Fix: Switch npm install → npm ci\n\n```yaml\n# npm ci enforces exact lock file versions — fails if package-lock.json is stale.\n# npm install re-resolves, can silently pick up new (possibly malicious) versions.\n- run: npm ci --ignore-scripts\n```\n\n### Fix: Add uv --frozen\n\n```yaml\n# --frozen fails if uv.lock is out of sync with pyproject.toml.\n# Ensures CI always installs exactly what's in the lock file.\n- run: uv sync --all-extras --frozen\n```\n\n### Fix: SHA-Pin a GitHub Action (Worked Example)\n\nMutable tags (`@v4`) can be silently moved to a malicious commit — the diff in *your* repo\nis invisible. SHA-pinning makes every update an explicit, reviewable change.\n\n```bash\n# Step 1: Resolve the commit SHA for the tag you want to pin.\n# This queries GitHub's git refs API — no clone needed.\ngh api repos\u002Factions\u002Fcheckout\u002Fgit\u002Fref\u002Ftags\u002Fv4 --jq '.object.sha'\n# → e.g. 11bd71901bbe5b1630ceea73d27597364c9af683\n\n# Step 2: If the tag is annotated (most are), the above returns a tag object SHA,\n# not a commit SHA. Dereference it to get the actual commit:\ngh api repos\u002Factions\u002Fcheckout\u002Fgit\u002Ftags\u002F11bd71901bbe5b1630ceea73d27597364c9af683 \\\n  --jq '.object.sha'\n# → the real commit SHA\n\n# Step 3: Replace in your workflow file:\n```\n\n```yaml\n# BEFORE — mutable tag. A compromised maintainer can silently repoint this\n# to a malicious commit. Your CI runs attacker code with access to secrets.\n- uses: actions\u002Fcheckout@v4\n\n# AFTER — immutable SHA. The version comment is for humans; CI uses the SHA.\n# To update: repeat steps 1-2 above, get new SHA, update this line.\n# The diff in your PR is the proof that the update was intentional.\n- uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4\n```\n\n### Fix: Add pip-audit to CI\n\n```yaml\n  # pip-audit: checks Python dependencies against the PyPI advisory database.\n  # Complements OSV Scanner — pip-audit catches PyPI-specific advisories that\n  # OSV may not yet index, and verifies package hashes for tamper detection.\n  pip-audit:\n    name: Python Dependency Audit\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read  # Least-privilege — only needs to read the repo\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n\n      # Install uv first — we need it to export the locked dependency list.\n      - uses: astral-sh\u002Fsetup-uv@\u003CSHA> # vX\n        with:\n          version: \"latest\"\n\n      # pip-audit is a standalone tool, not a project dependency.\n      # uv tool install puts it in an isolated environment — it can't\n      # be poisoned by the project's own dependency tree.\n      - name: Install pip-audit\n        run: uv tool install pip-audit\n\n      # Export locked deps from uv.lock → requirements.txt format.\n      # --no-hashes: pip-audit doesn't need hashes for advisory lookups.\n      # --frozen ensures we export exactly what's locked, not a fresh resolve.\n      - name: Audit Python dependencies\n        run: |\n          uv export --format requirements-txt --no-hashes --frozen --quiet \\\n            | pip-audit --disable-pip -r \u002Fdev\u002Fstdin\n        # --disable-pip: queries PyPI JSON API directly instead of shelling\n        #   out to pip. Faster and avoids pip's own dependency resolution.\n        continue-on-error: true  # TODO(#N): remove after first clean baseline\n```\n\n### Fix: Add pnpm audit to CI\n\n```yaml\n  # pnpm audit: checks Node.js dependencies against the npm advisory database.\n  # Runs per-project because each app has its own lock file and dependency tree.\n  npm-audit:\n    name: Node.js Dependency Audit\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n\n      - uses: pnpm\u002Faction-setup@\u003CSHA> # vX\n        with:\n          version: 9\n\n      - uses: actions\u002Fsetup-node@\u003CSHA> # vX\n        with:\n          node-version: \"22\"\n\n      # --prod: only audit production dependencies. devDependencies run in CI\n      # and local dev but never in production — their risk profile is different.\n      # --audit-level moderate: fail on moderate+ severity (skip low\u002Finfo noise).\n      - name: Audit frontend dependencies\n        run: |\n          find . -maxdepth 4 \\( -name pnpm-lock.yaml -o -name package-lock.json \\) \\\n            -not -path '*\u002Fnode_modules\u002F*' -print | sort -u | while IFS= read -r lockfile; do\n            dir=\"$(dirname \"$lockfile\")\"\n            echo \"=== Auditing $dir ===\"\n            (cd \"$dir\" && pnpm audit --prod --audit-level moderate)\n          done\n        continue-on-error: true  # TODO(#N): remove after first clean baseline\n```\n\n### Fix: Enable Hash Verification for Python Dependencies\n\nVersion pinning alone isn't sufficient — if an attacker compromises PyPI and replaces\nthe artifact for an already-pinned version, the version number matches but the content\nis malicious. Hash verification catches this.\n\n```bash\n# Export locked dependencies WITH content hashes:\nuv export --format requirements-txt --hashes --frozen > requirements-hashed.txt\n\n# The output includes lines like:\n#   pydantic==2.12.5 \\\n#     --hash=sha256:abc123... \\\n#     --hash=sha256:def456...\n# Each hash is the SHA-256 of the wheel\u002Fsdist. If PyPI serves a different\n# artifact (tampered or replaced), the hash won't match and install fails.\n\n# Install with hash verification:\nuv pip install --require-hashes -r requirements-hashed.txt\n# --require-hashes: EVERY package must have a hash. If any package is missing\n# a hash entry, the install fails — no silent fallback to unhashed installs.\n```\n\nFor Dockerfiles:\n```dockerfile\n# Generate hashed requirements at build time from the committed lock file.\n# This ensures the Docker build installs exactly what was reviewed and locked,\n# with cryptographic proof that no artifact was tampered with in transit.\nRUN uv export --format requirements-txt --hashes --frozen > \u002Ftmp\u002Frequirements.txt \\\n    && uv pip install --require-hashes -r \u002Ftmp\u002Frequirements.txt \\\n    && rm \u002Ftmp\u002Frequirements.txt\n```\n\n### Fix: Add OSV Scanner\n\n```yaml\n  osv-scan:\n    name: OSV Vulnerability Scan\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n      # OSV checks all lock files against the OSV database (PyPI, npm, crates.io, Go, Maven).\n      # continue-on-error during rollout — remove after first clean baseline. See TODO(#N).\n      - uses: google\u002Fosv-scanner-action\u002Fosv-scanner-action@\u003CSHA> # vX\n        continue-on-error: true  # TODO(#N): flip to false after clean baseline\n        with:\n          scan-args: |-\n            --lockfile=uv.lock\n            --lockfile=package-lock.json\n```\n\n### Fix: Add CodeQL SAST\n\n```yaml\n  codeql:\n    name: CodeQL SAST\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      security-events: write  # Required to upload SARIF results\n    strategy:\n      matrix:\n        language: [python, javascript-typescript]\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n      # CodeQL: GitHub-native SAST, free for public repos.\n      # Finds SQL injection, XSS, path traversal, insecure deserialization, etc.\n      - uses: github\u002Fcodeql-action\u002Finit@\u003CSHA> # vX\n        with:\n          languages: ${{ matrix.language }}\n          queries: security-extended\n      - uses: github\u002Fcodeql-action\u002Fautobuild@\u003CSHA> # vX\n      - uses: github\u002Fcodeql-action\u002Fanalyze@\u003CSHA> # vX\n```\n\n\n### Fix: Add Docker Scout Container Scanning\n\n```yaml\n  docker-scout:\n    name: Docker Scout\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      security-events: write\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n      - name: Build image\n        run: docker build -t scan-target:${{ github.sha }} .\n      # Docker Scout: maintained by Docker — same trust chain as the runtime itself.\n      # Preferred over third-party scanners (e.g. Trivy) precisely because it doesn't\n      # add a new security-critical dependency outside the Docker ecosystem.\n      - uses: docker\u002Fscout-action@\u003CSHA> # vX\n        with:\n          command: cves\n          image: scan-target:${{ github.sha }}\n          sarif-file: scout-results.sarif\n          only-severities: critical,high\n      - uses: github\u002Fcodeql-action\u002Fupload-sarif@\u003CSHA> # vX\n        with:\n          sarif_file: scout-results.sarif\n```\n\n### Fix: Add gitleaks Secret Scanning\n\n```yaml\n  secret-scan:\n    name: Secret Scan\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n        with:\n          fetch-depth: 0  # Full history — scan all commits, not just HEAD\n      # gitleaks: scans git history for secrets (API keys, tokens, private keys).\n      # Catches accidental commits that slipped past pre-commit hooks.\n      - uses: gitleaks\u002Fgitleaks-action@\u003CSHA> # vX\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Fix: Add Pre-commit Secret Gate (gitleaks)\n\n`.pre-commit-config.yaml`:\n```yaml\nrepos:\n  - repo: https:\u002F\u002Fgithub.com\u002Fgitleaks\u002Fgitleaks\n    rev: v8.x.x  # Pin to SHA in practice\n    hooks:\n      - id: gitleaks\n        # Scans staged files for secrets before commit reaches git history.\n        # Much cheaper than incident response after accidental push.\n```\n\n### Fix: Harden .gitignore\n\n```gitignore\n# Private keys and certificates — passive safety net against accidental commits\n*.pem\n*.key\n*.p12\n*.pfx\n*.cer\n*.crt\nid_rsa\nid_rsa.pub\nid_ed25519\nid_ed25519.pub\n*.keystore\n\n# Environment files (use .env.example for documentation)\n.env\n.env.local\n.env.*.local\n```\n\n### Fix: Add CODEOWNERS\n\n`.github\u002FCODEOWNERS`:\n```\n# CI\u002FCD workflows — arbitrary code execution risk. Any change here can exfiltrate\n# secrets or backdoor the pipeline. Require maintainer review.\n.github\u002F                     @\u003Cteam>\n\n# Container and infrastructure config — supply chain risk\ndocker\u002F                      @\u003Cteam>\ninfra\u002F                       @\u003Cteam>\n\n# Shared credentials config and typed env constants — blast radius: all services\npackages\u002Fsyn-shared\u002F         @\u003Cteam>\n\n# Submodule pin changes must be intentional — a silently advanced submodule\n# is a supply chain attack vector analogous to tag repointing\n.gitmodules                  @\u003Cteam>\n```\n\n---\n\n## Audit Report Template\n\n```markdown\n# Security Audit — \u003Crepo>\n\n**Date:** \u003Cdate>\n**Auditor:** \u003Cname or \"automated\">\n\n---\n\n## Summary\n\n| Control | Status | Priority |\n|---------|--------|----------|\n| Actions SHA-pinned | ✅\u002F❌ | P0 |\n| Workflow least-privilege permissions | ✅\u002F❌ | P0 |\n| npm\u002Fpnpm --ignore-scripts | ✅\u002F❌ | P1 |\n| npm ci (not npm install) | ✅\u002F❌ | P1 |\n| uv sync --frozen | ✅\u002F❌ | P1 |\n| OSV Scanner configured | ✅\u002F❌ | P1 |\n| dependency-review-action | ✅\u002F❌ | P1 |\n| CodeQL SAST | ✅\u002F❌ | P1 |\n| pip-audit (Python advisory DB) | ✅\u002F❌ | P1 |\n| pnpm audit (npm advisory DB) | ✅\u002F❌ | P1 |\n| Hash verification (uv --hashes) | ✅\u002F❌ | P1 |\n| Dependency tree reviewed | ✅\u002F❌ | P1 |\n| Container scanning (Docker Scout) | ✅\u002F❌ | P2 |\n| Secret scanning (gitleaks) | ✅\u002F❌ | P1 |\n| Pre-commit secret gate | ✅\u002F❌ | P2 |\n| .gitignore credential patterns | ✅\u002F❌ | P2 |\n| CODEOWNERS for high-risk paths | ✅\u002F❌ | P2 |\n| SECURITY.md present | ✅\u002F❌ | P2 |\n| Dependabot configured | ✅\u002F❌ | P2 |\n\n---\n\n## Runtime Exposure (per host — see Area 11)\n\n| Host | Wildcard publications | DOCKER-USER attached (v4\u002Fv6) | Container \u002Ftmp | Unexplained CPU | Blast-radius multipliers |\n|------|----------------------|------------------------------|----------------|-----------------|--------------------------|\n| \u003Chost> | \u003Ccount \u002F NOT CHECKED> | \u003Cyes-yes \u002F yes-no \u002F NOT CHECKED> | \u003Cclean \u002F N hits \u002F NOT CHECKED> | \u003Cnone \u002F list> | \u003Cdocker.sock, privileged, host-ns, caps, devices, mounts, none> |\n\n## Critical Findings (P0 — Fix before next push)\n\n### [Finding title]\n- **Location:** `path\u002Fto\u002Ffile:line`\n- **Issue:** \u003Cdescription>\n- **Fix:** \u003Cexact change>\n\n---\n\n## High Findings (P1 — Fix this sprint)\n...\n\n## Medium Findings (P2 — Backlog)\n...\n\n---\n\n## Applied Fixes\n- [ ] SHA-pin all Actions\n- [ ] Add permissions: contents: read to all workflows\n- [ ] Add --ignore-scripts to CI installs\n- [ ] Switch npm install → npm ci\n- [ ] Add uv sync --frozen\n- [ ] Add OSV Scanner\n- [ ] Add CodeQL\n- [ ] Add Docker Scout (if containers present)\n- [ ] Add pip-audit to CI\n- [ ] Add pnpm audit to CI\n- [ ] Enable hash verification in Dockerfiles\n- [ ] Review dependency tree — identify reduction targets\n- [ ] Add gitleaks\n- [ ] Harden .gitignore\n- [ ] Add\u002Fupdate CODEOWNERS\n- [ ] Create SECURITY.md\n\n---\n\n## Remaining (Post-launch or Planned)\n- [ ] Dependabot for Actions + npm\n- [ ] OSV Scanner flip to blocking (after clean baseline)\n- [ ] Pre-commit hook with gitleaks\n- [ ] Sigstore\u002Fcosign artifact signing\n- [ ] OpenSSF Scorecard integration\n- [ ] SBOM generation (syft\u002Fcyclonedx)\n```\n\n---\n\n## Reference: Attack Taxonomy\n\n| Attack | Vector | Year | Defense |\n|--------|--------|------|---------|\n| XZ-utils backdoor | GitHub Actions mutable tag | 2024 | SHA pin Actions |\n| event-stream | npm postinstall hook | 2018 | --ignore-scripts |\n| ua-parser-js | npm postinstall hook | 2021 | --ignore-scripts |\n| Log4Shell | Vulnerable dependency | 2021 | OSV Scanner + Dependabot |\n| Codecov breach | CI script injection | 2021 | CODEOWNERS + permissions |\n| SolarWinds | Build pipeline compromise | 2020 | Sigstore, SLSA |\n| tj-actions\u002Fchanged-files | Tag repointing | 2025 | SHA pin Actions |\n| litellm 1.82.8 | PyPI .pth file injection | 2026 | pip-audit, hash verification, dep minimization |\n| Shai-Halud | AI\u002FML package credential theft | 2025 | pip-audit, hash verification, dep minimization |\n| Exposed Postgres cryptojack | Published port + `COPY FROM PROGRAM` | 2026 | Bind to an interface, fill `DOCKER-USER`, set `pg_hba` |\n\n## Reference: Tools\n\n| Tool | Category | Cost | Docs |\n|------|----------|------|------|\n| OSV Scanner | SCA | Free | https:\u002F\u002Fgoogle.github.io\u002Fosv-scanner |\n| CodeQL | SAST | Free (public) | https:\u002F\u002Fcodeql.github.com |\n| Semgrep | SAST | Free (OSS) | https:\u002F\u002Fsemgrep.dev |\n| Docker Scout | Container | Free tier | https:\u002F\u002Fdocs.docker.com\u002Fscout |\n| gitleaks | Secrets | Free | https:\u002F\u002Fgitleaks.io |\n| Dependabot | SCA | Free | GitHub native |\n| OpenSSF Scorecard | Posture | Free | https:\u002F\u002Fsecurityscorecards.dev |\n| SLSA | Build provenance | Free | https:\u002F\u002Fslsa.dev |\n| pip-audit | Python SCA | Free | https:\u002F\u002Fgithub.com\u002Fpypa\u002Fpip-audit |\n| pnpm audit | Node SCA | Free | Built into pnpm |\n| deptry | Python unused deps | Free | https:\u002F\u002Fgithub.com\u002Ffpgmaas\u002Fdeptry |\n| depcheck | Node unused deps | Free | https:\u002F\u002Fgithub.com\u002Fnicedoc\u002Fdepcheck |\n","# Security Hardening\n\nAudit a codebase for security vulnerabilities and implement fixes. Three modes:\n\n- **audit** — read-only scan, produces a prioritized findings report\n- **fix** — implements the fixes (confirm with user before each change)\n- **both** (default) — audit first, then fix\n\n## Variables\n\nMODE: $1 || \"both\"\n\n---\n\n## Threat Model\n\nThis skill covers eleven attack surface areas. Each has a concrete historical incident:\n\n### 1. Supply Chain — Tag Repointing (XZ-utils, 2024)\n\nA GitHub Actions workflow step runs inside CI with access to repository secrets and write\npermissions. If a third-party Action is pinned to a mutable version tag (`@v4`), a\ncompromised maintainer can silently move that tag to an attacker-controlled commit — every\nrepo using the tag now executes malicious code on the next push with no diff in that repo.\n\nThe XZ-utils backdoor (CVE-2024-3094) demonstrated exactly this social engineering + supply\nchain path: a patient attacker gained maintainer trust over years, then inserted a backdoor.\n\n**Defense:** Every `uses:` line pins to an **immutable commit SHA** with the version as an\ninline comment for human readability. Any update requires an explicit SHA change — producing\na reviewable diff.\n\n```yaml\n# SAFE — SHA cannot be repointed; update is a visible diff\n- uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4\n\n# UNSAFE — tag can be silently moved to a malicious commit overnight\n- uses: actions\u002Fcheckout@v4\n```\n\nTo update: `gh api repos\u002Factions\u002Fcheckout\u002Fgit\u002Fref\u002Ftags\u002Fv4 --jq '.object.sha'`\n(If the tag is annotated, dereference: `gh api repos\u002F\u003Cowner>\u002F\u003Crepo>\u002Fgit\u002Ftags\u002F\u003Csha> --jq '.object.sha'`)\n\n### 2. Supply Chain — Postinstall Hook Injection (event-stream 2018, ua-parser-js 2021)\n\n`npm install` and `pnpm install` execute `preinstall`\u002F`postinstall` scripts from every\npackage in the dependency tree by default — including transitive dependencies you never\nexplicitly chose. An attacker who compromises or publishes a malicious version of any\npackage in your tree can run arbitrary code in CI (with access to secrets) during install.\n\nThe event-stream incident: a trusted npm package was transferred to a malicious actor who\nadded a dependency that exfiltrated cryptocurrency wallet credentials via postinstall.\n\n**Two defenses — choose based on the project:**\n\n```yaml\n# OPTION A: Blanket block — safe for pure JS build tools that don't need native binaries\n- run: npm ci --ignore-scripts\n  # ^ Blocks ALL postinstall\u002Fpreinstall hooks. Works for most dashboard\u002Fdocs builds.\n  #   Vite 7.x sources esbuild via optional platform packages, not postinstall,\n  #   so this is safe for Vite projects.\n\n# OPTION B: Allowlist (preferred for pnpm projects with native deps like esbuild\u002Fsharp)\n# In package.json:\n# \"pnpm\": { \"onlyBuiltDependencies\": [\"esbuild\", \"sharp\", \"@img\u002Fsharp-linux-x64\"] }\n# Then: pnpm install (no flag needed — allowlist enforces it)\n#\n# Why prefer allowlist over --ignore-scripts when native deps exist:\n# --ignore-scripts breaks packages that legitimately need a build step (native addons,\n# platform-specific binaries). The allowlist is explicit, code-reviewed, and auditable —\n# you can see exactly which packages are allowed to run install scripts and why.\n```\n\n### 3. Dependency Vulnerabilities — Known CVEs (Log4Shell 2021, requests CVE-2023-32681)\n\nDependencies drift out of date and accumulate published CVEs. Without automated scanning,\nteams only discover vulnerabilities reactively — after exploitation or incident disclosure.\n\n**Defense:** Automated SCA (Software Composition Analysis) on every push and PR:\n\n- **OSV Scanner** — checks all lock files against the OSV database (covers PyPI, npm,\n  crates.io, Go, Maven). Single tool, multiple ecosystems.\n- **dependency-review-action** — GitHub-native, blocks PRs that introduce newly vulnerable\n  packages. Requires GitHub Advanced Security (free for public repos).\n- **Dependabot** — automated PRs for outdated\u002Fvulnerable dependencies.\n\n### 4. Excessive CI Permissions (blast radius amplification)\n\nBy default, GitHub Actions runs with `write-all` permissions — a compromised or buggy step\ncan push to branches, create releases, modify packages, or read\u002Fwrite Actions secrets.\nLeast-privilege defaults contain the blast radius of any single compromised step.\n\n**Defense:** Top-level `permissions: contents: read` in every workflow. Jobs that need\nwrite access declare it explicitly at the job level, creating a clear audit trail.\n\n```yaml\n# At top of workflow file — least-privilege default\npermissions:\n  contents: read\n\njobs:\n  release:\n    # Only this job needs write — visible, reviewable, scoped\n    permissions:\n      contents: write\n      packages: write\n```\n\n### 5. Credential Exposure (Codecov breach 2021, dozens of accidental git commits)\n\nSecrets committed to git are permanently exposed — even if deleted in a follow-up commit,\nthey exist in git history, forks, CI logs, and any clone made during the exposure window.\n\n**Defenses (layered):**\n- `.gitignore` patterns for key\u002Fcert extensions (passive safety net)\n- Pre-commit secret scanning — `gitleaks` or `detect-secrets` blocks the commit before\n  it ever reaches git history (active gate)\n- GitHub secret scanning — catches exposed secrets in pushes even without pre-commit hook\n- CODEOWNERS restricting who can modify high-risk paths\n\n### 6. Static Application Security Testing — Code Vulnerabilities\n\nSQL injection, XSS, insecure deserialization, path traversal, hardcoded credentials in\nsource code — these require SAST tooling to catch systematically.\n\n**Defense:**\n\n- **CodeQL** — GitHub-native, free for public repos. Covers Python, JavaScript\u002FTypeScript,\n  Java, Go, C\u002FC++, C#, Ruby, Swift. Runs as a workflow job.\n- **Semgrep** — OSS rules engine with security-focused rulesets. Faster than CodeQL,\n  easier to add custom rules.\n- **Bandit** — Python-specific SAST. Fast, no config needed.\n- **ESLint `plugin:security`** — JavaScript\u002FTypeScript security rules.\n\n### 7. Container Vulnerabilities — Image CVEs\n\nDocker images accumulate OS-level CVEs in base image packages over time. OSV Scanner\ncovers app-layer dependencies (Python, npm, etc.) in lock files. For OS-layer CVEs,\nuse **Docker Scout**.\n\n**Why Docker Scout over alternatives:** You already trust Docker for the container runtime —\nScout extends that existing trust rather than introducing a new third-party security\ndependency. Trivy (aquasecurity) is commonly cited but aquasecurity has had multiple\nsecurity incidents; a compromised scanner is a supply chain risk that undermines the\nwhole point. Scout is maintained by the same team that ships the runtime, keeping the\ntrust chain short.\n\n### 8. Version Pinning — Lock File Discipline\n\n`npm install` (not `ci`) or `pip install` (not from lock file) resolve \"latest compatible\"\nversions, meaning a build on Tuesday may install a different dep than Monday's build —\nsilently picking up a newly published malicious or broken version.\n\n**Defenses:**\n- Always commit lock files (`uv.lock`, `package-lock.json`, `pnpm-lock.yaml`, `Cargo.lock`)\n- Use `npm ci` (not `npm install`) — enforces exact lock file versions, fails on mismatch\n- Use `pnpm install --frozen-lockfile` in CI\n- Use `uv sync --frozen` in CI — fails if `uv.lock` is out of sync with `pyproject.toml`\n- Pin Python version explicitly: `python-version: \"3.12\"` not `\"3.x\"` in CI\n\n```yaml\n# SAFE — exact versions from lock file, fails if lock file is stale\n- run: npm ci --ignore-scripts\n\n# UNSAFE — resolves fresh, may pick up new malicious version\n- run: npm install\n```\n\n### 9. Transitive Dependency Poisoning (litellm 2026, Shai-Halud 2025)\n\nAn attacker gains access to a package maintainer's credentials — via phishing, token theft,\nor account takeover — and publishes a malicious version of a package. The payload doesn't\nneed to be in a package you directly depend on. It can be buried anywhere in the transitive\ndependency tree: if package A depends on B which depends on C, and C is poisoned, everyone\nwho installs A is compromised.\n\nThe attack vectors evolve faster than defenses:\n- **Python `.pth` files** (litellm 1.82.8, 2026): A `.pth` file in `site-packages` executes\n  arbitrary Python on interpreter startup — before your code even imports anything. This\n  bypasses `--ignore-scripts` because it's not an install hook, it's a Python runtime feature.\n  The litellm attack base64-encoded instructions to exfiltrate SSH keys, cloud credentials,\n  Kubernetes configs, shell history, and crypto wallets to a remote server.\n- **`__init__.py` injection**: Malicious code added to a package's `__init__.py` runs on\n  first import. No install hooks needed.\n- **npm postinstall** (event-stream 2018, ua-parser-js 2021): Covered in threat model #2,\n  but the credential theft pattern is identical.\n- **Shai-Halud** (2025): Supply chain attack targeting AI\u002FML ecosystem packages with\n  credential exfiltration payloads.\n\nThe contagion is the real danger: litellm has 97M downloads\u002Fmonth, but the blast radius\nextends to every project that depends on litellm (e.g., `pip install dspy` also pulled in\nthe poisoned version). One compromised package deep in a dependency tree can affect thousands\nof downstream projects.\n\n**Defenses (layered):**\n- **Hash verification**: Pin not just versions but content hashes. Even if an attacker\n  publishes a new artifact for the same version, the hash won't match.\n- **Native ecosystem audits**: `pip-audit` and `pnpm audit` check for known-compromised\n  versions beyond what OSV Scanner covers.\n- **Dependency minimization**: The only dependency that can't be poisoned is one you don't\n  have. Fewer dependencies = smaller attack surface. See threat model #10.\n- **Vendoring critical deps**: For small, critical packages, copy the source into your repo.\n  You now control the code and review changes via normal PR review.\n- **Lock file discipline**: Covered in threat model #8 — ensures reproducible installs.\n\n### 10. Dependency Sprawl — Attack Surface Proportional to Dependency Count\n\nEvery dependency is a trust relationship. Every *transitive* dependency is a trust\nrelationship you didn't explicitly agree to. A project with 500 npm packages has 500\npotential supply chain entry points — and you've probably reviewed zero of the transitive\nones.\n\nThe goal is to **minimize dependencies toward zero**. This isn't about reinventing wheels —\nit's about recognizing that each dependency carries ongoing risk that compounds over time:\n- Maintainer accounts can be compromised\n- Projects can be transferred to malicious actors\n- Abandoned packages accumulate unpatched CVEs\n- Deep dependency trees create blast radius you can't predict\n\n**Strategies:**\n- **Prefer stdlib**: Python's standard library and Node's built-in modules cover more than\n  most developers realize. `urllib`, `json`, `pathlib`, `subprocess`, `http.server`, etc.\n- **Yoink simple functionality**: When a dependency provides a small, well-understood function,\n  use an LLM to rewrite it locally. A 50-line utility you own is safer than a package with\n  200 transitive dependencies.\n- **Regular dependency audits**: `uv tree --depth 3` and `pnpm why \u003Cpackage>` to understand\n  what you're actually pulling in and whether each dependency earns its place.\n- **Remove unused deps**: Dependencies accumulate. Periodically run `deptry` (Python) or\n  `depcheck` (Node) to find packages that are imported nowhere.\n- **Consolidate overlapping deps**: If two packages serve similar purposes (e.g., `recharts`\n  and `@nivo\u002F*` for charts), pick one and remove the other.\n- **Question heavy transitive trees**: A package with 3 direct deps that pulls in 150\n  transitive deps is a red flag. Look for lighter alternatives or vendor the functionality.\n\n\n### 11. Runtime Exposure — Published Ports Bypass the Host Firewall (observed incident, 2026)\n\nEvery area above concerns code *entering* the system. This one concerns a service already\nrunning and reachable — the surface an audit of the repository never sees, because nothing\nin the repository is wrong.\n\n**The observed incident.** A `postgres:16` container was started by hand on a public VPS\nwith `-p 5433:5432`, to hold throwaway test fixtures. Timeline from its own logs:\n\n```\n02:20:09  container starts\n02:51:37  first connection from the internet matches pg_hba \"host all all all\"\n02:55:50  remote code execution\n12:00     XMRig-derived Monero miner running as \u002Ftmp\u002Fsystemd\n```\n\nThirty-five minutes from start to compromise. It then consumed ~8 of 16 cores for 21 days\nbefore anyone noticed, and it was noticed only because someone asked why the machine was\nslow.\n\n**Failure one: the firewall was enabled and did nothing.** `ufw` reported default-deny\nincoming with only SSH and Tailscale allowed. Docker publishes a port by writing its own\nNAT rule; traffic is rewritten to the container address *before* the routing decision, so\nit is forwarded and never traverses the INPUT chain ufw manages. Docker provides\n`DOCKER-USER` as the hook for exactly this and ships it empty:\n\n```\n-A DOCKER ! -i docker0 -p tcp --dport 5433 -j DNAT --to-destination 172.17.0.2:5432\n\n$ iptables -S DOCKER-USER\n-N DOCKER-USER          # no rules\n```\n\nScope that claim precisely: it holds for traffic DNATed to a bridge-network container.\n`ufw` *can* manage forwarding policy — the problem is that a default-deny **incoming**\npolicy, which is what everyone configures and everyone checks, does not govern this path.\n\nA host firewall that reports a rule it does not enforce is worse than no firewall, because\nit terminates the investigation.\n\n**Failure two: a database superuser can run programs as the server's OS user.** The\nattacker did not exploit a vulnerability. `COPY ... FROM PROGRAM` is documented\nfunctionality for ETL, available to superusers and to members of\n`pg_execute_server_program`. It runs the command with the OS credentials of the PostgreSQL\nserver process.\n\n```sql\nCOPY tests FROM PROGRAM 'echo \u003Cbase64>|base64 -d|bash';\n```\n\nBe precise about the ceiling, because the imprecise version leads people to the wrong fix.\nA superuser is *not* automatically host root; it obtains the privileges of the account the\nserver runs as, subject to container and OS confinement. Related but distinct capabilities:\n`pg_read_server_files` **reads** files that account can read - it does not execute anything -\nwhile untrusted procedural languages and C extensions can reach native execution where the\nextension is available and loadable. Different doors, one blast radius.\n\nThere is no patch for this because nothing was violated. Which is exactly why an exposed\nPostgreSQL is not \"a database at risk\" but \"the server's OS account at risk\".\n\n**This was not CVE-2025-1094**, and the distinction matters in both directions. That CVE is\nan input-escaping flaw in PostgreSQL\u002Flibpq quoting functions that can produce SQL injection\nunder affected encodings; upgrading fixes it, and you should. What upgrading does *not* do\nis remove an authenticated superuser's documented ability to run server-side programs.\nEstablish the initial-access path from the logs before classifying: an attacker who\nauthenticated and then used `COPY PROGRAM` is a different incident from an escaping bug.\n\nEquivalents elsewhere, each with the qualification that makes it true:\n\n- **Redis** - a chain, not a one-liner. `CONFIG SET dir` plus `dbfilename` plus a forced\n  save can write an SSH key or cron entry, but only where filesystem permissions allow and\n  the version\u002Fconfig still permits those protected settings. Modern Redis restricts this.\n- **MongoDB with authentication disabled** - full data read\u002Fwrite; not code execution by\n  itself.\n- **Docker API on 2375** - the worst of the set: it *is* host root, immediately, via a\n  privileged container with the host filesystem mounted.\n- **Elasticsearch** - historical script-execution paths, largely closed in current versions;\n  treat as version-dependent rather than assumed.\n\n**Failure three: an image default widened the surface.** Three layers are involved and\ncollapsing them produces the wrong mental model. Upstream PostgreSQL defaults to\n`listen_addresses='localhost'` (`initdb` initializes a cluster; it does not listen). On\n**first initialization of a data directory**, the official Docker image configures network\nlistening and appends `host all all all \u003Cmethod>` to `pg_hba.conf` - with PostgreSQL 16 and\nno explicit `POSTGRES_HOST_AUTH_METHOD`, that method is normally `scram-sha-256`. Both\nlayers must line up for exposure: listening beyond loopback *and* an HBA rule that\nauthorizes the remote address.\n\nNote this applies to a *new* cluster. Changing the environment later does not rewrite an\nexisting data directory, so an inherited volume keeps whatever it was born with. Verify\nrather than assume:\n\n```sql\nSHOW listen_addresses;  SHOW password_encryption;  SHOW hba_file;\n```\n\nSensible on a private compose network; a loaded gun the moment the port is published. Each\ndefault is defensible alone.\n\n**What limited the damage, and what would not have.** The container had no\n`\u002Fvar\u002Frun\u002Fdocker.sock`, no host bind mounts, no added capabilities, was not privileged, and\nsat alone on the default bridge with no secrets in its environment. Result: stolen CPU\nrather than a compromised host.\n\nThat list is the minimum, not the whole set. Also check each of these - `docker.sock` and\n`--privileged` are host root outright; the rest widen the blast radius and each opens a\nplausible path to one: **host PID or network namespace** (`--pid=host`,\n`--network=host`), **added capabilities** (`CAP_SYS_ADMIN`, `CAP_SYS_PTRACE`,\n`CAP_NET_ADMIN`), **device passthrough** (`--device`), **other runtime sockets**\n(containerd, podman, a kubelet), **sensitive host paths** mounted at all (`\u002F`, `\u002Fetc`,\n`\u002Froot`, `~\u002F.ssh`, cloud credential directories), and a **shared network with a service\nworth pivoting to**. A mounted Docker socket is the most common of these, not the only one.\n\nContainment is what made\nthis survivable; do not treat \"it was only a container\" as reassurance, because code\nexecuted on that kernel, on host CPU, opening outbound connections from the host's address.\n\n**Defense, in priority order:**\n\n1. **Never write a bare `-p`.** Name the interface so private is the default.\n   ```\n   -p 5433:5432                   # every interface, including public\n   -p 127.0.0.1:5433:5432         # loopback only\n   -p 100.64.0.2:5433:5432        # VPN address only\n   ```\n2. **Fill in `DOCKER-USER`** so a forgotten bare `-p` cannot reach the internet, and persist\n   it (`iptables-persistent` or the provisioning scripts) so a rebuild cannot silently drop\n   it.\n\n   ```bash\n   # Match only NEW inbound connections. Replies to container-initiated traffic are\n   # ESTABLISHED, so they never match this rule and keep working - no companion\n   # \"allow established\" rule is needed, and adding one is worse than useless:\n   # ACCEPT is a terminal verdict, so an unscoped ACCEPT in DOCKER-USER would\n   # short-circuit all later FORWARD processing, including non-Docker forwarding.\n   # If you keep such a rule anyway, use RETURN (resume FORWARD), never ACCEPT.\n   iptables -I DOCKER-USER 1 -i \u003Cpublic-if> -m conntrack --ctstate NEW \\\n     ! -s \u003Ctrusted-cidr> -j DROP\n   ```\n\n   **Do not use `iptables -C` as proof this is done.** `-C` searches the whole chain and\n   says nothing about position; a matching rule sitting at position 5 passes the check while\n   traffic is already accepted above it. Order is the whole point of this rule. Assert on\n   numbered output instead, and rebuild the managed block when it has drifted:\n   ```bash\n   iptables -L DOCKER-USER -n --line-numbers\n   ```\n\n   Scope conditions, each of which silently produces a false sense of coverage:\n   - This is the **iptables** backend. Docker's **nftables** backend has no `DOCKER-USER`;\n     you need a forward hook at an earlier priority.\n   - **IPv6 is separate.** Where Docker IPv6 is enabled, an equivalent `ip6tables` policy is\n     required or the rule covers half your attack surface.\n   - Chain **existence is not attachment** - confirm `FORWARD` actually jumps to\n     `DOCKER-USER` (`iptables -S FORWARD`), not merely that the chain exists.\n   - Verify all three outcomes, not just the first: untrusted client blocked, trusted client\n     allowed, **and a container can still make an outbound request and receive the reply.**\n\n   This is defence in depth. Binding to loopback or a private address (1) remains the\n   primary control.\n3. **Set `POSTGRES_HOST_AUTH_METHOD`\u002F`pg_hba.conf` deliberately** rather than inheriting the\n   image default, and never reuse a database password that also exists elsewhere.\n4. **Ask what OS account a datastore's admin role can reach**, and let that decide what may\n   connect to it - not the sensitivity of the data it holds. The compromised database here\n   contained nothing of value.\n5. **Alert on sustained CPU with no corresponding workload.** The one signal that would have\n   caught this in hour one rather than week three.\n\n**Audit script** (run per host, not per repository). Written as one script rather than\nloose one-liners, because the failure mode this section warns about - an empty result\nreading as a clean result - is exactly what unguarded pipelines produce:\n\n```bash\n#!\u002Fusr\u002Fbin\u002Fenv bash\nset -Eeuo pipefail\n# Every check must distinguish three outcomes: hazard found, verified clean, and\n# NOT CHECKED. Collapsing the last two is the failure this whole section is about.\n\necho \"== 1. containers published to every interface ==\"\nif ! names=$(docker ps --format '{{.Names}}'); then\n  echo \"  NOT CHECKED: docker unavailable\"; exit 1\nfi\nhits=$(docker ps --format '{{.Names}}\\t{{.Ports}}' | grep -E '0\\.0\\.0\\.0|\\[::\\]' || true)\necho \"${hits:-  OK: docker queried, 0 wildcard publications}\"\n\necho \"== 2. is the firewall hook attached, and does it cover v6 ==\"\nsudo iptables -S FORWARD | grep -q DOCKER-USER \\\n  && echo \"  FORWARD -> DOCKER-USER: attached\" \\\n  || echo \"  WARN: FORWARD does not jump to DOCKER-USER - the chain is inert\"\nsudo iptables -L DOCKER-USER -n --line-numbers || echo \"  WARN: no DOCKER-USER (nftables backend?)\"\nsudo ip6tables -L DOCKER-USER -n --line-numbers 2>\u002Fdev\u002Fnull \\\n  || echo \"  NOTE: no IPv6 chain - fine only if Docker IPv6 is off\"\n\necho \"== 3. executables in container \u002Ftmp ==\"\n# All three execute positions, including setuid\u002Fsetgid\u002Fsticky (s\u002Ft). Prints the whole\n# listing on request so an interpreted script with no execute bit is still reviewable.\nfor c in $names; do\n  if out=$(docker exec \"$c\" sh -c 'ls -la \u002Ftmp 2>\u002Fdev\u002Fnull' 2>&1); then\n    printf '%s\\n' \"$out\" | grep -E '^-([r-][w-][xst]|[r-][w-][r-][r-][w-][xst]|[r-][w-][r-][r-][w-][r-][r-][w-][xst])' \\\n      | sed \"s|^|  $c: |\" || true\n  else\n    echo \"  $c: NOT CHECKED ($(printf '%s' \"$out\" | head -1))\"\n  fi\ndone\n\necho \"== 4. CPU that no workload explains ==\"\n# No `| head`: under pipefail a short reader makes the pipeline exit 141 and, with\n# set -e, silently ends the audit on any host with more than ten containers.\nif ! stats=$(docker stats --no-stream --format '{{.CPUPerc}}\\t{{.Name}}'); then\n  echo \"  NOT CHECKED: docker stats failed\"; exit 1\nfi\nprintf '%s\\n' \"$stats\" | sort -rn | head -10 || true\necho \"  Compare each against what that container should be doing. In this incident every\"\necho \"  real postgres worker sat at 0.0% while \u002Ftmp\u002Fpostgresql held 787%.\"\n\necho \"== 5. host listeners (catches what check 1 cannot) ==\"\n# -H drops the header, so 'no matches' is genuinely empty rather than a surviving title row.\nif ! listeners=$(sudo ss -H -lntup); then\n  echo \"  NOT CHECKED: ss failed\"; exit 1\nfi\nprintf '%s\\n' \"$listeners\" | grep -vE '127\\.0\\.0\\.|\\[::1\\]' || echo \"  OK: none beyond loopback\"\n\necho \"== 6. blast-radius multipliers ==\"\n# Per-container, so a failed inspect prints NOT CHECKED instead of vanishing into a\n# pipeline whose `|| echo \"none found\"` would report the host as clean.\nfound=0\nfor c in $names; do\n  if ! insp=$(docker inspect \"$c\" --format \\\n      '{{.Name}} priv={{.HostConfig.Privileged}} caps={{.HostConfig.CapAdd}} pid={{.HostConfig.PidMode}} net={{.HostConfig.NetworkMode}} devs={{len .HostConfig.Devices}} mounts={{range .Mounts}}{{.Source}},{{end}}'); then\n    echo \"  $c: NOT CHECKED (inspect failed)\"; found=1; continue\n  fi\n  printf '%s\\n' \"$insp\" | grep -E 'priv=true|caps=\\[[^]]|pid=host|net=host|devs=[1-9]|docker\\.sock|containerd\\.sock|\u002Fetc,|\u002Froot,|\\.ssh|\u002F,' \\\n    && found=1 || true\ndone\n[ \"$found\" -eq 0 ] && echo \"  OK: all $(printf '%s\\n' \"$names\" | wc -l) containers inspected, no multipliers found\"\necho \"  docker.sock or --privileged is host root outright. Host PID\u002Fnetwork, added\"\necho \"  capabilities, device passthrough and sensitive mounts widen the blast radius and\"\necho \"  each opens a plausible path to one - treat any hit as needing a reason to exist.\"\n```\n\n**On log-grepping for the technique.** This is evidence collection, never proof of absence -\nPostgreSQL does not log successful statements unless `log_statement` is set, so a successful\n`COPY ... PROGRAM` may leave no trace at all:\n\n```bash\n: \"${PG_CONTAINER:?set PG_CONTAINER}\"\ndocker logs \"$PG_CONTAINER\" 2>&1 \\\n  | grep -iE 'COPY .*PROGRAM|WITH SUPERUSER|pg_execute_server_program' \\\n  || echo \"no matches - which means nothing unless log_statement was enabled\"\n```\n\n**A note on verifying a clean result.** During this investigation a role check returned\nempty output and read as \"no attacker accounts present\". The command had in fact failed —\nthat image sets `POSTGRES_USER=sessions`, so `psql -U postgres` errored — and a failed\ncommand and a clean result are indistinguishable when you grep the output. Make each check\nprove it ran: assert on an expected header, a non-empty baseline, or an exit code. This\napplies to every command in this skill.\n\n---\n\n## Audit Workflow\n\n### Step 1: Discover Project Structure\n\n```bash\necho \"=== Workflows ===\"\nls .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull || echo \"No GitHub Actions workflows\"\n\necho \"\"\necho \"=== Lock files (must ALL be committed) ===\"\nfind . -maxdepth 5 \\( \\\n  -name \"package-lock.json\" -o \\\n  -name \"pnpm-lock.yaml\" -o \\\n  -name \"yarn.lock\" -o \\\n  -name \"uv.lock\" -o \\\n  -name \"Cargo.lock\" \\\n\\) -not -path \"*\u002Fnode_modules\u002F*\" -not -path \"*\u002F.git\u002F*\"\n\necho \"\"\necho \"=== Container files ===\"\nfind . -maxdepth 5 -name \"Dockerfile*\" -o -name \"docker-compose*.yml\" \\\n  | grep -v \".git\" | head -20\n```\n\n### Step 2: GitHub Actions SHA Pinning\n\n```bash\necho \"=== Actions with MUTABLE tags (MUST FIX) ===\"\n# Matches @v1, @v2.3, @main, @master, @latest, @stable\ngrep -rn \"uses:.*@\\(v[0-9]\\|\\\u003Cmain\\>\\|\\\u003Cmaster\\>\\|\\\u003Clatest\\>\\|\\\u003Cstable\\>\\)\" \\\n  .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull || echo \"None found ✅\"\n\necho \"\"\necho \"=== Actions with SHA pins (safe) ===\"\ngrep -rn \"uses:.*@[0-9a-f]\\{40\\}\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull | wc -l\necho \" SHA-pinned action lines\"\n```\n\n### Step 3: Workflow Permissions\n\n```bash\necho \"=== Workflows missing top-level permissions (risky) ===\"\nfor f in .github\u002Fworkflows\u002F*.yml .github\u002Fworkflows\u002F*.yaml; do\n  [ -f \"$f\" ] || continue\n  if ! grep -q \"^permissions:\" \"$f\"; then\n    echo \"  ❌ MISSING: $f\"\n  else\n    echo \"  ✅ $f\"\n  fi\ndone\n```\n\n### Step 4: Install Hygiene (Postinstall Hook Blocking)\n\n```bash\necho \"=== npm\u002Fpnpm install commands in CI ===\"\ngrep -rn \"npm install\\b\\|npm ci\\b\\|pnpm install\\b\\|yarn install\\b\" \\\n  .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull\n\necho \"\"\necho \"=== Missing script blocking (flag for review) ===\"\ngrep -rn \"npm ci\\b\\|npm install\\b\\|pnpm install\\b\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull \\\n  | grep -v \"ignore-scripts\\|frozen-lockfile\" \\\n  || echo \"All installs have script\u002Fversion blocking ✅\"\n\necho \"\"\necho \"=== pnpm onlyBuiltDependencies (allowlist approach) ===\"\ngrep -rn \"onlyBuiltDependencies\" . --include=\"package.json\" \\\n  --exclude-dir=node_modules 2>\u002Fdev\u002Fnull || echo \"Not configured\"\n```\n\n### Step 5: Lock File Discipline\n\n```bash\necho \"=== Lock files tracked by git (must be committed) ===\"\ngit ls-files | grep -E \"uv\\.lock|package-lock\\.json|pnpm-lock\\.yaml|yarn\\.lock|Cargo\\.lock\"\n\necho \"\"\necho \"=== Lock files in .gitignore (BAD — should be committed) ===\"\ngrep -E \"uv\\.lock|package-lock|pnpm-lock|yarn\\.lock|Cargo\\.lock\" .gitignore 2>\u002Fdev\u002Fnull \\\n  || echo \"None ignored ✅\"\n\necho \"\"\necho \"=== CI using npm install instead of npm ci ===\"\ngrep -rn \"npm install\\b\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull \\\n  | grep -v \"#\" || echo \"None found ✅\"\n```\n\n### Step 6: Vulnerability \u002F SCA Scanning\n\n```bash\necho \"=== OSV Scanner ===\"\ngrep -rn \"osv-scanner\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull || echo \"❌ NOT CONFIGURED\"\n\necho \"\"\necho \"=== Dependency Review Action ===\"\ngrep -rn \"dependency-review-action\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull || echo \"❌ NOT CONFIGURED\"\n\necho \"\"\necho \"=== Dependabot ===\"\ncat .github\u002Fdependabot.yml 2>\u002Fdev\u002Fnull || echo \"❌ NOT CONFIGURED\"\n```\n\n### Step 6.5: Native Ecosystem Audits\n\nOSV Scanner checks lock files against a vulnerability database, but native ecosystem tools\n(`pip-audit`, `pnpm audit`) cover additional advisories specific to each package registry.\nRun both for defense in depth.\n\n```bash\necho \"=== pip-audit (Python) ===\"\nif command -v pip-audit &>\u002Fdev\u002Fnull; then\n  # Export locked deps, then audit against PyPI advisory DB.\n  # --disable-pip: use the PyPI JSON API directly (faster, no pip subprocess).\n  uv export --format requirements-txt --no-hashes --quiet \\\n    | pip-audit --disable-pip -r \u002Fdev\u002Fstdin 2>&1 \\\n    || echo \"⚠️ pip-audit found issues (see above)\"\nelse\n  echo \"❌ pip-audit not installed. Install: uv tool install pip-audit\"\nfi\n\necho \"\"\necho \"=== pnpm audit (Node.js) ===\"\n# --prod: only audit production dependencies (devDependencies aren't deployed).\n# Run per-app because each has its own lock file and dependency tree.\nfind . -maxdepth 4 \\( -name pnpm-lock.yaml -o -name package-lock.json \\) \\\n  -not -path '*\u002Fnode_modules\u002F*' -print | sort -u | while IFS= read -r lockfile; do\n  dir=\"$(dirname \"$lockfile\")\"\n  echo \"--- $dir ---\"\n  (cd \"$dir\" && pnpm audit --prod 2>&1) || echo \"⚠️ audit issues in $dir\"\ndone\n```\n\n### Step 6.6: Dependency Tree Review\n\nUnderstand what you're actually pulling in. Heavy transitive trees are supply chain risk —\neach package is a trust relationship. The goal is to identify reduction targets.\n\n```bash\necho \"=== Python dependency tree (direct deps + first 2 levels) ===\"\nuv tree --depth 2 2>\u002Fdev\u002Fnull || echo \"Run from project root with uv.lock present\"\n\necho \"\"\necho \"=== Python: total package count ===\"\ngrep -c '^\\[\\[package\\]\\]' uv.lock 2>\u002Fdev\u002Fnull || echo \"No uv.lock found\"\n\necho \"\"\necho \"=== Node.js: total package count per project ===\"\nfind . -maxdepth 4 \\( -name \"pnpm-lock.yaml\" -o -name \"package-lock.json\" \\) \\\n  -not -path '*\u002Fnode_modules\u002F*' -print | sort -u | while IFS= read -r lockfile; do\n  dir=\"$(dirname \"$lockfile\")\"\n  if [ -f \"$dir\u002Fpnpm-lock.yaml\" ]; then\n    count=$(grep -c 'resolution:' \"$dir\u002Fpnpm-lock.yaml\" 2>\u002Fdev\u002Fnull || echo \"?\")\n    echo \"  $dir: ~$count packages\"\n  elif [ -f \"$dir\u002Fpackage-lock.json\" ]; then\n    count=$(grep -c '\"resolved\":' \"$dir\u002Fpackage-lock.json\" 2>\u002Fdev\u002Fnull || echo \"?\")\n    echo \"  $dir: ~$count packages\"\n  fi\ndone\n\necho \"\"\necho \"=== Heaviest transitive dependency chains (investigate these) ===\"\necho \"Use 'pnpm why \u003Cpackage>' to trace why a package is in your tree.\"\necho \"Use 'uv tree --invert \u003Cpackage>' to trace Python reverse dependencies.\"\n```\n\n### Step 7: SAST — Static Security Analysis\n\n```bash\necho \"=== CodeQL ===\"\ngrep -rn \"codeql\\|github\u002Fcodeql-action\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull \\\n  || echo \"❌ NOT CONFIGURED\"\n\necho \"\"\necho \"=== Semgrep ===\"\ngrep -rn \"semgrep\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull || echo \"Not configured\"\n\necho \"\"\necho \"=== Bandit (Python SAST) ===\"\ngrep -rn \"bandit\" .github\u002Fworkflows\u002F pyproject.toml 2>\u002Fdev\u002Fnull || echo \"Not configured\"\n\necho \"\"\necho \"=== ESLint security plugin (JS\u002FTS) ===\"\ngrep -rn \"plugin:security\\|eslint-plugin-security\" . \\\n  --include=\".eslintrc*\" --include=\"package.json\" \\\n  --exclude-dir=node_modules 2>\u002Fdev\u002Fnull || echo \"Not configured\"\n```\n\n### Step 8: Container Scanning\n\n```bash\necho \"=== Dockerfile count ===\"\nfind . -name \"Dockerfile*\" -not -path \"*\u002F.git\u002F*\" | wc -l\n\necho \"\"\necho \"=== Docker Scout (container scanning) ===\"\ngrep -rn \"docker-scout\\|docker\u002Fscout-action\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull \\\n  || echo \"Not configured\"\n```\n\n### Step 9: Secret Scanning\n\n```bash\necho \"=== Pre-commit config ===\"\ncat .pre-commit-config.yaml 2>\u002Fdev\u002Fnull || echo \"No .pre-commit-config.yaml\"\n\necho \"\"\necho \"=== gitleaks in CI ===\"\ngrep -rn \"gitleaks\\|zricethezav\u002Fgitleaks\" .github\u002Fworkflows\u002F 2>\u002Fdev\u002Fnull \\\n  || echo \"Not configured in CI\"\n\necho \"\"\necho \"=== GitHub secret scanning ===\"\n# Cannot check programmatically — requires repo Settings > Security > Secret scanning\necho \"Check: Settings > Security > Secret scanning > Enable\"\n\necho \"\"\necho \"=== Potential hardcoded secrets (heuristic) ===\"\ngrep -rn \\\n  -e \"api_key\\s*=\\s*['\\\"][^'\\\"]\\{10,\\}\" \\\n  -e \"secret\\s*=\\s*['\\\"][^'\\\"]\\{10,\\}\" \\\n  -e \"password\\s*=\\s*['\\\"][^'\\\"]\\{8,\\}\" \\\n  -e \"token\\s*=\\s*['\\\"][^'\\\"]\\{10,\\}\" \\\n  --include=\"*.py\" --include=\"*.ts\" --include=\"*.js\" --include=\"*.yml\" --include=\"*.yaml\" \\\n  --exclude-dir=\".git\" --exclude-dir=\"node_modules\" --exclude-dir=\".venv\" \\\n  . 2>\u002Fdev\u002Fnull \\\n  | grep -v \"example\\|placeholder\\|your_\\|\u003C\\|env\\.\\|os\\.\\|process\\.env\\|getenv\\|secret_key\\s*=\" \\\n  || echo \"No obvious hardcoded secrets ✅\"\n\necho \"\"\necho \"=== .env files accidentally tracked ===\"\ngit ls-files | grep -E \"^\\.env$|^\\.env\\.\" | grep -v \".example\" \\\n  || echo \"None tracked ✅\"\n```\n\n### Step 10: .gitignore Credential Patterns\n\n```bash\necho \"=== Credential patterns in .gitignore ===\"\nfor pattern in \"*.pem\" \"*.key\" \"*.p12\" \"id_rsa\" \"id_ed25519\" \"*.cer\" \"*.crt\" \".env\"; do\n  if grep -q \"$pattern\" .gitignore 2>\u002Fdev\u002Fnull; then\n    echo \"  ✅ $pattern\"\n  else\n    echo \"  ❌ MISSING: $pattern\"\n  fi\ndone\n```\n\n### Step 11: CODEOWNERS\n\n```bash\necho \"=== CODEOWNERS protection of high-risk paths ===\"\nfor path in \".github\u002F\" \"docker\u002F\" \"infra\u002F\" \".gitmodules\"; do\n  if grep -q \"$path\" .github\u002FCODEOWNERS 2>\u002Fdev\u002Fnull; then\n    echo \"  ✅ $path\"\n  else\n    echo \"  ❌ NOT PROTECTED: $path\"\n  fi\ndone\n```\n\n---\n\n### Step 12: Runtime Exposure (per HOST, not per repo)\n\nEvery step above reads the repository. This one cannot be answered from a repository at all\n— the exposure exists on a machine, and a clean repo audit is compatible with a fully\ncompromised host. Run the audit script in **Area 11** against each host that runs\ncontainers, and treat any of these as a finding:\n\n- a container published to `0.0.0.0` \u002F `[::]` on a host with a public address\n- `FORWARD` not jumping to `DOCKER-USER`, or `DOCKER-USER` empty\n- an executable under a container's `\u002Ftmp`\n- sustained CPU with no workload that accounts for it\n- `docker.sock`, `--privileged`, host PID\u002Fnetwork, or a sensitive host path on any container\n\n## Fix Recipes\n\nOnly apply when MODE is \"fix\" or \"both\". Walk through each finding with the user.\n\n### Fix: Pin an Action to SHA\n\n```bash\n# Resolve SHA for a tag:\ngh api repos\u002Factions\u002Fcheckout\u002Fgit\u002Fref\u002Ftags\u002Fv4 --jq '.object.sha'\n# If the result is a tag object (annotated), dereference one more time:\ngh api repos\u002Factions\u002Fcheckout\u002Fgit\u002Ftags\u002F\u003Csha-from-above> --jq '.object.sha'\n```\n\nReplace in workflow:\n```yaml\n# Before\n- uses: actions\u002Fcheckout@v4\n\n# After — SHA pinned, version visible in comment\n- uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4\n```\n\n### Fix: Add Workflow Permissions\n\nAdd before `jobs:` in each workflow:\n```yaml\n# Least-privilege default — limits blast radius if a step is compromised.\n# Jobs needing write access declare it explicitly at the job level.\npermissions:\n  contents: read\n```\n\n### Fix: Add --ignore-scripts\n\n```yaml\n# npm — blocks postinstall hooks (event-stream\u002Fua-parser-js attack vector)\n- run: npm ci --ignore-scripts\n\n# pnpm — blanket approach\n- run: pnpm install --ignore-scripts\n\n# pnpm — allowlist approach (preferred when native deps like esbuild need build steps)\n# Add to package.json:\n# \"pnpm\": { \"onlyBuiltDependencies\": [\"esbuild\", \"sharp\"] }\n```\n\n### Fix: Switch npm install → npm ci\n\n```yaml\n# npm ci enforces exact lock file versions — fails if package-lock.json is stale.\n# npm install re-resolves, can silently pick up new (possibly malicious) versions.\n- run: npm ci --ignore-scripts\n```\n\n### Fix: Add uv --frozen\n\n```yaml\n# --frozen fails if uv.lock is out of sync with pyproject.toml.\n# Ensures CI always installs exactly what's in the lock file.\n- run: uv sync --all-extras --frozen\n```\n\n### Fix: SHA-Pin a GitHub Action (Worked Example)\n\nMutable tags (`@v4`) can be silently moved to a malicious commit — the diff in *your* repo\nis invisible. SHA-pinning makes every update an explicit, reviewable change.\n\n```bash\n# Step 1: Resolve the commit SHA for the tag you want to pin.\n# This queries GitHub's git refs API — no clone needed.\ngh api repos\u002Factions\u002Fcheckout\u002Fgit\u002Fref\u002Ftags\u002Fv4 --jq '.object.sha'\n# → e.g. 11bd71901bbe5b1630ceea73d27597364c9af683\n\n# Step 2: If the tag is annotated (most are), the above returns a tag object SHA,\n# not a commit SHA. Dereference it to get the actual commit:\ngh api repos\u002Factions\u002Fcheckout\u002Fgit\u002Ftags\u002F11bd71901bbe5b1630ceea73d27597364c9af683 \\\n  --jq '.object.sha'\n# → the real commit SHA\n\n# Step 3: Replace in your workflow file:\n```\n\n```yaml\n# BEFORE — mutable tag. A compromised maintainer can silently repoint this\n# to a malicious commit. Your CI runs attacker code with access to secrets.\n- uses: actions\u002Fcheckout@v4\n\n# AFTER — immutable SHA. The version comment is for humans; CI uses the SHA.\n# To update: repeat steps 1-2 above, get new SHA, update this line.\n# The diff in your PR is the proof that the update was intentional.\n- uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4\n```\n\n### Fix: Add pip-audit to CI\n\n```yaml\n  # pip-audit: checks Python dependencies against the PyPI advisory database.\n  # Complements OSV Scanner — pip-audit catches PyPI-specific advisories that\n  # OSV may not yet index, and verifies package hashes for tamper detection.\n  pip-audit:\n    name: Python Dependency Audit\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read  # Least-privilege — only needs to read the repo\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n\n      # Install uv first — we need it to export the locked dependency list.\n      - uses: astral-sh\u002Fsetup-uv@\u003CSHA> # vX\n        with:\n          version: \"latest\"\n\n      # pip-audit is a standalone tool, not a project dependency.\n      # uv tool install puts it in an isolated environment — it can't\n      # be poisoned by the project's own dependency tree.\n      - name: Install pip-audit\n        run: uv tool install pip-audit\n\n      # Export locked deps from uv.lock → requirements.txt format.\n      # --no-hashes: pip-audit doesn't need hashes for advisory lookups.\n      # --frozen ensures we export exactly what's locked, not a fresh resolve.\n      - name: Audit Python dependencies\n        run: |\n          uv export --format requirements-txt --no-hashes --frozen --quiet \\\n            | pip-audit --disable-pip -r \u002Fdev\u002Fstdin\n        # --disable-pip: queries PyPI JSON API directly instead of shelling\n        #   out to pip. Faster and avoids pip's own dependency resolution.\n        continue-on-error: true  # TODO(#N): remove after first clean baseline\n```\n\n### Fix: Add pnpm audit to CI\n\n```yaml\n  # pnpm audit: checks Node.js dependencies against the npm advisory database.\n  # Runs per-project because each app has its own lock file and dependency tree.\n  npm-audit:\n    name: Node.js Dependency Audit\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n\n      - uses: pnpm\u002Faction-setup@\u003CSHA> # vX\n        with:\n          version: 9\n\n      - uses: actions\u002Fsetup-node@\u003CSHA> # vX\n        with:\n          node-version: \"22\"\n\n      # --prod: only audit production dependencies. devDependencies run in CI\n      # and local dev but never in production — their risk profile is different.\n      # --audit-level moderate: fail on moderate+ severity (skip low\u002Finfo noise).\n      - name: Audit frontend dependencies\n        run: |\n          find . -maxdepth 4 \\( -name pnpm-lock.yaml -o -name package-lock.json \\) \\\n            -not -path '*\u002Fnode_modules\u002F*' -print | sort -u | while IFS= read -r lockfile; do\n            dir=\"$(dirname \"$lockfile\")\"\n            echo \"=== Auditing $dir ===\"\n            (cd \"$dir\" && pnpm audit --prod --audit-level moderate)\n          done\n        continue-on-error: true  # TODO(#N): remove after first clean baseline\n```\n\n### Fix: Enable Hash Verification for Python Dependencies\n\nVersion pinning alone isn't sufficient — if an attacker compromises PyPI and replaces\nthe artifact for an already-pinned version, the version number matches but the content\nis malicious. Hash verification catches this.\n\n```bash\n# Export locked dependencies WITH content hashes:\nuv export --format requirements-txt --hashes --frozen > requirements-hashed.txt\n\n# The output includes lines like:\n#   pydantic==2.12.5 \\\n#     --hash=sha256:abc123... \\\n#     --hash=sha256:def456...\n# Each hash is the SHA-256 of the wheel\u002Fsdist. If PyPI serves a different\n# artifact (tampered or replaced), the hash won't match and install fails.\n\n# Install with hash verification:\nuv pip install --require-hashes -r requirements-hashed.txt\n# --require-hashes: EVERY package must have a hash. If any package is missing\n# a hash entry, the install fails — no silent fallback to unhashed installs.\n```\n\nFor Dockerfiles:\n```dockerfile\n# Generate hashed requirements at build time from the committed lock file.\n# This ensures the Docker build installs exactly what was reviewed and locked,\n# with cryptographic proof that no artifact was tampered with in transit.\nRUN uv export --format requirements-txt --hashes --frozen > \u002Ftmp\u002Frequirements.txt \\\n    && uv pip install --require-hashes -r \u002Ftmp\u002Frequirements.txt \\\n    && rm \u002Ftmp\u002Frequirements.txt\n```\n\n### Fix: Add OSV Scanner\n\n```yaml\n  osv-scan:\n    name: OSV Vulnerability Scan\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n      # OSV checks all lock files against the OSV database (PyPI, npm, crates.io, Go, Maven).\n      # continue-on-error during rollout — remove after first clean baseline. See TODO(#N).\n      - uses: google\u002Fosv-scanner-action\u002Fosv-scanner-action@\u003CSHA> # vX\n        continue-on-error: true  # TODO(#N): flip to false after clean baseline\n        with:\n          scan-args: |-\n            --lockfile=uv.lock\n            --lockfile=package-lock.json\n```\n\n### Fix: Add CodeQL SAST\n\n```yaml\n  codeql:\n    name: CodeQL SAST\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      security-events: write  # Required to upload SARIF results\n    strategy:\n      matrix:\n        language: [python, javascript-typescript]\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n      # CodeQL: GitHub-native SAST, free for public repos.\n      # Finds SQL injection, XSS, path traversal, insecure deserialization, etc.\n      - uses: github\u002Fcodeql-action\u002Finit@\u003CSHA> # vX\n        with:\n          languages: ${{ matrix.language }}\n          queries: security-extended\n      - uses: github\u002Fcodeql-action\u002Fautobuild@\u003CSHA> # vX\n      - uses: github\u002Fcodeql-action\u002Fanalyze@\u003CSHA> # vX\n```\n\n\n### Fix: Add Docker Scout Container Scanning\n\n```yaml\n  docker-scout:\n    name: Docker Scout\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      security-events: write\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n      - name: Build image\n        run: docker build -t scan-target:${{ github.sha }} .\n      # Docker Scout: maintained by Docker — same trust chain as the runtime itself.\n      # Preferred over third-party scanners (e.g. Trivy) precisely because it doesn't\n      # add a new security-critical dependency outside the Docker ecosystem.\n      - uses: docker\u002Fscout-action@\u003CSHA> # vX\n        with:\n          command: cves\n          image: scan-target:${{ github.sha }}\n          sarif-file: scout-results.sarif\n          only-severities: critical,high\n      - uses: github\u002Fcodeql-action\u002Fupload-sarif@\u003CSHA> # vX\n        with:\n          sarif_file: scout-results.sarif\n```\n\n### Fix: Add gitleaks Secret Scanning\n\n```yaml\n  secret-scan:\n    name: Secret Scan\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - uses: actions\u002Fcheckout@\u003CSHA> # vX\n        with:\n          fetch-depth: 0  # Full history — scan all commits, not just HEAD\n      # gitleaks: scans git history for secrets (API keys, tokens, private keys).\n      # Catches accidental commits that slipped past pre-commit hooks.\n      - uses: gitleaks\u002Fgitleaks-action@\u003CSHA> # vX\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Fix: Add Pre-commit Secret Gate (gitleaks)\n\n`.pre-commit-config.yaml`:\n```yaml\nrepos:\n  - repo: https:\u002F\u002Fgithub.com\u002Fgitleaks\u002Fgitleaks\n    rev: v8.x.x  # Pin to SHA in practice\n    hooks:\n      - id: gitleaks\n        # Scans staged files for secrets before commit reaches git history.\n        # Much cheaper than incident response after accidental push.\n```\n\n### Fix: Harden .gitignore\n\n```gitignore\n# Private keys and certificates — passive safety net against accidental commits\n*.pem\n*.key\n*.p12\n*.pfx\n*.cer\n*.crt\nid_rsa\nid_rsa.pub\nid_ed25519\nid_ed25519.pub\n*.keystore\n\n# Environment files (use .env.example for documentation)\n.env\n.env.local\n.env.*.local\n```\n\n### Fix: Add CODEOWNERS\n\n`.github\u002FCODEOWNERS`:\n```\n# CI\u002FCD workflows — arbitrary code execution risk. Any change here can exfiltrate\n# secrets or backdoor the pipeline. Require maintainer review.\n.github\u002F                     @\u003Cteam>\n\n# Container and infrastructure config — supply chain risk\ndocker\u002F                      @\u003Cteam>\ninfra\u002F                       @\u003Cteam>\n\n# Shared credentials config and typed env constants — blast radius: all services\npackages\u002Fsyn-shared\u002F         @\u003Cteam>\n\n# Submodule pin changes must be intentional — a silently advanced submodule\n# is a supply chain attack vector analogous to tag repointing\n.gitmodules                  @\u003Cteam>\n```\n\n---\n\n## Audit Report Template\n\n```markdown\n# Security Audit — \u003Crepo>\n\n**Date:** \u003Cdate>\n**Auditor:** \u003Cname or \"automated\">\n\n---\n\n## Summary\n\n| Control | Status | Priority |\n|---------|--------|----------|\n| Actions SHA-pinned | ✅\u002F❌ | P0 |\n| Workflow least-privilege permissions | ✅\u002F❌ | P0 |\n| npm\u002Fpnpm --ignore-scripts | ✅\u002F❌ | P1 |\n| npm ci (not npm install) | ✅\u002F❌ | P1 |\n| uv sync --frozen | ✅\u002F❌ | P1 |\n| OSV Scanner configured | ✅\u002F❌ | P1 |\n| dependency-review-action | ✅\u002F❌ | P1 |\n| CodeQL SAST | ✅\u002F❌ | P1 |\n| pip-audit (Python advisory DB) | ✅\u002F❌ | P1 |\n| pnpm audit (npm advisory DB) | ✅\u002F❌ | P1 |\n| Hash verification (uv --hashes) | ✅\u002F❌ | P1 |\n| Dependency tree reviewed | ✅\u002F❌ | P1 |\n| Container scanning (Docker Scout) | ✅\u002F❌ | P2 |\n| Secret scanning (gitleaks) | ✅\u002F❌ | P1 |\n| Pre-commit secret gate | ✅\u002F❌ | P2 |\n| .gitignore credential patterns | ✅\u002F❌ | P2 |\n| CODEOWNERS for high-risk paths | ✅\u002F❌ | P2 |\n| SECURITY.md present | ✅\u002F❌ | P2 |\n| Dependabot configured | ✅\u002F❌ | P2 |\n\n---\n\n## Runtime Exposure (per host — see Area 11)\n\n| Host | Wildcard publications | DOCKER-USER attached (v4\u002Fv6) | Container \u002Ftmp | Unexplained CPU | Blast-radius multipliers |\n|------|----------------------|------------------------------|----------------|-----------------|--------------------------|\n| \u003Chost> | \u003Ccount \u002F NOT CHECKED> | \u003Cyes-yes \u002F yes-no \u002F NOT CHECKED> | \u003Cclean \u002F N hits \u002F NOT CHECKED> | \u003Cnone \u002F list> | \u003Cdocker.sock, privileged, host-ns, caps, devices, mounts, none> |\n\n## Critical Findings (P0 — Fix before next push)\n\n### [Finding title]\n- **Location:** `path\u002Fto\u002Ffile:line`\n- **Issue:** \u003Cdescription>\n- **Fix:** \u003Cexact change>\n\n---\n\n## High Findings (P1 — Fix this sprint)\n...\n\n## Medium Findings (P2 — Backlog)\n...\n\n---\n\n## Applied Fixes\n- [ ] SHA-pin all Actions\n- [ ] Add permissions: contents: read to all workflows\n- [ ] Add --ignore-scripts to CI installs\n- [ ] Switch npm install → npm ci\n- [ ] Add uv sync --frozen\n- [ ] Add OSV Scanner\n- [ ] Add CodeQL\n- [ ] Add Docker Scout (if containers present)\n- [ ] Add pip-audit to CI\n- [ ] Add pnpm audit to CI\n- [ ] Enable hash verification in Dockerfiles\n- [ ] Review dependency tree — identify reduction targets\n- [ ] Add gitleaks\n- [ ] Harden .gitignore\n- [ ] Add\u002Fupdate CODEOWNERS\n- [ ] Create SECURITY.md\n\n---\n\n## Remaining (Post-launch or Planned)\n- [ ] Dependabot for Actions + npm\n- [ ] OSV Scanner flip to blocking (after clean baseline)\n- [ ] Pre-commit hook with gitleaks\n- [ ] Sigstore\u002Fcosign artifact signing\n- [ ] OpenSSF Scorecard integration\n- [ ] SBOM generation (syft\u002Fcyclonedx)\n```\n\n---\n\n## Reference: Attack Taxonomy\n\n| Attack | Vector | Year | Defense |\n|--------|--------|------|---------|\n| XZ-utils backdoor | GitHub Actions mutable tag | 2024 | SHA pin Actions |\n| event-stream | npm postinstall hook | 2018 | --ignore-scripts |\n| ua-parser-js | npm postinstall hook | 2021 | --ignore-scripts |\n| Log4Shell | Vulnerable dependency | 2021 | OSV Scanner + Dependabot |\n| Codecov breach | CI script injection | 2021 | CODEOWNERS + permissions |\n| SolarWinds | Build pipeline compromise | 2020 | Sigstore, SLSA |\n| tj-actions\u002Fchanged-files | Tag repointing | 2025 | SHA pin Actions |\n| litellm 1.82.8 | PyPI .pth file injection | 2026 | pip-audit, hash verification, dep minimization |\n| Shai-Halud | AI\u002FML package credential theft | 2025 | pip-audit, hash verification, dep minimization |\n| Exposed Postgres cryptojack | Published port + `COPY FROM PROGRAM` | 2026 | Bind to an interface, fill `DOCKER-USER`, set `pg_hba` |\n\n## Reference: Tools\n\n| Tool | Category | Cost | Docs |\n|------|----------|------|------|\n| OSV Scanner | SCA | Free | https:\u002F\u002Fgoogle.github.io\u002Fosv-scanner |\n| CodeQL | SAST | Free (public) | https:\u002F\u002Fcodeql.github.com |\n| Semgrep | SAST | Free (OSS) | https:\u002F\u002Fsemgrep.dev |\n| Docker Scout | Container | Free tier | https:\u002F\u002Fdocs.docker.com\u002Fscout |\n| gitleaks | Secrets | Free | https:\u002F\u002Fgitleaks.io |\n| Dependabot | SCA | Free | GitHub native |\n| OpenSSF Scorecard | Posture | Free | https:\u002F\u002Fsecurityscorecards.dev |\n| SLSA | Build provenance | Free | https:\u002F\u002Fslsa.dev |\n| pip-audit | Python SCA | Free | https:\u002F\u002Fgithub.com\u002Fpypa\u002Fpip-audit |\n| pnpm audit | Node SCA | Free | Built into pnpm |\n| deptry | Python unused deps | Free | https:\u002F\u002Fgithub.com\u002Ffpgmaas\u002Fdeptry |\n| depcheck | Node unused deps | Free | https:\u002F\u002Fgithub.com\u002Fnicedoc\u002Fdepcheck |\n",{"model":23,"description":7,"allowed-tools":24,"argument-hint":25},"opus","Read, Grep, Glob, Bash, Edit, Write","[audit|fix|both] - default: both","main","8341ffb3b4128f405d0797b5f3f3affb25de91ea","plugins\u002Fsdlc\u002Fskills\u002Fsecurity-hardening","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace","https:\u002F\u002Fgithub.com\u002FAgentParadise","2026-11-09 13:31:42",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add AgentParadise\u002Fagentic-workspace --skill security-hardening",{"tool":38,"command":39},"bunx","bunx skills add AgentParadise\u002Fagentic-workspace --skill security-hardening",{"tool":41,"command":42},"pnpm","pnpm dlx skills add AgentParadise\u002Fagentic-workspace --skill security-hardening","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fsecurity-hardening\u002FSKILL.md",true,[],[47,54,61,68,75,82],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":18},"01M7DDJG3VACD4G63HQ3WWDTV5","testing-expert","Expert knowledge for analyzing testing architecture and planning improvements","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Ftesting-expert\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M7DDHZY3KRZ1PM4YTVR8Y5B5","review","Review implementation against project plan and verify completeness","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Freview\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":18},"01M7DDHVFQK785K8Z7HX5GRN4A","qa-setup","Verify or create standardized QA commands for polyglot projects","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fqa-setup\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":18},"01M7DDHSD25FQ20METGDRWAWED","prioritize","Prioritize review comments by severity","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fprioritize\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M7DDHPHRVKHR1TZBYNSTA0XX","pre-commit-qa","Run standardized QA checks before committing changes","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fpre-commit-qa\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M7DDHG61S2MH55PPEAGN58H0","macos-keychain-secrets","Store and retrieve secrets securely using macOS Keychain. Use when working with API keys, tokens, credentials, or any sensitive values that should not be stored in plain text files, dotfiles, or committed to git. Triggers on requests to store secrets, manage credentials, set up environment variables securely, or avoid hardcoding sensitive values.","https:\u002F\u002Fgithub.com\u002FAgentParadise\u002Fagentic-workspace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fmacos-keychain-secrets\u002FSKILL.md",[],[]]