-
Notifications
You must be signed in to change notification settings - Fork 73
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
human-readable test fixtures #10006
human-readable test fixtures #10006
Conversation
…olicy_content values Signed-off-by: John Anderson <[email protected]>
…policy.json Signed-off-by: John Anderson <[email protected]>
…data in policy.json Signed-off-by: John Anderson <[email protected]>
…edar, because parsing cedar-json is currently not handled by cedar-policy crate. Signed-off-by: John Anderson <[email protected]>
…est file fixtures in yaml Signed-off-by: John Anderson <[email protected]>
DryRun Security SummaryThe pull request introduces several improvements to the Cedarling application's security and robustness, particularly in the areas of policy and schema management, including enhanced policy and schema handling, improved extensibility and maintainability, secure policy and schema definitions, and reasonable dependency management. Expand for full summarySummary: The code changes in this pull request introduce several improvements to the Cedarling application's security and robustness, particularly in the areas of policy and schema management. The key changes include:
Overall, the changes in this pull request demonstrate a thoughtful and secure approach to the Cedarling application's policy and schema management, with a focus on improving flexibility, robustness, and maintainability. As an application security engineer, I would recommend approving these changes, while continuing to monitor the project's dependencies and regularly review the security of the application's core functionality. Files Changed:
Code AnalysisWe ran Riskiness🟢 Risk threshold not exceeded. |
Error: Hi @djellemah, You did not reference an open issue in your PR. I attempted to create an issue for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me but i'm curious why you chose YAML over TOML since Cargo prefers using TOML. But honestly, i think it doesn't matter too much in the end 😅
Well, two things really:
|
Signed-off-by: John Anderson <[email protected]>
Signed-off-by: John Anderson <[email protected]>
a9ce9ce
* feat(jans-cedarling): Encoding and ContentType for cedar_schema and policy_content values Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): deserialize from schema field with metadata in policy.json Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): deserialize from policy_content field with metadata in policy.json Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): Ensure that policies are only ever encoded in cedar, because parsing cedar-json is currently not handled by cedar-policy crate. Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): for very human-readable tests, you can now do test file fixtures in yaml Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): rectify clippy complaints Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): local use for std::collections::HashSet Signed-off-by: John Anderson <[email protected]> --------- Signed-off-by: John Anderson <[email protected]>
* feat(jans-cedarling): Encoding and ContentType for cedar_schema and policy_content values Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): deserialize from schema field with metadata in policy.json Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): deserialize from policy_content field with metadata in policy.json Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): Ensure that policies are only ever encoded in cedar, because parsing cedar-json is currently not handled by cedar-policy crate. Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): for very human-readable tests, you can now do test file fixtures in yaml Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): rectify clippy complaints Signed-off-by: John Anderson <[email protected]> * feat(jans-cedarling): local use for std::collections::HashSet Signed-off-by: John Anderson <[email protected]> --------- Signed-off-by: John Anderson <[email protected]> Former-commit-id: 701bd17
Prepare
Description
There are two main goals this PR aims to achieve:
Extend the
policy-store_xxx.json
to allow for metadata forcedar_schema
andpolicy_content
fields.Provide a proof of concept for a 100% human-readable test fixture, in yaml.
Target issue
#9961
Implementation Details
policy-store_xxx.json
files, allow forcedar_schema
andpolicy_content
fields to store human-readable values, rather than only the base64-encoded values that agama lab produces. To achieve this, thepolicy-store_xxx.json
json forcedar_schema
andpolicy_content
is extended slightly with the following:encoding
can be one ofnone
orbase64
content_type
can be one ofcedar
orcedar-json
forcedar_schema
, but onlycedar
forpolicy_content
body
must contain a value that conforms with the above two.Where the value for
cedar_schema
andpolicy_content
is a plain string, it is assumed that the current convention is used:for
cedar_schema
, the value is base64 encoded, and contains the cedar-json representation of a schemafor
policy_content
, the value is base64 encoded, and contains the cedar representation of a policyserde_yml
exists, and since json is a proper subset of yaml, the last commit contains a 100% human readable test fixture containing cedar embedded in yaml.Test and Document the changes
NOTE that docs will be updated once it's been agreed that the above code changes make sense.
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.Closes #10007,