Commit Graph
7 Commits
Author SHA1 Message Date
Tejas ChopraandClaude Opus 5.5 59b8cefc24 deps!: drop the crewai extra to remove chromadb from the lockfile (#3870)
## Description

Removes the `crewai` extra. Every CrewAI release requires `chromadb`,
which has unpatched advisories in its server, so the extra kept CrewAI,
ChromaDB and about 40 other packages in `uv.lock` and in Headroom's
Dependabot alerts. Headroom never imports ChromaDB or runs a ChromaDB
server, and the extra was never part of `[all]`, `[sandbox]` or any
image.

The extra added nothing to the integration itself: the CrewAI adapter
only wraps CrewAI tools and uses whatever CrewAI the user has installed.
Users install CrewAI alongside Headroom instead.

Closes Dependabot alerts #204, #205, #206 (chromadb) and #412, #413
(oauthlib, which came in only through ChromaDB's Kubernetes client).
Dependabot PR #3890 (oauthlib bump) becomes moot.

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

- `pyproject.toml`: remove the `crewai` extra, with a comment saying why
there is none.
- `uv.lock`: 42 packages removed (crewai, chromadb, kubernetes, lancedb,
oauthlib and their dependencies). Nothing added or upgraded.
- `SECURITY.md`: the CrewAI / ChromaDB section now states the new
boundary: Headroom does not lock CrewAI or ChromaDB, and a user who
installs CrewAI owns that exposure. It still lists the ChromaDB
advisories and server mitigations for those users.
- `.github/dependabot.yml`: drop the ChromaDB ignore range, which now
matches nothing. The Accelerate range stays.
- Installation docs and the integrations docstring now say `pip install
headroom-ai crewai`.

## Migration

`pip install "headroom-ai[crewai]"` still succeeds, but pip warns about
the unknown extra and installs Headroom without CrewAI. Replace it with:

```bash
pip install headroom-ai crewai
```

The CrewAI integration (`headroom.integrations.crewai`) is unchanged.
Without CrewAI installed it raises an `ImportError` that names the same
command.

## Testing

- [ ] Unit tests pass (`pytest`) — no code changed; the CrewAI tests
skip without CrewAI, as before
- [x] Linting passes (`ruff check .`)
- [ ] Type checking passes (`mypy headroom`) — no Python code changed
- [ ] New tests added for new functionality — not applicable
- [x] Manual testing performed

### Test Output

```text
$ uv lock --check
Resolved 250 packages
$ grep -c '^name = "crewai"\|^name = "chromadb"\|^name = "oauthlib"' uv.lock
0
$ python -c "import headroom.integrations"   # imports without CrewAI
```

## Real Behavior Proof

- Environment: local, Python 3.14, current main merged in.
- Exact command / steps: `uv lock --check`; checked that crewai,
chromadb and oauthlib are absent from `uv.lock`; imported
`headroom.integrations` without CrewAI installed.
- Observed result: lockfile consistent; the three packages are absent;
import succeeds.
- Not tested: installing CrewAI alongside Headroom in a fresh
environment.

## Runtime Rollout Safety

- Rollout-managed feature(s): none
- Minimum rollout channel: n/a
- Stable/default behavior changed: no runtime change; packaging only.
The `[crewai]` extra no longer installs CrewAI.
- Kill switch / disable path: n/a
- Unsafe override required: no
- Qualification impact: none
- Rollback path: revert this PR.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works — not applicable (packaging change)
- [x] New and existing unit tests pass locally with my changes
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

Marked breaking (`deps!:`) so release-please records the removal and the
migration note above. Addresses the review on this PR: breaking-change
classification and migration note, SECURITY.md and Dependabot updated in
the same PR, branch brought current with main.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 11:29:19 -07:00
JD Davis 04cdf79ab0 fix: stabilize release checks and consolidate dependency updates (#3531)
## Description

Consolidates the open dependency updates into one draft and fixes the
remaining release 0.38.0 test failures. Release packaging already
includes the merged Node 24 fix from #3516. The concurrency test now
proves request overlap with a barrier, and the release workflow tests
verify registry-range consistency and publication failure gating without
hard-coding obsolete dependency versions.

Updates npm, Cargo, Python, and GitHub Actions dependencies. Adds
recurring audits of all five npm lockfiles at every severity. Upgrades
CrewAI to remove its vulnerable json-repair 0.25.2 pin, and replaces
yanked chacha20 and pypdfium2 releases.

This remains a draft. All 67 hosted checks pass on 59854000c, including
CI, release dry-run, security scans, and end-to-end tests. Unpatched
optional ChromaDB/Accelerate vulnerabilities still prevent claiming that
all dependency security issues are fixed. No alerts are dismissed and no
integration is removed.

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)

## Changes Made

- Upgrade OpenAI SDK / AI SDK development dependencies, Fumadocs
Twoslash, docs TypeScript, OpenCode Vitest, grouped npm dependencies,
and the wrap CLI pin.
- Upgrade Cargo's grouped dependencies, Redis to locked 1.7.0,
tree-sitter to 0.26.12, and chacha20 to 0.10.2.
- Upgrade Ruff to 0.16.4, Sentence Transformers to locked 6.0.1, CrewAI
to >=1.15.21 / json-repair 0.60.1, and pypdfium2 to 5.13.0.
- Consolidate checkout v7 and the Rust toolchain / PyPI publishing
action updates. Use Node 24 for OpenCode's Vitest 5 checks.
- Scope TypeScript 7 exceptions to the SDK and plugins whose tsup
declaration builds still require its legacy compiler API. Docs uses
TypeScript 7 successfully. Retain the Python tree-sitter-language-pack
1.x compatibility exception documented in #1216.
- Ignore only the reviewed unpatched ChromaDB/Accelerate update ranges,
leaving later releases eligible. Document all five distinct upstream
advisories in SECURITY.md (four currently have open repository
Dependabot alerts).

## Dependabot PR disposition

The dispositions below describe what this branch will supersede after
successful validation and merge. They do not authorize closing the PRs
before then. Future releases and newly disclosed advisories must remain
eligible for updates.

| PRs | Disposition |
| --- | --- |
| #3530, #3524 | @ai-sdk/openai 4.0.60 in SDK and docs |
| #3529, #3526, #3297 | openai 7.10.0 in SDK and docs |
| #3525 | fumadocs-twoslash 4.0.0 |
| #2278 | docs TypeScript 7.0.2 |
| #3528, #3527, #2282 | Bounded TypeScript 7 exception for tsup
consumers; TypeScript 7 declaration failure reproduced |
| #3523 | Grouped npm updates included |
| #3518 | Cargo grouped updates included |
| #3515 | Superseded secure wrap tree: OpenClaw 2026.9.3, Hono 4.13.7,
tar 7.5.22 |
| #3497 | OpenCode Vitest 5.0.0 |
| #3420 | TOML 4.3.0 already present |
| #3303 | All remaining checkout actions moved to v7 |
| #3299 | PyPI publish action 1.14.2; Rust uses @stable with explicit
1.95.0 input matching rust-toolchain.toml (1.100.0 downloads return 404,
and compiler versions are no longer action refs for Dependabot to
update) |
| #3292 | Sentence Transformers <7 constraint, locked 6.0.1 |
| #3291 | Bounded language-pack 1.x exception; incompatible parser API
documented in #1216 |
| #3290 | Ruff 0.16.4 in pyproject, lockfile, and pre-commit |
| #3159 | Rust tree-sitter 0.26.12, grammar versions unchanged |
| #3148 | Redis 1.x supported and locked at 1.7.0 |

## Testing

- [x] Unit tests pass (`pytest`) for the changed/tested areas below
- [x] Manual testing performed

### Test Output

- All five npm locks audit clean; changed npm trees re-audited after
major upgrades.
- SDK: typecheck, build, 294 tests passed / 33 external integration
tests skipped.
- OpenCode: typecheck, build, 17 tests passed; both rebuilt standalone
artifacts match the committed wheel bundles.
- OpenClaw: typecheck and build passed. Wrap CLIs installed and version
checks passed.
- Docs: fresh-container npm ci, typecheck, and production build passed
with TypeScript 7 and Twoslash 4 (164 pages), excluding all generated
caches. Updated Twoslash compiler options to its native string format
after hosted CI exposed the old numeric/filename configuration.
- Rust: core check with Redis enabled passed; 14 CCR backend tests
passed against a live isolated Redis, including round-trip and TTL
tests. All 30 code-compression parity fixtures matched. Other parity
categories passed or reported their existing unavailable
comparators/models.
- Cargo audit: zero vulnerabilities and warnings under the existing
repository policy; its existing unmaintained-paste exception is
unchanged.
- Python: all 50 release workflow tests plus embedder tests passed (62
passed, 3 MPS-only skips); all 12 CrewAI integration tests passed
against dependencies exported from the revised lockfile.
- Real Sentence Transformers 6.0.1 CPU embedding produced a (2, 384)
array; PDFium 5.13.0 rendered a 100x100 page.
- PyPI vulnerability metadata checked for all 288 registry
package/version pairs in uv.lock. Only ChromaDB and Accelerate remain
affected. The production pip-audit export also passed after the final
CrewAI-related lock refresh.
- Ruff 0.16.4, actionlint, uv lock --check, Dependabot directory
uniqueness, and git diff --check passed.
- Final combined release/concurrency suite: 76 passed. Strict
workspace/all-target Rust clippy with Redis enabled passed with -D
warnings.
- Independent read-only review found no important actionable issues
before pushing e5c542f57. Hosted CI then exposed unavailable Rust
1.100.0 downloads and obsolete Twoslash compiler options; both were
corrected in 59854000c. All 67 hosted checks passed on final commit
59854000c: CI run 34506787966 and release dry-run 34506788244 both
succeeded. All four Python shards passed; shard 1 reported 3,037 passed
/ 141 skipped. The docs build, Rust tests/parity/audit, all wheel import
checks, security scans, devcontainers, and Docker/native end-to-end
checks also passed.

## Real Behavior Proof

- Environment: local Windows/Python 3.12, Linux Node 24 containers, and
isolated Redis 7 container.
- Exact command / steps: npm package scripts; cargo test --locked -p
headroom-core --features redis --test ccr_backends with
HEADROOM_TEST_REDIS_URL set; cargo run --locked -p headroom-parity --
run --fixtures tests/parity/fixtures; pytest
tests/test_release_workflows.py and relevant embedder/CrewAI tests.
- Observed result: tests and builds above pass. Temporarily serializing
the overlap test causes TimeoutError; restoring unbounded mode passes
all 26 tests in that module.
- Not performed: publication or merge. Final hosted CI and release
dry-run both passed. MPS-only and external-service SDK tests were
skipped locally.

## Runtime Rollout Safety

- Rollout-managed feature(s): no new feature flags; dependency and test
changes.
- Minimum rollout channel: existing policy unchanged.
- Stable/default behavior changed: dependency versions updated; no
integration removed.
- Kill switch / disable path: existing feature controls unchanged.
- Unsafe override required: no.
- Qualification impact: hosted release, security, and end-to-end checks
passed on final head 59854000c. Unpatched optional-extra advisories
remain a security qualification blocker.
- Rollback path: revert the applicable commits.

## Review Readiness

- [x] I have performed a self-review
- [ ] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I did **not** edit `CHANGELOG.md`

## Additional Notes

Unresolved upstream vulnerabilities: ChromaDB GHSA-f4j7-r4q5-qw2c,
GHSA-2wm9-hf6c-p5cr, GHSA-36p7-vc44-83pf, GHSA-xph7-9rjv-w5fr;
Accelerate GHSA-4j2p-28q2-5m79. Existing exposure restrictions are
mitigations, not fixes. Dependabot ignore rules cannot make these
dependencies vulnerability-free. Keep this draft open; do not merge
automatically.
2026-09-10 12:34:31 -05:00
JD Davis 4263da12b5 fix(deps): remediate vulnerable CLI and plugin dependency trees (#3521)
Updates the wrap E2E CLI and OpenCode plugin dependency trees to remove
vulnerable versions matching 194 of the 198 open Dependabot alerts
reviewed on 2026-09-10.

- Upgrade the pinned OpenClaw CLI from 2026.4.7 to 2026.9.3 and use Node
24 in its Docker harness to satisfy the new engine requirement. Its
current dependency tree removes the vulnerable legacy extraction,
image/PDF, and coding-agent dependencies and updates Hono/tar.
- Upgrade Vitest to 4.1.11 and resolve TOML to 4.3.0 in the OpenCode
plugin lockfile.
- Handle OpenClaw's explicit legacy-flag migration with its
source/capability confirmation flags, preserving terminal install-policy
failures. Run the isolated Docker gateway in the foreground on loopback
with a per-run authentication token.
- Include `/e2e/wrap/tools` in Dependabot's npm update directories.
- Document the four unresolved optional Python dependency alerts in
`SECURITY.md`, with upstream evidence and exposure mitigations. ChromaDB
has no patched release; Accelerate 1.15.0 still has the unsafe
checkpoint loader despite being outside the advisory's stated version
range. No alerts are dismissed and no supported integrations are
removed.

Validation: both npm lockfile audits report zero vulnerabilities; all
194 npm advisory ranges were checked against every installed package
path in the new locks, including an independent review. OpenCode
typecheck, build, all 17 tests, and standalone build pass; both
standalone artifacts exactly match the committed wheel bundles. The
Docker image builds and the full local Docker wrap E2E passes with the
compatibility changes mounted into the built image. All 41 Python
OpenClaw wrapper/provider tests and changed-file Ruff checks pass. CI is
green on e6d760de7b: all four main Python
test shards, optional-extras and Agno tests, package builds, wrapper
checks, CodeQL, dependency/secret scans, and Docker init/wrap/native E2E
passed.

Remaining upstream blockers: Dependabot #204, #205, #206 (ChromaDB) and
#211 (Accelerate). This PR does not claim those four are fixed. Leave
this PR open for review; do not merge automatically.
2026-09-10 09:06:44 -05:00
dependabot[bot]andJerrettDavis 6928d1932c deps: update mcp requirement from <2.0.0,>=1.28.1 to >=1.28.1,<3.0.0 (#3144)
Updates the requirements on
[mcp](https://github.com/modelcontextprotocol/python-sdk) to permit the
latest version.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/modelcontextprotocol/python-sdk/releases">mcp's
releases</a>.</em></p>
<blockquote>
<h2>v2.0.0</h2>
<h1>MCP Python SDK v2 Stable Release</h1>
<p>This is v2.0.0, the stable v2 release of the MCP Python SDK. It
supports the 2026-07-28 revision of the Model Context Protocol and
serves every earlier revision from the same server. <code>pip install
mcp</code> now installs 2.x.</p>
<pre lang="bash"><code>pip install &quot;mcp[cli]&quot;
# or
uv add &quot;mcp[cli]&quot;
</code></pre>
<h3>Documentation Rewrite</h3>
<p>The <a
href="https://py.sdk.modelcontextprotocol.io/">documentation</a> has the
full tutorial and API reference. Coming from v1? <a
href="https://py.sdk.modelcontextprotocol.io/whats-new/">What's new in
v2</a> is the tour of what changed and why, and the <a
href="https://py.sdk.modelcontextprotocol.io/migration/">migration
guide</a> lists every breaking change with before-and-after code.</p>
<h3>V1 Maintenance mode</h3>
<p><strong>v1.x is in maintenance mode and will only receive security
fixes from now on</strong> The 1.x line lives on the <a
href="https://github.com/modelcontextprotocol/python-sdk/tree/v1.x"><code>v1.x</code>
branch</a>, continues to receive critical bug fixes and security
patches, and is documented at <a
href="https://py.sdk.modelcontextprotocol.io/v1/">https://py.sdk.modelcontextprotocol.io/v1/</a>.
If your project is not ready to migrate, keep a <code>&lt;2</code> upper
bound on your requirement (for example
<code>mcp&gt;=1.28,&lt;2</code>).</p>
<h2>Highlights</h2>
<h3>One SDK, both protocol eras</h3>
<p>v2 speaks the 2026-07-28 revision (stateless requests with no
handshake, <code>server/discover</code>,
<code>subscriptions/listen</code>, multi-round-trip requests) and still
serves every 2025-era client from the same <code>MCPServer</code>, over
Streamable HTTP and stdio, with nothing to configure.
<code>Client(target)</code> negotiates the version automatically.</p>
<h3><code>FastMCP</code> is now <code>MCPServer</code>, and there is a
first-class <code>Client</code></h3>
<p>The decorator API is unchanged; the low-level <code>Server</code> is
rebuilt around a shared dispatcher engine, and one <code>Client</code>
object replaces v1's
transport-plus-<code>ClientSession</code>-plus-<code>initialize()</code>
layering. It connects to a URL, a stdio subprocess, a custom transport,
or straight to a server object in memory for tests.</p>
<h3>Multi-round-trip requests and resolver dependency injection</h3>
<p>At 2026-07-28 the server can no longer call the client, so tools
return the question instead. A <code>Resolve(fn)</code> parameter is
filled by your function invisibly to the model and can put a question to
the user; one tool body serves both eras.</p>
<h3>Extension APIs, OpenTelemetry, and a standalone types package</h3>
<p>Servers and clients compose protocol extensions through pluggable
extension APIs (MCP Apps built in); OpenTelemetry tracing ships on by
default; every protocol type is its own package, <code>mcp-types</code>
(imported as <code>mcp_types</code>), published in lock-step with
<code>mcp</code>.</p>
<h3>Hardened stdio and auth</h3>
<p>stdio servers keep handler subprocesses and stray prints off the
wire, and stdout is diverted to stderr while serving. OAuth adds RFC
9207 issuer validation, the SEP-990 identity-assertion flow, and the
client-credentials extension.</p>
<h2>Coming from a v2 pre-release</h2>
<p>Since the last release candidate: the per-version wire packages are
private (<code>mcp_types._v*</code>), <code>mcp.types</code> is a
permanent alias for <code>mcp_types</code>, the auth registration
request model is split from the registered-client record, cancelled
requests are no longer answered, and log notifications are gated on the
per-request log-level opt-in at 2026-07-28. Since the betas:
<code>Client(cache=False)</code> is now <code>cache=None</code> with
<code>CacheConfig()</code> the default; <code>Context.client_id</code>,
<code>RFC7523OAuthClientProvider</code>, and
<code>OAuthClientProvider(timeout=)</code> are removed; the
client-credentials providers take <code>scope=</code>;
<code>message_handler</code> receives notifications and exceptions only;
<code>FileResource(is_binary=)</code> becomes <code>encoding</code>;
<code>MCP_*</code> env vars are gone with
<code>pydantic-settings</code>; Streamable HTTP servers reject bodies
over 4 MiB with HTTP 413. The migration guide covers all of it.</p>
<h2>Known gaps</h2>
<p>The tasks extension (SEP-2663) is not part of this release. On the
client, the DPoP proof binding (SEP-1932) and the workload-identity
<code>jwt-bearer</code> grant are not implemented; both are additive and
can land in 2.x.</p>
<h2>Feedback</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/modelcontextprotocol/python-sdk/commit/6f69a3758ebf2ee55ce050f58b470ce11af71133"><code>6f69a37</code></a>
Present v2 as the stable release across the README, docs, and policies
(<a
href="https://redirect.github.com/modelcontextprotocol/python-sdk/issues/3178">#3178</a>)</li>
<li><a
href="https://github.com/modelcontextprotocol/python-sdk/commit/78e6fbb7e46d43069f88935e80cbea206d807e18"><code>78e6fbb</code></a>
Serve v2 docs at the site root, with permanent per-major paths (<a
href="https://redirect.github.com/modelcontextprotocol/python-sdk/issues/3176">#3176</a>)</li>
<li><a
href="https://github.com/modelcontextprotocol/python-sdk/commit/af06330a31c379d8a3ab5ffba88e0ad682aa0ed9"><code>af06330</code></a>
Remove unused StreamableHTTPTransport.get_session_id() (<a
href="https://redirect.github.com/modelcontextprotocol/python-sdk/issues/3205">#3205</a>)</li>
<li><a
href="https://github.com/modelcontextprotocol/python-sdk/commit/68ca87e20b5a999d879745332d94c7277a012492"><code>68ca87e</code></a>
Document the two-line release process for stable v2 (<a
href="https://redirect.github.com/modelcontextprotocol/python-sdk/issues/3179">#3179</a>)</li>
<li><a
href="https://github.com/modelcontextprotocol/python-sdk/commit/c9c431b71aeb48e3c4405f9d32144f8ed13fd116"><code>c9c431b</code></a>
Expose the middleware chain on MCPServer and stop sending unrequested
change ...</li>
<li><a
href="https://github.com/modelcontextprotocol/python-sdk/commit/528e36655819a686d5b07e23d70748fcecebfc0a"><code>528e366</code></a>
Fail fast on server-to-client requests in JSON-response mode instead of
hangi...</li>
<li><a
href="https://github.com/modelcontextprotocol/python-sdk/commit/27f5cc7a46bc22be525c5b0a6fce8006d6fcea08"><code>27f5cc7</code></a>
Remove unused mcpserver.exceptions.ValidationError (<a
href="https://redirect.github.com/modelcontextprotocol/python-sdk/issues/3199">#3199</a>)</li>
<li><a
href="https://github.com/modelcontextprotocol/python-sdk/commit/89c5e700f2340b4382785609e8844f384e1a8043"><code>89c5e70</code></a>
Gate log notifications on the per-request log-level opt-in at 2026-07-28
(<a
href="https://redirect.github.com/modelcontextprotocol/python-sdk/issues/3198">#3198</a>)</li>
<li><a
href="https://github.com/modelcontextprotocol/python-sdk/commit/b61ce388dd9fe3ec202a68331f218b4ed740f0fa"><code>b61ce38</code></a>
docs: fix off-by-one hl_lines in apps.md (<a
href="https://redirect.github.com/modelcontextprotocol/python-sdk/issues/3196">#3196</a>)</li>
<li><a
href="https://github.com/modelcontextprotocol/python-sdk/commit/b7c9a916d672d543917fcbd11e0dc9df2efa99c7"><code>b7c9a91</code></a>
Add mcp.types as a permanent alias for mcp_types (<a
href="https://redirect.github.com/modelcontextprotocol/python-sdk/issues/3190">#3190</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/modelcontextprotocol/python-sdk/compare/v1.28.1...v2.0.0">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-08-20 20:58:06 -05:00
Tejas Chopra 51a3b01174 feat(security): pilot hardening — stateless guarantee, model pinning, CI security gate (#1515)
## Description

Engineering hardening derived from the Box vendor security assessment.
Each change turns a "No/Partial" questionnaire answer into a genuine
"Yes" by making the product safer — not by editing the form. The
throughline is Headroom's core promise to enterprise pilots: **it runs
inside the customer's environment and never persists or leaks their
data.** These changes make that provable.

Three themes: (1) a complete **stateless write guarantee** (a stateless
proxy writes nothing to the workspace during serving), (2)
**data-at-rest** protection (no cleartext prompts written on errors),
and (3) **supply-chain integrity** (all model downloads pinned;
SCA/SAST/secret-scanning in CI).

Closes # (no tracking issue)

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [x] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

> Note: two deliberate, reversible default changes (not breaking): the
upstream-error debug dump is now off by default
(`HEADROOM_DEBUG_DUMP=1`/`=full` to opt in), and model downloads are
pinned (`HEADROOM_HF_PIN=off` to bypass). All stateless plumbing is a
pure no-op when not stateless.

## Changes Made

- **Stateless writes** — savings tracker + ledger, TOIN (`toin.json`),
and the output-savings recorder now honor stateless (in-memory only);
persistent memory is disabled under stateless with a warning. Added a
process-wide flag `headroom.paths.process_is_stateless()` (also honors
`HEADROOM_STATELESS`).
- **Debug dump** — the Anthropic *and* OpenAI handlers wrote full
requests (cleartext prompts/tools/system) to
`~/.headroom/logs/debug_400/` on every ≥400, even stateless. Now OFF by
default, stateless-aware, with a redacted middle tier; helpers extracted
to `handlers/_debug_dump.py`.
- **Model pinning** — all model downloads pin an immutable commit SHA:
our repos, kompress, image router/SigLIP, the third-party Qdrant memory
embedder (centralized in `onnx_runtime`), and the fastembed relevance
model (via the `revision` kwarg fastembed forwards to
`snapshot_download`). `HEADROOM_HF_PIN=off` bypasses.
- **CI security gate** — new `security.yml`: dependency audit
(pip-audit, scoped to the CVE-free `[all]` set), CodeQL (Python +
JS/TS), and gitleaks secret scanning (binary, MIT-licensed; PR-diff
scoped). `.gitleaks.toml` allowlists SBOM/lockfiles.
- **Dependabot** — extended to Rust (cargo) and npm (TS SDK, plugins,
docs).

## Testing

- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`)
- [x] Type checking passes (`mypy headroom`)
- [x] New tests added for new functionality
- [x] Manual testing performed

### Test Output

```text
$ ruff check <10 changed source files>
All checks passed!

$ mypy <changed source files>
Success: no issues found in 7 source files   # + handlers/server: no issues (annotation-unchecked notes only)

$ pytest tests/test_stateless_writers.py tests/test_stateless_toin.py \
    tests/test_debug_dump_gating.py tests/test_hf_revision_pinning.py \
    tests/test_proxy_savings_history.py tests/test_observability_metrics.py \
    tests/test_toin.py tests/test_paths.py -q
================= 176 passed, 6 skipped, 2 warnings in 13.92s ==================
```

New tests (18): `tests/test_stateless_writers.py`,
`tests/test_stateless_toin.py`, `tests/test_debug_dump_gating.py`,
`tests/test_hf_revision_pinning.py`, plus stateless control assertions
in `tests/test_proxy_savings_history.py`. They include the non-stateless
control cases (savings/TOIN still persist) and a regression guard that
fails if any handler writes a debug dump without gating it.

## Real Behavior Proof

- **Environment:** macOS, Python 3.12 (`.venv`); CI on `ubuntu-latest`.
- **Exact command / steps:**
- Stateless guarantee: `SavingsRecorder(tmp/"output_savings.json")` +
`set_process_stateless(True)` → `flush()`; TOIN
`ToolIntelligenceNetwork(TOINConfig(storage_path=""))`;
`create_app(ProxyConfig(memory_enabled=True, stateless=True))`.
- Debug-dump gating: `_debug_dump_mode(SimpleNamespace(stateless=...))`
across env values.
- Model pinning: model SHAs fetched/verified against the live
HuggingFace API; `_resolve_revision` / `_pinned_revision` resolvers
tested.
- **Observed result:** under stateless, no `proxy_savings.json` /
`savings_events.jsonl` / `toin.json` / `output_savings.json` /
`memory.db` is created; `proxy.memory_handler is None`. With
`stateless=False` the control tests confirm each still persists. Debug
dump resolves to `off` by default and is forced off in stateless. CI:
dependency-audit, CodeQL (python + js/ts) pass; secret-scan now runs the
gitleaks binary.
- **Not tested:** `pip-audit` was not run on the local machine (broken
`ensurepip`); CI is the first real run (the committed all-extras grype
scan is clean). The fastembed download path is exercised by CI/runtime,
not in unit tests (the revision resolver is unit-tested).

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] I have updated the CHANGELOG.md if applicable

## Additional Notes

- **Concurrency:** `stateless` is a per-process config flag, never
per-request/per-session. Many sessions share one proxy's setting; a
stateless and a stateful proxy are separate OS processes with isolated
state. The one in-process edge (two proxies, different settings —
essentially tests) fails closed to in-memory, so a stateless proxy can
never leak.
- **Memory under stateless** is *disabled* (not in-RAM): the memory
subsystem is multi-component (SQLite + vector + markdown bridge) and a
partial in-RAM mode would be risky; ephemeral containers and
cross-session learning are contradictory. An ephemeral in-RAM memory
mode is a possible follow-up.
- **Docs/CHANGELOG** left unchecked: the two new env vars
(`HEADROOM_DEBUG_DUMP`, `HEADROOM_HF_PIN`) and the stateless behavior
changes are documented in code comments; happy to add user docs + a
CHANGELOG entry if preferred.
- CI deprecation warnings (Node 20, CodeQL Action v3) are GitHub-side
and out of scope here.
2026-06-27 17:44:10 -07:00
JerrettDavisandClaude Sonnet 4.6 7d03ffeaee ci: group dependabot minor/patch updates per ecosystem
Consolidates routine minor/patch bumps into a single weekly PR per
ecosystem (docker, github-actions, pip), cutting review overhead
roughly in half. Major updates remain ungrouped so breaking changes
still get individual review.

Closes #174

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 17:54:39 -05:00
chopratejasandClaude Opus 4.6 4641e43891 Add supply chain hardening: SBOM, cosign signing, pinned digests, Dependabot
Enterprise supply chain improvements:
- publish.yml: Generate CycloneDX SBOM and attach to GitHub releases
- docker.yml: Sign all Docker images with Sigstore cosign (keyless OIDC)
- Dockerfile: Pin python:3.11-slim and distroless base images with SHA256
  digests to prevent silent upstream changes
- Add .github/dependabot.yml for automated Docker digest, GitHub Actions,
  and pip dependency update PRs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 17:28:14 -07:00