-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(jans-cedarling): update PolicyStore parser to support agama-lab generated policies #10098
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: rmarinn <[email protected]>
- implement a `ClaimMapping` struct for the new `claim_mapping` field in the policy store - implement deserialize for the `ClaimMapping` struct Signed-off-by: rmarinn <[email protected]>
- implement `TokenEntityMetada` struct - implement `Deserialize` for `TokenEntityMetadata` Signed-off-by: rmarinn <[email protected]>
- implement new struct TrustedIssuerMetadata - implement Deserialize for TrustedIssuerMetadata Signed-off-by: rmarinn <[email protected]>
- Implement AgamaPolicyStore struct. - Implement Deserialize for AgamaPolicyStore struct. Signed-off-by: rmarinn <[email protected]>
- change the type of AgamaPolicyStore.cedar_schema from cedar_policy::Schema to CedarSchema to make it compatibale with the existsing implementation Signed-off-by: rmarinn <[email protected]>
- update the token_metadata implementation in the Cerdarling PolicyStore to support the new schema. Signed-off-by: rmarinn <[email protected]>
- remove old implementation for IdentitySource struct and related implementations. The new implementation, TrustedIssuerMetadata, has now been implementd with the main policy store. Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
DryRun Security SummaryThe provided code changes focus on improving the security and reliability of the Cedarling application, including updates to the policy store management, JWT token validation, and overall application configuration. Expand for full summarySummary: The provided code changes cover a wide range of updates to the Cedarling application, with a focus on improving the security and reliability of the policy store management, JWT token validation, and overall application configuration. The changes include:
Files Changed:
Code AnalysisWe ran Riskiness🟢 Risk threshold not exceeded. |
please don't approve merge yet, this is still a work in progress. i just made this so i could close the other PR. |
…ption Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
63bea68
to
194e776
Compare
Signed-off-by: rmarinn <[email protected]>
- Simplify YAML test files by removing the need for a top-level `policy_store` ID - Ensure YAML test files exclusively contain human-readable Cedar code; base64-encoded schemas are now only used for JSON test files. - Pending: Replace the existing implementation with the new parser. Signed-off-by: rmarinn <[email protected]>
…p instead of None Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
- split the parsing for TokenEntityMetadata into separate functions per field for easier unit-testing Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
- add test for parsing JSON into TokenEntityMetadata - add test for parsing YAML into TokenEntityMetadata Signed-off-by: rmarinn <[email protected]>
- implement parsing into default for missing fields in TrustedIssuerMetadata Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
- Refactor deserialization logic to utilize existing helper functions. Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
- rename AgamaPolicyStore to PolicySource - move PolicySouceJson into it's own file - move PolicySouceYaml into it's own file Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
…entation Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
- moved a test file to the /test_files directory Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Prepare
Description
This PR enhances the
PolicyStore
struct to support policy stores generated by the Agama Lab Policy Designer, enabling seamless loading of policies in both JSON and YAML formats.New Features:
PolicyStore::load_from_json(json_str)
to load policy stores from JSON.PolicyStore::load_from_yaml(yaml_str)
to load policy stores from YAML.Target issue
The issue addressed by this PR involves users being unable to directly use policy stores exported from Agama Lab's Policy Designer. This enhancement enables seamless integration of Agama-generated policies (see Updated JSON Policy Store Schema).
closes #10038
Implementation Details
This update introduces a revised schema for the
PolicyStore
, including updates totrusted_issuers
andTokenEntityMetadata
. The following sections provide detailed information on the changes.Updated JSON Policy Store Schema
The JSON structure has been updated to include additional fields and configurations:
Updated
trusted_issuers
schemaUpdated Token Entity Metadata schema (used for:
access_tokens
,id_tokens
,usrinfo_tokens
, andtx_tokens
).Updated YAML Policy Store Schema
For easier readability and authoring, the YAML format has been simplified:
Updated Rust Implementation
The
PolicyStore
struct and related methods have been refactored to support the new schema:Testing and Validation
Test and Document the changes
Please check the below before submitting your PR. The PR will not be merged if there are no commits that start with
docs:
to indicate documentation changes or if the below checklist is not selected.