fix: validate simulator create_key capabilities#130
Open
goanpeca wants to merge 8 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Improves B2Simulator fidelity for b2_create_key by validating requested capabilities against the SDK’s Capability set, enforcing capability-subset rules for child keys (when strictAuth is enabled), and enforcing B2’s keyName length bounds.
Changes:
- Validate
b2_create_key.capabilitiesas a knownCapability[]before storing keys, rejecting unknown capability strings. - In
strictAuthmode, reject keys whose requested capabilities exceed the creating token’s grant. - Enforce
keyNamelength bounds (1..100) and add regression tests for these behaviors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/simulator/index.ts | Adds capability and keyName validation for b2_create_key, and enforces creator-grant capability subset checks in strict auth mode. |
| src/simulator/fidelity.test.ts | Adds regression tests covering unknown capabilities, creator-grant enforcement, and keyName length bounds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
goanpeca
marked this pull request as ready for review
July 16, 2026 16:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Linked issue
Tests run
Follow-up notes