SK-2679: Add JSON object context support for Conditional Data Access#293
Open
samsternberg wants to merge 1 commit intomainfrom
Open
SK-2679: Add JSON object context support for Conditional Data Access#293samsternberg wants to merge 1 commit intomainfrom
samsternberg wants to merge 1 commit intomainfrom
Conversation
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging. |
The ctx claim in bearer tokens and signed data tokens previously only accepted a String, which meant structured CEL expressions like request.context.role == 'admin' could not be satisfied. Add setCtx(Map<String, Object>) overloads to BearerToken and SignedDataTokens builders so the JWT ctx claim is serialized as a nested JSON object. Also add setContext(Map) and getContextAsObject() to Credentials for use with the high-level Skyflow client. All changes are backwards compatible — existing setCtx(String) and setContext(String) APIs are unchanged. Refs SK-2679 Co-Authored-By: Claude <noreply@anthropic.com>
67c6762 to
c683024
Compare
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging. |
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
setCtx(Map<String, Object>)overloads toBearerTokenandSignedDataTokensbuilders so the JWTctxclaim can be a nested JSON object (required for Conditional Data Access CEL expressions likerequest.context.role == 'admin')setContext(Map<String, Object>)andgetContextAsObject()toCredentialsfor high-level Skyflow client usagesetCtx(String)andsetContext(String)APIs unchangedChanges
BearerToken.java,SignedDataTokens.java— widen internalctxfield toObject, addMapoverloads to buildersCredentials.java— addsetContext(Map)setter andgetContextAsObject()getter (preservesgetContext()returningString)Utils.java— dispatch context to correctsetCtxoverload based on typeValidations.java— validate emptyMapcontext same as emptyStringBearerTokenTests,SignedDataTokensTests,CredentialsTestsBearerTokenGenerationWithContextExampleandSignedTokenGenerationExamplewith Map context examplesReplaces #291 (which was created from a fork and couldn't run CI).
Test plan
mvn compile— cleanmvn test -Dtest=BearerTokenTests,SignedDataTokensTests,CredentialsTests— 51 tests, 0 failuresRefs SK-2679, DOCU-1438