-
Notifications
You must be signed in to change notification settings - Fork 17
ci: supply-chain security gate (OSV-Scanner + Socket) [failproofai-394] #391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d86e958
ci: add supply-chain security gate (OSV-Scanner + Socket)
NiveditJain 5c0e0b6
docs: reference PR #391 in the changelog supply-chain entry
NiveditJain 1f74206
ci: call osv-scanner-action directly instead of the reusable workflow
NiveditJain e9c76dc
ci: disable credential persistence in osv-scanner checkout
NiveditJain 157913d
docs: correct failproofai positioning in SECURITY.md
NiveditJain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Supply-chain security gate. | ||
| # | ||
| # Scans the resolved dependency tree (bun.lock) against the OSV.dev database — | ||
| # which aggregates GitHub/npm security advisories AND the OpenSSF | ||
| # malicious-packages feed — and FAILS on any known-vulnerable or known-malicious | ||
| # package (block-on-any-finding policy). OSV-Scanner exits non-zero when it finds | ||
| # anything, which fails this job. | ||
| # | ||
| # Runs on every PR (incl. Dependabot bumps), on pushes to main, and weekly to | ||
| # catch advisories disclosed after a dependency was already merged. | ||
| # | ||
| # Triage / allow-listing unfixable advisories: see SECURITY.md and osv-scanner.toml | ||
| # (auto-loaded from the repo root by OSV-Scanner). | ||
| # | ||
| # Third-party actions are pinned to a commit SHA (we're a supply-chain tool — | ||
| # practice what we preach). | ||
| name: Supply Chain | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| push: | ||
| branches: [main] | ||
| schedule: | ||
| - cron: "17 4 * * 1" # Mondays 04:17 UTC | ||
| workflow_dispatch: | ||
|
|
||
| # Least privilege: the scan only needs to read the checked-out source. | ||
| # contents:read is also available to Dependabot PRs (read-only token), so the | ||
| # gate enforces on dependency-bump PRs too. | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| osv-scanner: | ||
| name: OSV-Scanner | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| with: | ||
| # No git ops after checkout; don't leave the token in .git/config. | ||
| persist-credentials: false | ||
| - name: Scan bun.lock for known-vulnerable / malicious dependencies | ||
| uses: google/osv-scanner-action/osv-scanner-action@8dc09193bb540e09b23da07ad7e30bd33bf87018 # v2.3.8 | ||
| with: | ||
| scan-args: |- | ||
| --lockfile=bun.lock | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Security Policy | ||
|
|
||
| failproofai is an npm package that installs hooks into AI coding agents (Claude | ||
| Code, Codex, and others) and runs locally in developers' environments, observing | ||
| and gating agent actions. A compromised dependency would therefore run on our | ||
| users' machines, inside their agent sessions — so we treat our supply chain as | ||
| part of our users' trust boundary. This document covers how to report a | ||
| vulnerability and how our dependency supply-chain scanning works. | ||
|
|
||
| ## Reporting a Vulnerability | ||
|
|
||
| Please report security issues privately — do **not** open a public issue. | ||
|
|
||
| - Preferred: open a [private vulnerability report](https://github.com/FailproofAI/failproofai/security/advisories/new) | ||
| via GitHub Security Advisories. | ||
| - Or email **failproofai@exosphere.host**. | ||
|
|
||
| We aim to acknowledge reports within 3 business days and will keep you updated as | ||
| we investigate and ship a fix. Please give us a reasonable window to remediate | ||
| before any public disclosure. | ||
|
|
||
| ## Supply-chain scanning | ||
|
|
||
| Every pull request — including automated Dependabot dependency bumps — is scanned | ||
| for supply-chain threats before it can merge, via two complementary layers. | ||
|
|
||
| ### 1. OSV-Scanner — the blocking CI gate | ||
|
|
||
| [`.github/workflows/osv-scanner.yml`](.github/workflows/osv-scanner.yml) runs | ||
| [OSV-Scanner](https://google.github.io/osv-scanner/) against the resolved | ||
| dependency tree (`bun.lock`). It checks every direct and transitive package | ||
| against [OSV.dev](https://osv.dev), which aggregates GitHub/npm security | ||
| advisories **and** the [OpenSSF malicious-packages feed](https://github.com/ossf/malicious-packages) | ||
| (confirmed malware: typosquats, account-takeover injections, and the like). | ||
|
|
||
| **Policy: block on any finding.** The gate fails on *any* known-vulnerable or | ||
| malicious package in the tree — not just newly introduced ones. It runs on every | ||
| PR, on pushes to `main`, and weekly (to catch advisories disclosed after a | ||
| dependency was already merged). | ||
|
|
||
| ### 2. Socket — behavioral early-warning | ||
|
|
||
| OSV-Scanner is advisory-based: it can only flag threats already cataloged. To | ||
| catch *novel* attacks (malicious install scripts, suspicious network/filesystem | ||
| access, obfuscation, sudden maintainer changes) before they reach any advisory | ||
| database, we use [Socket](https://socket.dev) via its GitHub App, which comments | ||
| on PRs that introduce risky dependency behavior. Socket is advisory (it | ||
| comments); the deterministic *blocking* gate is OSV-Scanner. | ||
|
|
||
| ## Triaging a failed scan | ||
|
|
||
| When the OSV-Scanner gate fails on a PR: | ||
|
|
||
| 1. **Prefer fixing it.** Bump the affected dependency to a patched version. For a | ||
| transitive dependency that a parent pins to a vulnerable version, add a minimal | ||
| [`overrides`](package.json) entry (as we do for `postcss`) and let CI validate | ||
| the build. | ||
| 2. **Only if there is no fix**, add a justified, time-boxed entry to | ||
| [`osv-scanner.toml`](osv-scanner.toml) (`id`, `reason`, `ignoreUntil`). Never | ||
| blanket-ignore. Re-review entries when their `ignoreUntil` date passes. | ||
|
|
||
| ## Maintainer setup (one-time) | ||
|
|
||
| These steps live outside the repo and require admin access: | ||
|
|
||
| 1. **Install the [Socket GitHub App](https://github.com/apps/socket-security)** on | ||
| the repository to enable behavioral PR comments. | ||
| 2. **Make the OSV-Scanner check required**: in branch protection for `main`, add | ||
| the OSV-Scanner job (shown as `OSV-Scanner`) as a required status check, so a | ||
| red scan blocks merge. | ||
| 3. *(Optional)* For a Socket CI gate in addition to the App, add a | ||
| `SOCKET_SECURITY_API_KEY` repository secret and the Socket CI action — deferred | ||
| until tuned, since behavioral findings can have false positives. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.