feat(shared): decouple offline anonymous access from seat cap#1349
Conversation
Offline license anonymous access was derived from `seats === undefined`, which conflated "uncapped seats" with "anonymous access allowed" — an uncapped license inadvertently enabled anonymous access. Add an explicit, signed `anonymousAccess` boolean to the offline license payload and drive `isAnonymousAccessAvailable` from it, so seat-capping and anonymous access can be set independently. Uncapped licenses no longer grant anonymous access unless `anonymousAccess: true` is set. The new field is included in the signed payload alphabetically; since `JSON.stringify` drops `undefined`, legacy keys without the field verify byte-for-byte as before. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughOffline license payloads gain an explicit ChangesOffline license
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 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)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 11: The CHANGELOG.md entry at line 11 contains two separate sentences
when it should be a single sentence per the coding guidelines. Combine the two
sentences describing the decoupling of offline-license anonymous access and the
introduction of the explicit anonymousAccess field into one cohesive sentence.
Keep the [EE] prefix at the beginning and maintain the PR link format
[`#1349`](https://github.com/sourcebot-dev/sourcebot/pull/1349) at the end of the
entry.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2bed8b16-7ead-42bb-ab99-679f007a0c75
📒 Files selected for processing (3)
CHANGELOG.mdpackages/shared/src/entitlements.test.tspackages/shared/src/entitlements.ts
Overview
Offline-license anonymous access was derived from whether
seatswas set:isAnonymousAccessAvailablereturnedtrueonly whenseats === undefined. That conflated two unrelated concepts — uncapped seats and anonymous access allowed — so the only way to issue an uncapped offline license also turned on anonymous access.This decouples them with an explicit, signed
anonymousAccessfield on the offline license payload.Changes
offlineLicensePayloadSchemagainsanonymousAccess: z.boolean().optional().dataToVerify, listed alphabetically to match the signer's canonical (sort_keys=True) JSON. BecauseJSON.stringifydropsundefined, legacy keys without the field verify byte-for-byte as before — no signature breakage.isAnonymousAccessAvailablenow returnsofflineKey.anonymousAccess === trueinstead ofseats === undefined.OfflineLicenseMetadata/getOfflineLicenseMetadataexpose the new field.getSeatCapis unchanged: uncapped is still "omitseats", now without the anonymous-access side effect.Any existing uncapped offline license that relied on
seats === undefinedfor anonymous access will lose anonymous access after this change and must be re-issued withanonymousAccess: true. This is inherent to the decoupling.Related
Requires the matching license-generator change in
sb-license-key-utils(adds a--anonymous-accessflag). Old keys are unaffected, so rollout ordering is low-risk.🤖 Generated with Claude Code
Summary by CodeRabbit