Repository navigation
feat: require a valid license JWT for all telemetry uploads - #87
Conversation
The backend no longer accepts unauthenticated telemetry. Both upload paths (event logs and transcripts) now require a valid, non-expired license JWT and always send `Authorization: Bearer <jwt>`. When no valid token is available the upload is skipped and the file is left on disk for retry (the drain batch calls ensureFreshLicense first; SessionStart and the monitor retry once a fresh license is available). Removes the previous "attach bearer if present, else POST unauthenticated" behavior (the buildHeaders/doPost(token) indirection) in transferEventLog and uploadPendingTranscript, and updates the getEndpointFromTokenAllowExpired doc: the endpoint is still readable from an aged-out token for routing, but callers now enforce a valid bearer separately. Verified: no-token → "no valid license JWT — leaving for retry", file kept, no POST; valid token → authed POST attempted (Bearer attached). Telemetry-gate golden diff unchanged; harness tests 20/20. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Disabled knowledge base sources:
WalkthroughEnforces a non-expired license JWT requirement before uploading event logs or pending transcripts in transfer.js; requests that previously used conditional/no Authorization headers now always include ChangesJWT-gated telemetry uploads
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
The backend no longer accepts unauthenticated telemetry. Both upload paths now require a valid, non-expired license JWT and always send
Authorization: Bearer <jwt>.Changes (
lib/transfer.js)transferEventLoganduploadPendingTranscript: if there is no valid (non-expired) token, logno valid license JWT — leaving for retryand skip the POST (file kept on disk). Otherwise POST with the Bearer always attached.buildHeaders/doPost(token)indirection) — there is now exactly one authed request per upload.ensureFreshLicensefirst, and SessionStart + the monitor retry once a fresh license is available, so a transient missing/expired token just defers the upload.lib/jwt.jsgetEndpointFromTokenAllowExpireddoc: the endpoint is still readable from an aged-out token for routing, but callers now enforce a valid bearer separately (no more "collector accepts unauthenticated uploads").Verification
no valid license JWT — leaving for retry, file kept, no POST issued.Authorization: Bearer(fails only on an unreachable endpoint in the test, file kept for retry).node --test skillmeter/test/harness.test.js→ 20/20.🤖 Generated with Claude Code
Summary by CodeRabbit