security: send lock_id via X-CacheKit-Lock-Id header, not query string (#63)#65
Conversation
#63) releaseLock sent the lock capability token as ?lock_id= on the unlock DELETE. Query strings leak into access/proxy logs and OpenTelemetry http.url spans (CWE-532), allowing token replay within the lock TTL. Move the token to the X-CacheKit-Lock-Id request header (requestJson gains an optional headers arg) and drop it from the URL. SaaS dual-reads header + legacy ?lock_id= (deployed in saas 0.1.7), so this is wire-compatible with prod. Ratified in protocol spec/saas-api.md. Scope: the lock_id-header item of #63 only. The separate core 0.2.1 NAPI rebuild item remains tracked in #63.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThe PR hardens lock token security by moving authentication tokens from URL query parameters to request headers, preventing accidental exposure in logs and telemetry. It extends the request helper to accept optional headers and implements lock release via the ChangesLock token header security hardening
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Comment |
Addresses the lock_id-header item of #63.
releaseLocksent the lock capability token as?lock_id=on the unlockDELETE. Query strings leak into access/proxy logs and OpenTelemetryhttp.urlspans (CWE-532), allowing replay within the lock TTL.Change
LockableCachekitIO.releaseLocknow sends the token in theX-CacheKit-Lock-Idheader and drops it from the URL.CachekitIOCore.requestJsongains an optionalheadersarg (backward-compatible; forwards to the existing privaterequest, which already supports per-call headers).Wire compatibility
SaaS dual-reads the header + legacy
?lock_id=(prefers header), shipped in saas#140 / deployed in0.1.7. Wire-compatible with liveapi.cachekit.io. Ratified in protocolspec/saas-api.md.Tests
Added an assertion that the token rides the header and never appears in the URL (no query smuggling / log leak). 20/20 lockable tests pass;
tsc --noEmit+ eslint clean.Out of scope
The separate core 0.2.1 NAPI rebuild item of #63 is not in this PR (it's now actionable since cachekit-core 0.2.1 published — tracked separately in #63).
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests