-
Notifications
You must be signed in to change notification settings - Fork 77
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
fix(cedarling): Make cedarling trusted store compatible with agama lab #10039
Conversation
DryRun Security SummaryThe pull request focuses on improving the handling and management of policy stores, including support for multiple policy stores, enhanced policy content parsing, and integration with identity sources, which are crucial for the application's security and functionality. Expand for full summarySummary: The code changes in this pull request are focused on improving the handling and management of policy stores, which are a critical component for the application's security and functionality. The key changes include:
From an application security perspective, these changes are important as they improve the flexibility, robustness, and security of the policy store management. Proper handling of policy stores and identity sources is crucial for ensuring the integrity and reliability of the application's authorization and access control mechanisms. However, it's important to ensure that the parsing and validation of the policy content and the integration with external identity sources are implemented securely to prevent potential vulnerabilities, such as improper input handling or insecure token validation. The code comments and TODO items suggest that there might be further work needed to fully address these security considerations. Files Changed:
Code AnalysisWe ran Riskiness🟢 Risk threshold not exceeded. |
917f560
to
2730057
Compare
let Ok(result_map) = | ||
serde_json::from_str::<HashMap<String, PolicyStore>>(policies_json) | ||
else { | ||
// return previous error to be unit test compatible | ||
return Err(err); | ||
}; |
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.
in Rust, it's better to use match
then if else
let result_map = match serde_json::from_str::<HashMap<String, PolicyStore>>(policies_json) {
Ok(map) => map,
Err(_) => return Err(err), // Return the original error here
};
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.
when we ignore error it is OK to use
let OK(_) = some else{
...
}
https://rust-lang.github.io/rfcs/3137-let-else.html#guide-level-explanation
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.
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.
Err(err)=>
is just more clear then else
to identify the error part
"policy_content": "cGVybWl0KAogICAgcHJp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lPckNvbW1vbiIsIm5hbWUiOiJMb25nIn0sImlzcyI6eyJ0eXBlIjoiRW50aXR5T3JDb21tb24iLCJuYW1lIjoiVHJ1c3RlZElzc3VlciJ9LCJqdGkiOnsidHlwZSI6IkVudGl0eU9yQ29tbW9uIiwibmFtZSI6IlN0cmluZyJ9LCJzdWIiOnsidHlwZSI6IkVudGl0eU9yQ29tbW9uIiwibmFtZSI6IlN0cmluZyJ9fX19LCJJc3N1ZSI6eyJzaGFwZSI6eyJ0eXBlIjoiUmVjb3JkIiwiYXR0cmlidXRlcyI6eyJjb3VudHJ5Ijp7InR5cGUiOiJFbnRpdHlPckNvbW1vbiIsIm5hbWUiOiJTdHJpbmcifSwib3JnX2lkIjp7InR5cGUiOiJFbnRpdHlPckNvbW1vbiIsIm5hbWUiOiJTdHJpbmcifX19fSwiUm9sZSI6e319LCJhY3Rpb25zIjp7IlVwZGF0ZSI6eyJhcHBsaWVzVG8iOnsicmVzb3VyY2VUeXBlcyI6WyJJc3N1ZSJdLCJwcmluY2lwYWxUeXBlcyI6WyJXb3JrbG9hZCIsIlVzZXIiLCJSb2xlIl19fX19fQ==", |
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.
It could be more human readable to put the decoded version as comment
"840da5d85403f35ea76519ed1a18a33989f855bf1cf8": { | ||
"description": "simple policy example for principal workload", | ||
"creation_date": "2024-09-20T17:22:39.996050", | ||
"policy_content": "cGVybWl0KAogICAgcHJpbmNpcGFsIGlzIEphbnM6Oldvcmtsb2FkLAogICAgYWN0aW9uIGluIFtKYW5zOjpBY3Rpb246OiJVcGRhdGUiXSwKICAgIHJlc291cmNlIGlzIEphbnM6Oklzc3VlCil3aGVuewogICAgcHJpbmNpcGFsLm9yZ19pZCA9PSByZXNvdXJjZS5vcmdfaWQKfTs=" |
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.
It could be more human readable to put the decoded version as comment
Signed-off-by: John Anderson <[email protected]>
Signed-off-by: Oleh Bohzok <[email protected]>
Signed-off-by: Oleh Bohzok <[email protected]>
Signed-off-by: Oleh Bohzok <[email protected]>
…_source` Signed-off-by: Oleh Bohzok <[email protected]>
Signed-off-by: John Anderson <[email protected]>
Signed-off-by: John Anderson <[email protected]>
Signed-off-by: John Anderson <[email protected]>
Signed-off-by: John Anderson <[email protected]>
…ity_source Signed-off-by: John Anderson <[email protected]>
2730057
to
d6a7c32
Compare
Looks like implemented in the #10036 |
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
Signed-off-by: rmarinn <[email protected]>
charts/janssen-all-in-one/README.md
Outdated
@@ -134,8 +134,8 @@ Kubernetes: `>=v1.22.0-0` | |||
| cnCouchbasePasswordFile | string | `"/etc/jans/conf/couchbase_password"` | Path to Couchbase password file | | |||
| cnCouchbaseSuperuserPasswordFile | string | `"/etc/jans/conf/couchbase_superuser_password"` | Path to Couchbase superuser password file | | |||
| cnDocumentStoreType | string | `"DB"` | Document store type to use for shibboleth files DB. | | |||
| cnGoogleApplicationCredentials | string | `"/etc/jans/conf/google-credentials.json"` | Base64 encoded service account. The sa must have roles/secretmanager.admin to use Google secrets and roles/spanner.databaseUser to use Spanner. Leave as this is a sensible default. | | |||
| cnPersistenceType | string | `"sql"` | Persistence backend to run Janssen with couchbase|hybrid|sql|spanner. | | |||
| cnGoogleApplicationCredentials | string | `"/etc/jans/conf/google-credentials.json"` | Base64 encoded service account. The sa must have roles/secretmanager.admin to use Google secrets. Leave as this is a sensible default. | |
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.
It is you change in charts/janssen-all-in-one/README.md
?
I guess not, probably exit the way to remove all changes in MR for this file..
"identity_source": { ... } | ||
} | ||
} | ||
"name": "Jans::Store", |
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.
Name only Jans
and it is defined the agama-lab
and looks like you need to revert this change...
"name": "Jans::store", | ||
"description": "a simple policy example", | ||
"policies": { | ||
"fbd921a51b...": { |
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.
Please, left only one policy. Because cedarling
support only one policy in store per file. And in agama-lab
will do the same
Closing this PR in favor of a newer one that addresses the same issue with an improved approach and cleaner git history. Please see: #10098 |
Prepare
Description
fix loading cedarling trusted issuer from agama lab
Target issue
closes #10038
Implementation Details
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.