Skip to content

feat: resolve telemetry endpoint from JWT aud claim (v0.22.2) - #95

Merged
minarc merged 2 commits into
mainfrom
feat/jwt-aud-endpoint
Jul 9, 2026
Merged

minarc merged 2 commits into
mainfrom
feat/jwt-aud-endpoint

Conversation

@minarc

@minarc minarc commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Switch the tenant meter-endpoint resolution to the standard JWT aud (audience) claim instead of the custom telemetry_endpoint claim. The token's intended recipient is the tenant's meter host, so aud is the semantically correct, standards-based place for it.

Changes

  • getEndpointFromTokenAllowExpired reads aud only (string or array per RFC 7519; first http(s) URL wins). No legacy fallback.
  • Legacy telemetry_endpoint claim is ignored.
  • SKILLMETER_BACKEND_URL override unchanged; single resolution point in jwt.js (transfer.js consumers untouched).
  • Tests: aud-string / aud-array / no-aud-url / legacy-ignored.
  • Bump 0.22.1 → 0.22.2.

⚠️ Backend dependency (deploy together)

The activation Lambda must mint the meter URL into aud. It currently mints telemetry_endpoint; with this change a token lacking an aud URL resolves to null → upload is skipped and the payload stays queued (safe, no data loss). License JWTs are ~15 min TTL, so once the issuer emits aud, resolution converges quickly.

Verification

  • node --test → 55/55 pass
  • claude plugin validate skillmeter ✔

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • JWT-based endpoint detection now uses the token’s audience claim to find the service URL, including support for multiple audience values.
  • Bug Fixes
    • Improved fallback behavior when no valid URL is present, preventing endpoint lookup from returning incorrect values.
    • Updated tests to cover audience-based routing and legacy claim handling.

minarc and others added 2 commits July 9, 2026 19:43
The tenant's meter URL comes from the standard JWT `aud` (audience) claim
instead of the custom `telemetry_endpoint` claim — the token's intended
recipient is the tenant's meter host, so `aud` is the semantically correct,
standards-based place for it.

- getEndpointFromTokenAllowExpired reads `aud` only (string or array per
  RFC 7519, first http(s) URL wins); no legacy fallback
- SKILLMETER_BACKEND_URL override unchanged
- tests cover aud-string / aud-array / no-aud-url / legacy-ignored

Backend dependency: the activation Lambda must mint the meter URL into `aud`.
Since license JWTs are short-lived (~15 min), any in-flight `telemetry_endpoint`
tokens age out quickly; deploy the issuer change alongside this.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoEUHYQTz1Tx61FcteE979
Release the JWT `aud` endpoint-resolution change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoEUHYQTz1Tx61FcteE979
@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 567a9183-747c-4621-a995-7f4adade53f9

📥 Commits

Reviewing files that changed from the base of the PR and between 442a146 and a68905e.

📒 Files selected for processing (4)
  • skillmeter/.claude-plugin/plugin.json
  • skillmeter/scripts/lib/config.js
  • skillmeter/scripts/lib/jwt.js
  • skillmeter/test/lib.test.js

Walkthrough

This PR changes JWT-based telemetry endpoint resolution from reading a telemetry_endpoint claim to reading the standard aud (audience) claim, supporting both string and array forms and selecting the first http(s) URL. Related comments and tests are updated, and the plugin version is bumped.

Changes

JWT aud-based endpoint resolution

Layer / File(s) Summary
aud-based endpoint extraction logic
skillmeter/scripts/lib/jwt.js
getEndpointFromTokenAllowExpired now parses payload.aud (string or array), selects the first http(s) URL, and returns it or null, replacing the prior telemetry_endpoint string logic; header comment updated to match.
Comment update for hard-bypass claim reference
skillmeter/scripts/lib/config.js
Inline comment describing the JWT hard-bypass claim now references aud instead of telemetry_endpoint.
Tests for aud-based endpoint resolution
skillmeter/test/lib.test.js
Imports getEndpointFromTokenAllowExpired and adds tests covering string aud, array aud with first-URL selection, ignoring legacy telemetry_endpoint, and null returns.
Plugin version bump
skillmeter/.claude-plugin/plugin.json
Updates plugin manifest version from 0.22.1 to 0.22.2.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: TheStarkor

Poem

A hop, a claim, an aud so true,
No more telemetry_endpoint to chew,
First http(s) URL wins the race,
Version bumped with rabbit grace,
Tests all green, my whiskers twitch —
🐇 carrots for this endpoint switch!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: resolving the telemetry endpoint from JWT aud, and includes the version bump.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/jwt-aud-endpoint

Comment @coderabbitai help to get the list of available commands.

@minarc
minarc merged commit 27dfa59 into main Jul 9, 2026
1 check passed
@TheStarkor
TheStarkor deleted the feat/jwt-aud-endpoint branch September 21, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant