Skip to content

chore(jans-cedarling): update python example and docs #10183

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

Merged
merged 4 commits into from
Nov 19, 2024

Conversation

SafinWasi
Copy link
Contributor

Prepare


Description

Target issue

closes #10182

Implementation Details


Test and Document the changes

N/A

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.

  • I confirm that there is no impact on the docs due to the code changes in this PR.

Signed-off-by: SafinWasi <6601566+SafinWasi@users.noreply.github.com>
Signed-off-by: SafinWasi <6601566+SafinWasi@users.noreply.github.com>
Copy link

dryrunsecurity bot commented Nov 18, 2024

DryRun Security Summary

The pull request includes various updates to the Cedarling project, such as a README update, documentation improvements, and schema changes, with a focus on security-related aspects like dependency management, token handling, policy-based authorization, and data model updates.

Expand for full summary

Summary:

The code changes in this pull request cover various updates to the Cedarling project, including a README update, documentation improvements, and schema changes. While the majority of the changes do not introduce any obvious security concerns, there are a few areas that warrant closer attention from an application security perspective.

The key security-related aspects of these changes include:

  1. Dependency Management and Build Process: The changes to the cedarling_python README highlight the importance of properly managing dependencies and ensuring a secure build process to mitigate potential security vulnerabilities.

  2. Token Handling: The updates to the cedarling_python.pyi file introduce new parameters for handling ID tokens and userinfo tokens, which requires thorough validation and secure storage of these tokens to prevent security issues like token tampering or replay attacks.

  3. Policy-based Authorization: The changes to the policy store and the example usage demonstrate the application's use of a policy-based authorization framework, which is a security-focused approach. However, it's crucial to ensure that the policies are defined and implemented correctly to enforce the desired access control rules.

  4. Data Model Updates: The changes to the Cedarling schema, including the introduction of new entity types and the modification of optional fields, should be carefully reviewed to ensure that the application's authentication, authorization, and data validation mechanisms are not compromised.

Files Changed:

  1. jans-cedarling/bindings/cedarling_python/README.md: The changes in this file are minor, correcting a typo, but the overall README provides important information about dependency management, the build process, and testing, which are security-relevant aspects.

  2. docs/cedarling/python/usage.md: The updates to this documentation file demonstrate the usage of the Cedarling authorization framework, highlighting the use of a policy store and the separation of concerns between different principal types, which are positive security practices.

  3. jans-cedarling/bindings/cedarling_python/cedarling_python.pyi: The changes in this file introduce new parameters for handling ID tokens and userinfo tokens, which requires careful review and implementation of token validation and secure storage.

  4. jans-cedarling/bindings/cedarling_python/example.py: The example script showcases the integration of the Cedarling library, including the use of policy-based authorization, context-aware decision-making, and token handling, which are important security considerations.

  5. jans-cedarling/bindings/cedarling_python/example_files/policy-store.json: The updates to the policy store definitions demonstrate the application's access control mechanisms, which should be thoroughly reviewed to ensure the policies are correctly defined and implemented.

  6. jans-cedarling/schema/cedarling_core.cedarschema and jans-cedarling/schema/cedarling_core.json: The changes to the Cedarling schema, including the introduction of new entity types and the modification of optional fields, should be carefully reviewed to ensure that the application's data model and validation processes are secure.

Code Analysis

We ran 9 analyzers against 7 files and 0 analyzers had findings. 9 analyzers had no findings.

Riskiness

🟢 Risk threshold not exceeded.

View PR in the DryRun Dashboard.

nynymike
nynymike previously approved these changes Nov 18, 2024
Comment on lines +58 to +60
# show logs; only applicable to MemoryLogConfig logger
#print("Logs stored in memory:")
#print(*instance.pop_logs())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be best to simply remove the unused code.

@@ -2,7 +2,7 @@
from cedarling_python import PolicyStoreSource, PolicyStoreConfig, BootstrapConfig, JwtConfig
from cedarling_python import Cedarling
from cedarling_python import ResourceData, Request
import os
import os, time

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To have something more structured, maybe it could be better to create functions like :

  • initialize_logger()
  • load_policy_store()
  • create_request()
  • process_authorization_result()
  • ...

@mo-auto mo-auto added area-documentation Documentation needs to change as part of issue or PR comp-docs Touching folder /docs comp-jans-cedarling Touching folder /jans-cedarling kind-dependencies Pull requests that update a dependency file labels Nov 19, 2024
moabu
moabu previously approved these changes Nov 19, 2024
olehbozhok
olehbozhok previously approved these changes Nov 19, 2024
Copy link
Contributor

@olehbozhok olehbozhok left a 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

Signed-off-by: SafinWasi <6601566+SafinWasi@users.noreply.github.com>
@SafinWasi SafinWasi dismissed stale reviews from olehbozhok, moabu, and nynymike via ee9b650 November 19, 2024 16:36
@moabu moabu merged commit 9024d34 into main Nov 19, 2024
11 checks passed
@moabu moabu deleted the chore-jans-cedarling-python branch November 19, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-documentation Documentation needs to change as part of issue or PR comp-docs Touching folder /docs comp-jans-cedarling Touching folder /jans-cedarling kind-dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chore(jans-cedarling): update docs, examples and other files for python
6 participants