Skip to content

SK-2680: Add JSON object context support for Conditional Data Access#177

Open
samsternberg wants to merge 1 commit intomainfrom
feature/SK-2679-conditional-data-access-ctx-map-support
Open

SK-2680: Add JSON object context support for Conditional Data Access#177
samsternberg wants to merge 1 commit intomainfrom
feature/SK-2679-conditional-data-access-ctx-map-support

Conversation

@samsternberg
Copy link
Copy Markdown
Collaborator

@samsternberg samsternberg commented Apr 7, 2026

Summary

  • Widen Ctx on BearerTokenOptions, SignedDataTokensOptions, and Credentials.Context from string to interface{} to support map[string]interface{}
  • Add ValidateAndResolveCtx() helper with key validation (alphanumeric + underscores only) for CEL compatibility
  • Add error constants: INVALID_CTX_TYPE, INVALID_CTX_MAP_KEY, EMPTY_CONTEXT
  • Update README with string vs. map context documentation and CEL expression examples
  • Update sample code with string and map context approaches

Replaces #176 (which was created from a fork and couldn't run CI).

Test plan

  • go build ./... — clean
  • go vet ./... — clean
  • go test ./... — identical pass/fail counts vs main (no regressions)
  • End-to-end test with a Skyflow vault using a Conditional Data Access policy

Refs SK-2680, DOCU-1439

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Gitleaks Findings: No secrets detected. Safe to proceed!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

GoSec Findings: No issues found, Good to merge.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging.

@samsternberg samsternberg changed the title SK-2679: Add JSON object context support for Conditional Data Access SK-2680: Add JSON object context support for Conditional Data Access Apr 7, 2026
Widen Ctx field on BearerTokenOptions, SignedDataTokensOptions, and
Credentials.Context from string to interface{} so the JWT ctx claim
can be a map[string]interface{} (nested JSON object). This enables
Conditional Data Access CEL expressions like
request.context.role == 'admin'.

Add ValidateAndResolveCtx() helper with key validation regex for CEL
compatibility. Add error constants for invalid ctx type and keys.
Update README and samples with string and map context examples.

Refs SK-2679
Co-Authored-By: Claude <noreply@anthropic.com>
@samsternberg samsternberg force-pushed the feature/SK-2679-conditional-data-access-ctx-map-support branch from bafc7ff to ae66d8a Compare April 7, 2026 13:26
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Gitleaks Findings: No secrets detected. Safe to proceed!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

GoSec Findings: No issues found, Good to merge.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging.

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