-
Notifications
You must be signed in to change notification settings - Fork 161
feat (jans-cedarling): Support new Policy Store ZIP format #12932
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
base: main
Are you sure you want to change the base?
Conversation
…or types (#12321) * feat(jans-cedarling): policy store implement core data models and error types - Add PolicyStoreMetadata and PolicyStoreManifest with serialization - Implement PolicyStoreSource enum for directory/archive/legacy inputs - Create comprehensive error types with contextual messages - Add PolicyStoreFormat enum for format detection * refactor(jans-cedarling): update policy store metadata serialization - Simplified serialization by removing unnecessary deserializer and adding default values for optional fields. - Updated tests to use fixed timestamps for deterministic comparisons during serialization and deserialization.
…cy stores with format detection and directory support Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
* feat(jans-cedarling): add policy store loader module for loading policy stores with format detection and directory support. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): add metadata validation and parsing for policy store Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * fix(jans-cedarling): address comments from review Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): implement virtual file system (VFS) adapter for policy store loading Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): enhance error handling in policy store with new error types and improve validation tests Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jans-cedarling): improve error handling in PolicyStoreError by adding source fields for JSON, YAML, Cedar, Directory, File, and InvalidFileName errors Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jans-cedarling): enhance error handling in DefaultPolicyStoreLoader by using source fields for error reporting Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jans-cedarling): enhance VFS trait by adding open_file method for improved file reading Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> Signed-off-by: Haileyesus Ayanaw <85413826+haileyesus2433@users.noreply.github.com>
…emplate parsing (#12413) * feat(jans-cedarling): add policy parser module for Cedar policy and template parsing Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): fix comments Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_parser): remove redundant notes on template ID generation and policy parsing Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(loader): simplify method signatures by removing unnecessary self parameter Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(tests): simplify usage of DefaultPolicyStoreLoader by introducing PhysicalLoader type alias Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
* feat(jans-cedarling): add CedarSchemaError to PolicyStoreError for improved error handling Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): implement Cedar schema parser for validation and extraction Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): add schema parsing and validation methods to policy store loader Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jans-cedarling): streamline schema parsing and validation in policy store Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): enhance Cedar schema error handling with specific error types Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…12464) * feat(jans-cedarling): add CedarSchemaError to PolicyStoreError for improved error handling Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): implement Cedar schema parser for validation and extraction Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): add schema parsing and validation methods to policy store loader Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jans-cedarling): streamline schema parsing and validation in policy store Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): enhance Cedar schema error handling with specific error types Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): introduce CedarEntityErrorType for enhanced entity error handling Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): add entity parser for Cedar entity files Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): update policy store to include entity parser and enhance error exports Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): add end-to-end tests for loading and parsing entities in policy store Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(entity_parser): enhance entity parsing with optional schema validation Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(entity_parser): fix comments Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> Signed-off-by: Haileyesus Ayanaw <85413826+haileyesus2433@users.noreply.github.com>
…figuration (#12533) * feat(jans-cedarling): add issuer parser module for trusted issuer configuration Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * fix(policy_store): pass optional schema to entity parser for improved parsing accuracy Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(policy_store): introduce TrustedIssuerErrorType for enhanced error handling in issuer parsing Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…gainst trusted issuers (#12584) * feat(jans-cedarling): add TrustedIssuerValidator for JWT validation against trusted issuers Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): fix comments by enhancing TrustedIssuerValidator with JWKS caching and validation improvements - Introduced caching for JWKS keys with configurable durations to optimize performance. - Added reverse lookup for OIDC base URLs to streamline issuer matching. - Updated token validation method to preload JWKS and validate expiration claims. - Improved logging for JWKS key loading and cache duration monitoring. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…arling-12253 Signed-off-by: Oleh Bozhok <6554798+olehbozhok@users.noreply.github.com>
…12682) * feat(jans-cedarling): add ManifestErrorType for manifest validation errors Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): add manifest validator for policy store integrity validation Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): implement manifest validation for PhysicalVfs in policy store loader - Added a method to validate the manifest file against the policy store contents specifically for PhysicalVfs. - Introduced logging for unlisted files found in the policy store but not listed in the manifest. - Updated the policy store loader to call the manifest validation during the loading process if a manifest is present. This enhancement improves the integrity checks of the policy store by ensuring that the manifest accurately reflects the contents of the store. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * fix(jans-cedarling): comments by streamlining manifest validation in policy store loader Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * chore(jans-cedarling): add dependencies in cargo Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): enhance manifest validation in policy store loader - Introduced a new method `validate_manifest` for validating the manifest file against the policy store contents, specifically for the PhysicalVfs implementation. - Updated the `load_directory` method to conditionally call `validate_manifest` based on the VFS type, ensuring that manifest validation is only performed for PhysicalVfs. This change adheres to the Interface Segregation Principle by limiting manifest validation to appropriate VFS types. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): add archive handling utilities for .cjar policy store Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): expose archive_handler module and re-export ArchiveHandler Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): implement archive loading support for .cjar files Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): enhance ArchiveError enum with detailed error variants for better error handling Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): refactor archive handling to use ArchiveVfs for improved VFS implementation and security Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): enhance policy store loader with ArchiveVfs support and recursive loading of .cedar files Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(policy_store): enhance ArchiveVfs and PolicyStoreSource for improved WASM support - Refactor ArchiveVfs to support both file paths and in-memory buffers. - Update PolicyStoreSource to use ArchiveSource enum for better handling of local and remote archives. - Modify error handling for WASM compatibility, ensuring proper usage of ArchiveVfs in both native and WASM environments. - Update documentation and examples to reflect changes in archive loading methods. This update improves the flexibility and security of the policy store loading mechanism. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): simplify format detection in PolicyStoreLoader - Removed the internal `detect_format_internal` function and integrated its logic directly into the `detect_format` method for clarity. - Updated tests to use pattern matching for better readability and maintainability. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> Co-authored-by: Oleh Bozhok <6554798+olehbozhok@users.noreply.github.com>
…12649) * feat(jans-cedarling): add ManifestErrorType for manifest validation errors Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): add manifest validator for policy store integrity validation Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): implement manifest validation for PhysicalVfs in policy store loader - Added a method to validate the manifest file against the policy store contents specifically for PhysicalVfs. - Introduced logging for unlisted files found in the policy store but not listed in the manifest. - Updated the policy store loader to call the manifest validation during the loading process if a manifest is present. This enhancement improves the integrity checks of the policy store by ensuring that the manifest accurately reflects the contents of the store. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * fix(jans-cedarling): comments by streamlining manifest validation in policy store loader Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * chore(jans-cedarling): add dependencies in cargo Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): enhance manifest validation in policy store loader - Introduced a new method `validate_manifest` for validating the manifest file against the policy store contents, specifically for the PhysicalVfs implementation. - Updated the `load_directory` method to conditionally call `validate_manifest` based on the VFS type, ensuring that manifest validation is only performed for PhysicalVfs. This change adheres to the Interface Segregation Principle by limiting manifest validation to appropriate VFS types. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> Signed-off-by: Haileyesus Ayanaw <85413826+haileyesus2433@users.noreply.github.com>
…darling Architecture (#12819) * feat(policy_store): Introduce PolicyStoreManager for converting between new and legacy formats - Added a new module `manager.rs` that implements `PolicyStoreManager`, responsible for converting `LoadedPolicyStore` (new format) to `PolicyStore` (legacy format). - Implemented methods for converting schemas, policies, trusted issuers, and entities, along with error handling for conversion failures. - Enhanced `PoliciesContainer` with new constructors for creating instances from policy sets and descriptions. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(policy_store): Add support for Cedar Archive (.cjar) files and directory structures in PolicyStoreSource Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(policy_store): Implement loading policy stores from Cedar Archive (.cjar) files and directories Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(policy_store): Refactor loading functions to use VFS-agnostic approach and include metadata Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(logging): Enhance logging of policy store metadata and compatibility checks Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(policy_store): Add UnsupportedFormat error type for policy store operations Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Simplify error handling and improve documentation for loading policy stores Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(policy_store): Enhance PolicyStoreManager and ManifestValidator with improved error handling, logging, and new utility functions for better policy and template processing Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Simplify validation logic and error handling in MetadataValidator and VfsFileSystem Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(service_factory): Add method to retrieve policy store metadata for enhanced policy management Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jwt): Integrate TrustedIssuerValidator for enhanced JWT validation and re-export validation functions Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(manifest_validator): Remove unused test helper for creating virtual file system Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(test_utils): Add PolicyStoreTestBuilder and fixtures for policy store testing Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(security_tests): Add comprehensive security tests for policy store validation and loading Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(mock_jwks_server): Implement mock JWKS server for trusted issuer validation testing Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(benchmarks): Add policy store benchmark for loading and validation performance Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store_benchmark): Reorder import statements for clarity Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * fix: Update CURRENT_CEDAR_VERSION to 4.3.2 for compatibility check Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * fix(policy_store_config): Set default paths for cjar_file, cjar_url, and directory sources Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * fix(policy_store_manager): Update policy description format to include filename Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * fix(mock_jwks_server): Use unwrap_or_default for safer time duration handling Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * fix(security_tests): Improve error handling and assertions in path traversal and malicious archive tests Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(test_utils): Adjust file handling order and remove unused memory measurement function Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(HttpClient): Simplify GET request logic by extracting retry handling into a private method Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Remove unused LoaderSource instantiation in load_policy_store functions Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(validation): Add error handling for invalid token metadata configuration and trusted issuer validation Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jwt): Change trusted issuer validator to use Arc<RwLock> for improved concurrency Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(validator): Improve validation logic and update compatibility check to use semver::Version Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(benchmarks): Optimize file size calculation in archive parsing benchmarks Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Simplify error handling in issuer validation by returning joined error messages Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(manager): document why we clone parsed entities Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(log_entry): add PolicyStoreLogEntry for logging policy store operations Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Enhance logging and error handling in entity parsing and policy store conversion Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Remove unused imports in load_policy_store functions Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Update loading functions to improve clarity and support for directory and archive sources Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(log_entry): remove unused debug-level log entry creation method Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(mock_jwks_server): replace SystemTime with chrono for better WASM compatibility Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(test_utils): replace SystemTime with chrono for improved time handling refactor(trusted_issuer_validator): switch from SystemTime to chrono for timestamp management Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(http): update retry logic to handle errors silently in HttpClient and Sender Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(test): clarify retry logic behavior in get_bytes tests Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Enhance error handling and validation messages in policy store components - Updated `PolicyStoreError` and `ValidationError` enums to improve clarity and specificity of error messages. - Introduced `CedarParseErrorDetail` for detailed Cedar parsing errors. - Refactored error handling in `PolicyParser`, `MetadataValidator`, and `PolicyStoreLoader` to utilize new error structures. - Adjusted tests to reflect changes in error handling and validation logic. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Introduce constant for maximum description length and enhance validation error reporting Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Move tests from loader.rs to a dedicated loader_tests.rs file Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(tests): Simplify entity parsing tests by using expect for error handling Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Clean up and optimize policy store components - Removed dead code and unnecessary comments across various modules. - Enhanced error handling in tests to use `expect_err` for clarity. - Simplified the structure of `MockJwksServer` and related test utilities. - Updated JWT-related modules to remove unused functions and improve readability. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(log): Change visibility of logging-related structs to public to fix clippy warnings Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(tests): Simplify test code by removing unnecessary conversions and improving assertions - Removed unnecessary `.into()` calls in test cases for cleaner code. - Updated assertions to use more direct checks for empty collections. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * fix(policy_store): Update example code in documentation for clarity and fix failing doc tests Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(tests): Enhance error handling in policy store tests - Updated test assertions to use `expect_err` for clearer error reporting. - Improved error messages to provide more context on expected failures. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jwt_config): Updated comments to clarify the use of eprintln! for logging in the absence of a logger and add a TODO Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Remove unused error variants and clean up error handling Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(tests): Ensured that the loader gracefully handles both successful and failed policy loads, verifying expected error types. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Update internal documentation to clarify usage and examples Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(tests): Improve error assertions in policy store tests for clarity and specificity Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(tests): Standardize error handling in policy store tests with clearer expectations using .expect Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(tests): Simplify and clarify error handling in policy store tests - Replaced match statements with .expect for clearer expectations in tests for deeply nested paths and long filenames. - Updated assertions to ensure successful loading of policies with special-character @id. - Enhanced comments for better understanding of expected behavior during manifest validation. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(security_test): rename file to archive_security_test Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(app_types): Remove default implementation for PdpID struct Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Remove unused namespace extraction logic from SchemaParser - Eliminated the extract_namespaces function and its associated tests to streamline the schema parsing process. - Updated error handling in schema parsing to remove unnecessary namespace reporting. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jwt_validation): Remove unused error variants from ValidateJwtError enum Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Clean up policy store structure and tests - Removed the unused `source.rs` file and its associated logic. - Updated tests to use `load_directory` instead of the deprecated `load` method for better clarity and consistency. - Renamed and reorganized test cases to improve readability and maintainability. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Remove unused mock JWKS server module - Deleted the `mock_jwks_server.rs` file as it was no longer needed. - Updated `policy_store.rs` to remove references to the deleted module. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_parser): Remove unnecessary whitespace in ParsedPolicy struct Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Add TODO for potential removal of RawPolicy struct Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(logging): Extract policy store metadata logging into a separate function Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jwt_validation): remove notes from trusted issuer validator documentation Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jwt_validation): remove return documentation from validate_required_claims function Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jwt_service): replace Arc<RwLock<TrustedIssuerValidator>> with TrustedIssuerValidator for improved performance and simplicity Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(http_utils): add TODO for debug-level logging in retry mechanism Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(clippy): temporarily allow std::eprintln/std::eprint for bootstrap process Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): Simplify policy and template parsing by using direct imports from policy_parser Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): fix wasm errors by pdating error handling in load_policy_store_archive function Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): remove internal examples and documentation from policy store modules Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(logging): change logger structs to crate visibility Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(jwt_service): enhance comments for clarity on required claims validation process Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): improve error handling in manifest validation for invalid checksum format Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * test(policy_store): check that the data parsed correctly nested files in archive Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): add WASM-specific error handling for unsupported archive operations Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * chore(policy_store): remove empty lines Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * chore(jans-cedarling): fix needless borrow Signed-off-by: Oleh Bozhok <6554798+olehbozhok@users.noreply.github.com> * chore(jans-cedarling): fix clippy issues related to `pub(crate)` Signed-off-by: Oleh Bozhok <6554798+olehbozhok@users.noreply.github.com> * refactor(policy_store): enhance directory loading with manifest validation for PhysicalVfs (#12860) * refactor(policy_store): enhance directory loading with manifest validation for PhysicalVfs Updated the policy store directory loading function to utilize a PhysicalVfs-specific loader and added manifest validation when a manifest is present. This change improves the clarity of the loading process and ensures that manifest validation is only performed where appropriate. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(policy_store): offload blocking I/O operations in policy store loading Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * test(policy_store): improve test for handling invalid checksum format in manifest Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> Signed-off-by: Oleh Bozhok <6554798+olehbozhok@users.noreply.github.com> Co-authored-by: Oleh Bozhok <6554798+olehbozhok@users.noreply.github.com>
* feat(tests): Add integration tests for policy store loader - Introduced a new test module `policy_store_loader.rs` to validate the functionality of the policy store loader. - Implemented tests for loading policy stores from both directory structures and Cedar Archive (.cjar) files, ensuring correct authorization behavior. - Added manifest validation tests to check for checksum mismatches and policy store ID mismatches. - Enhanced existing test utilities to support the new loader functionality. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * chore(test): remove allow(dead_code) in policy store loader test Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(tests): add JWT authorization tests with directory-based policy store Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * refactor(tests): replace manual configuration setup with a utility function get_config Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(tests): enhance JWT authorization tests with tampered token validation Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…format (#12903) * feat(cedarling_wasm): Add init_from_archive_bytes function for loading Cedar Archive (.cjar) files Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs: Enhance policy store documentation with new directory-based format details Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs: update tutorials to include policy store source types and examples for Go, Java, JavaScript, Python, and Rust bindings Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs: enhance README files with detailed policy store sources and formats for Java, Go, Python, Uniffi, and WASM bindings - Added sections on policy store sources, including legacy single-file formats, new directory-based formats, and Cedar Archive (.cjar) formats. - Updated examples for loading policy stores in various programming languages. - Clarified the limitations and supported options for WASM environments. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * chore(schema): update policy store schema to include new directory-based format details Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs(jans-cedarling): add language identifier to fenced code blocks Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs(jans-cedarling): convert bold text to proper heading and add aditional line Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs(jans-cedarling): Removed unnecessary whitespace and improved formatting for clarity. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs(jans-cedarling): Clarify local policy store file path description in documentation Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs(jans-cedarling): Update WASM environment notes for policy store sources Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs(jans-cedarling): Updated policy store sources sections to reference Cedarling Properties for configuration options. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs(jans-cedarling): Added a reference link to the Cedarling policy store documentation for clarity. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * chore(jans-cedarling): remove comment in `policy_store_schema.json` Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs: remove trailing asteriks Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * chore(jans-cedarling): simplify policy store schema description and remove directory-based format definitions Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs(jans-cedarling): Update documentation to clarify loading from Cedar archives and improve consistency across tutorials Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * feat(jans-cedarling): Updated logic to detect and handle .cjar files when loading policy stores from URIs. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> * docs(jans-cedarling): updated documentation on policy store formats and automatic detection for local and remote sources. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> --------- Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📝 WalkthroughWalkthroughAdds first-class support for a directory-based and ZIP-backed (.cjar) Cedar policy store: new VFS and archive handling, directory/archive/bytes loaders (including WASM entrypoint), metadata/manifest/schema/policy/entity/issuer parsing and validation, conversion to legacy format, JWT trusted‑issuer validation, docs, tests, and benchmarks. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Pre-merge checks✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: Haileyesus Ayanaw <85413826+haileyesus2433@users.noreply.github.com>
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.
Actionable comments posted: 49
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
jans-cedarling/http_utils/src/lib.rs (1)
86-109: Preserve error context for debugging.While silent retries avoid WASM console issues, completely discarding error information (
_err) makes debugging production failures nearly impossible. When all retries are exhausted, callers receive onlyMaxRetriesExceededwith no indication of what actually failed (network timeout, 404, 503, etc.).Per coding guidelines: "Include context in error messages for better debugging."
🔎 Proposed fix: Enhance error to preserve last failure
Modify the error enum to capture the underlying cause:
#[derive(Debug, Error)] pub enum HttpRequestError { - #[error("max retries exceeded")] - MaxRetriesExceeded, + #[error("max retries exceeded, last error: {0}")] + MaxRetriesExceeded(String), #[error("failed to deserialize response to JSON: {0}")] DeserializeToJson(#[source] reqwest::Error), #[error("failed to initialize HTTP client: {0}")] InitializeHttpClient(#[source] reqwest::Error), }Then track the last error in the retry loop:
let backoff = &mut self.backoff; backoff.reset(); + let mut last_error: Option<String> = None; loop { let response = match request().send().await { Ok(resp) => resp, - Err(_err) => { + Err(err) => { + last_error = Some(err.to_string()); // Retry silently - callers receive the final error if all retries fail. // TODO: add optional debug-level logging hook here once a logger can be // passed in without pulling logging into this low-level crate. backoff .snooze() .await - .map_err(|_| HttpRequestError::MaxRetriesExceeded)?; + .map_err(|_| HttpRequestError::MaxRetriesExceeded( + last_error.clone().unwrap_or_else(|| "unknown error".to_string()) + ))?; continue; }, }; let response = match response.error_for_status() { Ok(resp) => resp, - Err(_err) => { + Err(err) => { + last_error = Some(format!("HTTP {}: {}", + err.status().map(|s| s.as_str()).unwrap_or("unknown"), + err)); // Retry silently - callers receive the final error if all retries fail. // TODO: add optional debug-level logging hook here once a logger can be // passed in without pulling logging into this low-level crate. backoff .snooze() .await - .map_err(|_| HttpRequestError::MaxRetriesExceeded)?; + .map_err(|_| HttpRequestError::MaxRetriesExceeded( + last_error.clone().unwrap_or_else(|| "unknown error".to_string()) + ))?; continue; }, };jans-cedarling/cedarling/src/lock/mod.rs (1)
95-110: Reorder imports to comply with coding guidelines.The imports should be grouped with std/external crates first, then internal modules. Currently, internal and external imports are mixed.
🔎 Proposed fix to reorder imports
-use crate::app_types::PdpID; -use crate::common::issuer_utils::normalize_issuer; -use crate::log::LoggerWeak; -use crate::log::interface::Loggable; -use crate::{LockServiceConfig, LogWriter}; use futures::channel::mpsc; -use lock_config::*; -use log_entry::LockLogEntry; -use log_worker::*; -use register_client::{ClientRegistrationError, register_client}; use reqwest::Client; use reqwest::header::{HeaderMap, HeaderValue}; -use ssa_validation::validate_ssa_jwt; use std::sync::{Arc, RwLock}; use std::time::Duration; use tokio_util::sync::CancellationToken; + +use crate::app_types::PdpID; +use crate::common::issuer_utils::normalize_issuer; +use crate::log::interface::Loggable; +use crate::log::LoggerWeak; +use crate::{LockServiceConfig, LogWriter}; +use lock_config::*; +use log_entry::LockLogEntry; +use log_worker::*; +use register_client::{ClientRegistrationError, register_client}; +use ssa_validation::validate_ssa_jwt;Based on coding guidelines: "Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"".
jans-cedarling/cedarling/src/log/log_strategy.rs (2)
37-60: Consider documenting the visibility restriction rationale.The
newconstructor's visibility was changed topub(crate), restricting direct construction to within the crate. While this aligns with the controlled API pattern (public type, private constructors), adding a doc comment explaining thatLogStrategyinstances should be obtained vialog::init_loggerwould improve API clarity for maintainers.📝 Suggested documentation addition
impl LogStrategy { - /// Creates a new `LogStrategy` based on the provided configuration. - /// Initializes the corresponding logger accordingly. + /// Creates a new `LogStrategy` based on the provided configuration. + /// Initializes the corresponding logger accordingly. + /// + /// Note: This constructor is crate-private. External users should obtain + /// `LogStrategy` instances via `log::init_logger`. pub(crate) fn new(
62-74: Add documentation for the newlock_serviceparameter.The
new_with_loggerconstructor gained alock_service: Option<LockService>parameter but lacks documentation explaining its purpose. Add a doc comment describing when to provide aLockServiceduring initialization versus setting it later viaset_lock_service.📝 Suggested documentation addition
+ /// Creates a new `LogStrategy` with a pre-configured logger. + /// + /// # Parameters + /// - `logger`: The logger implementation to use + /// - `pdp_id`: Policy Decision Point identifier + /// - `app_name`: Optional application name + /// - `lock_service`: Optional lock service for distributed logging coordination pub(crate) fn new_with_logger( logger: LogStrategyLogger, pdp_id: PdpID, app_name: Option<ApplicationName>, lock_service: Option<LockService>, ) -> Self {jans-cedarling/bindings/cedarling_wasm/README.md (1)
332-334: Remove empty code blocks at the end of the file.The file ends with empty fenced code blocks that serve no purpose and trigger linting warnings.
🔎 Proposed fix
-For complete configuration documentation, see [cedarling-properties.md](../../../docs/cedarling/cedarling-properties.md) or on [our page](https://docs.jans.io/stable/cedarling/cedarling-properties/) . - -``` - -``` +For complete configuration documentation, see [cedarling-properties.md](../../../docs/cedarling/cedarling-properties.md) or on [our page](https://docs.jans.io/stable/cedarling/cedarling-properties/).docs/cedarling/tutorials/java.md (1)
203-222: JavaScript syntax in Java documentation.The principals definition contains JavaScript syntax (
const principals = [...]) instead of valid Java:🔎 Proposed fix
String principals = """ - const principals = [ + [ { "cedar_entity_mapping": { "entity_type": "Jans::Workload", "id": "some_workload_id" }, - "client_id": "some_client_id", + "client_id": "some_client_id" }, { "cedar_entity_mapping": { "entity_type": "Jans::User", "id": "random_user_id" }, "roles": ["admin", "manager"] - }, - ]; + } + ] """;
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (59)
docs/cedarling/reference/cedarling-policy-store.mddocs/cedarling/reference/cedarling-properties.mddocs/cedarling/tutorials/go.mddocs/cedarling/tutorials/java.mddocs/cedarling/tutorials/javascript.mddocs/cedarling/tutorials/python.mddocs/cedarling/tutorials/rust.mdjans-cedarling/bindings/cedarling-java/README.mdjans-cedarling/bindings/cedarling_go/README.mdjans-cedarling/bindings/cedarling_python/PYTHON_TYPES.mdjans-cedarling/bindings/cedarling_python/README.mdjans-cedarling/bindings/cedarling_uniffi/README.mdjans-cedarling/bindings/cedarling_wasm/README.mdjans-cedarling/bindings/cedarling_wasm/example_data.jsjans-cedarling/bindings/cedarling_wasm/src/lib.rsjans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/authz/trust_mode.rsjans-cedarling/cedarling/src/bootstrap_config/decode.rsjans-cedarling/cedarling/src/bootstrap_config/jwt_config.rsjans-cedarling/cedarling/src/bootstrap_config/policy_store_config.rsjans-cedarling/cedarling/src/common/app_types.rsjans-cedarling/cedarling/src/common/policy_store.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rsjans-cedarling/cedarling/src/common/policy_store/entity_parser.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/metadata.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/schema_parser.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/common/policy_store/validator.rsjans-cedarling/cedarling/src/common/policy_store/vfs_adapter.rsjans-cedarling/cedarling/src/http/mod.rsjans-cedarling/cedarling/src/init/policy_store.rsjans-cedarling/cedarling/src/init/service_factory.rsjans-cedarling/cedarling/src/jwt/mod.rsjans-cedarling/cedarling/src/jwt/test_utils.rsjans-cedarling/cedarling/src/jwt/validation.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/jwt/validation/validator.rsjans-cedarling/cedarling/src/lib.rsjans-cedarling/cedarling/src/lock/mod.rsjans-cedarling/cedarling/src/log/log_strategy.rsjans-cedarling/cedarling/src/log/mod.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rsjans-cedarling/cedarling/src/tests/mod.rsjans-cedarling/cedarling/src/tests/policy_store_loader.rsjans-cedarling/clippy.tomljans-cedarling/http_utils/src/lib.rsjans-cedarling/schema/policy_store_schema.json
🧰 Additional context used
📓 Path-based instructions (3)
jans-cedarling/**/*.rs
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
jans-cedarling/**/*.rs: Check formatting compliance withcargo fmt --checkand follow rustfmt settings in rustfmt.toml
Review clippy.toml for project-specific lint rules
Use rustfmt with project's rustfmt.toml settings for all Rust code
Enforce maximum line width of 100 characters in Rust code
Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Use 4-space indentation (no tabs) in all Rust code
Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Follow existing import patterns in the codebase
Use snake_case for variables, functions, and modules in Rust
Use PascalCase for types, traits, and enums in Rust
Use SCREAMING_SNAKE_CASE for constants in Rust
Follow Rust naming conventions as established by the language
Use thiserror crate for custom error types
Prefer Result<T, E> over panics for error handling
Use derive_more crate for error derivation when needed
Include context in error messages for better debugging
Use typed-builder crate for complex struct construction
Leverage serde for serialization/deserialization in Rust
Use smol_str for string optimization where appropriate in Rust
Prefer strong typing over stringly-typed APIs in Rust
Use standard Rust docstrings without Python-style sections (avoid# Arguments,# Returns)
Document public API items with docstrings focusing on 'why' not 'what'
Include examples in docstrings for complex functionality
Keep documentation concise, focusing on explanatory content rather than obvious details
Each Rust file must contain the Apache 2.0 license header with copyright attribution to Gluu, Inc.
Files:
jans-cedarling/cedarling/src/lock/mod.rsjans-cedarling/cedarling/src/jwt/validation/validator.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/init/service_factory.rsjans-cedarling/cedarling/src/tests/policy_store_loader.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/bindings/cedarling_wasm/src/lib.rsjans-cedarling/cedarling/src/log/log_strategy.rsjans-cedarling/cedarling/src/bootstrap_config/jwt_config.rsjans-cedarling/cedarling/src/init/policy_store.rsjans-cedarling/cedarling/src/jwt/test_utils.rsjans-cedarling/cedarling/src/common/policy_store/schema_parser.rsjans-cedarling/cedarling/src/common/policy_store/validator.rsjans-cedarling/cedarling/src/log/mod.rsjans-cedarling/cedarling/src/bootstrap_config/policy_store_config.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/lib.rsjans-cedarling/cedarling/src/http/mod.rsjans-cedarling/cedarling/src/jwt/validation.rsjans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/http_utils/src/lib.rsjans-cedarling/cedarling/src/common/policy_store/entity_parser.rsjans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/common/app_types.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/jwt/mod.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/common/policy_store/vfs_adapter.rsjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rsjans-cedarling/cedarling/src/bootstrap_config/decode.rsjans-cedarling/cedarling/src/common/policy_store.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rsjans-cedarling/cedarling/src/common/policy_store/metadata.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/authz/trust_mode.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/tests/mod.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs
jans-cedarling/**/*test*.rs
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
jans-cedarling/**/*test*.rs: Use test_utils crate for shared test helpers
Include both positive and negative test cases in test files
For error checking in tests, useassert!(matches!(...), "explicit comment")instead ofassert!(result.is_err())
Useexpect_err("explicit comment")instead ofpanic()in tests
Always include explicit comments explaining what error is expected in test assertions
Files:
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/jwt/test_utils.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rs
jans-cedarling/**/Cargo.toml
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
Build all workspace members using
cargo build --workspace
Files:
jans-cedarling/cedarling/Cargo.toml
🧠 Learnings (47)
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use PascalCase for types, traits, and enums in Rust
Applied to files:
jans-cedarling/cedarling/src/lock/mod.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/bootstrap_config/jwt_config.rsjans-cedarling/cedarling/src/common/policy_store/schema_parser.rsjans-cedarling/cedarling/src/bootstrap_config/policy_store_config.rsjans-cedarling/cedarling/src/lib.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/app_types.rsjans-cedarling/cedarling/src/authz/trust_mode.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Applied to files:
jans-cedarling/cedarling/src/lock/mod.rsjans-cedarling/cedarling/src/init/policy_store.rsjans-cedarling/cedarling/src/common/policy_store/schema_parser.rsjans-cedarling/cedarling/src/bootstrap_config/policy_store_config.rsjans-cedarling/cedarling/src/lib.rsjans-cedarling/cedarling/src/jwt/validation.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/app_types.rsjans-cedarling/cedarling/src/common/policy_store/vfs_adapter.rsjans-cedarling/cedarling/src/common/policy_store.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/tests/mod.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Prefer strong typing over stringly-typed APIs in Rust
Applied to files:
jans-cedarling/cedarling/src/lock/mod.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/bootstrap_config/jwt_config.rsjans-cedarling/cedarling/src/common/policy_store/metadata.rsjans-cedarling/cedarling/src/authz/trust_mode.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow Rust naming conventions as established by the language
Applied to files:
jans-cedarling/cedarling/src/lock/mod.rsjans-cedarling/cedarling/src/common/policy_store/schema_parser.rsjans-cedarling/cedarling/src/bootstrap_config/policy_store_config.rsjans-cedarling/cedarling/src/lib.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsdocs/cedarling/tutorials/javascript.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use snake_case for variables, functions, and modules in Rust
Applied to files:
jans-cedarling/cedarling/src/lock/mod.rsjans-cedarling/cedarling/src/lib.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/tests/mod.rs
📚 Learning: 2025-12-10T14:10:48.131Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12819
File: jans-cedarling/cedarling/src/common/policy_store/manager.rs:101-107
Timestamp: 2025-12-10T14:10:48.131Z
Learning: In all Rust source files under the jans-cedarling directory, avoid using println! or eprintln! because they do not work in WASM builds. Use the provided Logger API, e.g. logger.log(&System::log_msg(...)) to log messages. Ensure the logger is properly initialized in the WASM context and replace direct prints with the logger pattern in relevant code paths (especially in WASM targets).
Applied to files:
jans-cedarling/cedarling/src/lock/mod.rsjans-cedarling/cedarling/src/jwt/validation/validator.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/init/service_factory.rsjans-cedarling/cedarling/src/tests/policy_store_loader.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/bindings/cedarling_wasm/src/lib.rsjans-cedarling/cedarling/src/log/log_strategy.rsjans-cedarling/cedarling/src/bootstrap_config/jwt_config.rsjans-cedarling/cedarling/src/init/policy_store.rsjans-cedarling/cedarling/src/jwt/test_utils.rsjans-cedarling/cedarling/src/common/policy_store/schema_parser.rsjans-cedarling/cedarling/src/common/policy_store/validator.rsjans-cedarling/cedarling/src/log/mod.rsjans-cedarling/cedarling/src/bootstrap_config/policy_store_config.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/lib.rsjans-cedarling/cedarling/src/http/mod.rsjans-cedarling/cedarling/src/jwt/validation.rsjans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/http_utils/src/lib.rsjans-cedarling/cedarling/src/common/policy_store/entity_parser.rsjans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/common/app_types.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/jwt/mod.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/common/policy_store/vfs_adapter.rsjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rsjans-cedarling/cedarling/src/bootstrap_config/decode.rsjans-cedarling/cedarling/src/common/policy_store.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rsjans-cedarling/cedarling/src/common/policy_store/metadata.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/authz/trust_mode.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/tests/mod.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/bindings/cedarling_python/**/*.py : Validate Python type annotations using `mypy cedarling_python` in the bindings directory
Applied to files:
jans-cedarling/bindings/cedarling_python/PYTHON_TYPES.mdjans-cedarling/bindings/cedarling_python/README.md
📚 Learning: 2025-11-28T05:59:26.842Z
Learnt from: haileyesus2433
Repo: JanssenProject/jans PR: 12455
File: jans-cedarling/cedarling/src/jwt/mod.rs:143-145
Timestamp: 2025-11-28T05:59:26.842Z
Learning: In jans-cedarling JWT service, the local-JWKS-only configuration (no trusted issuers) loads keys but does not initialize validators. This means signed tokens will hit ValidateJwtError::MissingValidator and be skipped. This is acceptable as the intended use case is authorize_unsigned. Validator setup for JWKS-only signed authorization is planned for future implementation.
Applied to files:
jans-cedarling/cedarling/src/jwt/validation/validator.rsjans-cedarling/cedarling/src/tests/policy_store_loader.rsjans-cedarling/cedarling/src/bootstrap_config/jwt_config.rsjans-cedarling/cedarling/src/jwt/validation.rsjans-cedarling/cedarling/src/jwt/mod.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use thiserror crate for custom error types
Applied to files:
jans-cedarling/cedarling/src/jwt/validation/validator.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/lib.rsjans-cedarling/http_utils/src/lib.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Include context in error messages for better debugging
Applied to files:
jans-cedarling/cedarling/src/jwt/validation/validator.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/schema_parser.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/src/tests/**/*.rs : Place integration tests in src/tests/ directory
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/tests/policy_store_loader.rsjans-cedarling/cedarling/src/bootstrap_config/policy_store_config.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rsjans-cedarling/cedarling/src/authz/trust_mode.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/tests/mod.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Include both positive and negative test cases in test files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/tests/policy_store_loader.rsjans-cedarling/cedarling/src/common/policy_store/schema_parser.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/tests/mod.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Use test_utils crate for shared test helpers
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/tests/policy_store_loader.rsdocs/cedarling/tutorials/go.mdjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/jwt/mod.rsjans-cedarling/cedarling/src/common/policy_store.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rsjans-cedarling/cedarling/src/authz/trust_mode.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/tests/mod.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/authorize_*.rs : Follow existing test patterns in authorize_*.rs files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/tests/policy_store_loader.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rsjans-cedarling/cedarling/src/authz/trust_mode.rsjans-cedarling/cedarling/src/tests/mod.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Always include explicit comments explaining what error is expected in test assertions
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Run specific test files using `cargo test -p cedarling --test authorize_unsigned` format
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsdocs/cedarling/tutorials/java.mdjans-cedarling/cedarling/src/tests/policy_store_loader.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/tests/mod.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Use `expect_err("explicit comment")` instead of `panic()` in tests
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Run main crate tests with `cargo test -p cedarling`
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/tests/policy_store_loader.rsdocs/cedarling/tutorials/go.mdjans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsdocs/cedarling/tutorials/javascript.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : For error checking in tests, use `assert!(matches!(...), "explicit comment")` instead of `assert!(result.is_err())`
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/jwt/test_utils.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rsjans-cedarling/cedarling/src/authz/trust_mode.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use standard Rust docstrings without Python-style sections (avoid `# Arguments`, `# Returns`)
Applied to files:
docs/cedarling/tutorials/rust.mdjans-cedarling/bindings/cedarling_python/README.mdjans-cedarling/cedarling/src/lib.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/bindings/cedarling_go/README.mdjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rsjans-cedarling/bindings/cedarling_uniffi/README.md
📚 Learning: 2025-12-26T17:33:14.632Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12903
File: jans-cedarling/bindings/cedarling_wasm/src/lib.rs:83-97
Timestamp: 2025-12-26T17:33:14.632Z
Learning: In jans-cedarling WASM bindings (jans-cedarling/bindings/cedarling_wasm/**/*.rs), explicit documentation sections like `# Arguments` and `# Example` are acceptable because these bindings expose Rust to JavaScript consumers who benefit from more explicit parameter documentation and JavaScript usage examples.
Applied to files:
docs/cedarling/tutorials/rust.mdjans-cedarling/bindings/cedarling_wasm/README.mddocs/cedarling/reference/cedarling-properties.mdjans-cedarling/bindings/cedarling-java/README.mdjans-cedarling/bindings/cedarling_wasm/example_data.jsjans-cedarling/bindings/cedarling_python/README.mdjans-cedarling/cedarling/src/lib.rsdocs/cedarling/tutorials/go.mdjans-cedarling/bindings/cedarling_go/README.mdjans-cedarling/bindings/cedarling_uniffi/README.mdjans-cedarling/clippy.tomldocs/cedarling/tutorials/javascript.mdjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Keep documentation concise, focusing on explanatory content rather than obvious details
Applied to files:
docs/cedarling/tutorials/rust.mddocs/cedarling/reference/cedarling-properties.mdjans-cedarling/bindings/cedarling-java/README.mddocs/cedarling/tutorials/go.mdjans-cedarling/bindings/cedarling_go/README.mdjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rsjans-cedarling/bindings/cedarling_uniffi/README.mddocs/cedarling/tutorials/javascript.md
📚 Learning: 2025-12-19T06:30:26.460Z
Learnt from: duttarnab
Repo: JanssenProject/jans PR: 12806
File: demos/janssen-tarp/browser-extension/src/ai/index.ts:61-72
Timestamp: 2025-12-19T06:30:26.460Z
Learning: Jans Tarp (demos/janssen-tarp) is a testing and development tool for OIDC flows and Cedarling authorization. For this project, storing access tokens and id tokens in browser storage (chrome.storage.local) is acceptable because it's designed for testing/development scenarios, not production use.
Applied to files:
jans-cedarling/bindings/cedarling_wasm/README.mdjans-cedarling/bindings/cedarling_wasm/example_data.jsjans-cedarling/bindings/cedarling_uniffi/README.mddocs/cedarling/tutorials/javascript.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use derive_more crate for error derivation when needed
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/init/policy_store.rsjans-cedarling/cedarling/src/http/mod.rsjans-cedarling/http_utils/src/lib.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Prefer Result<T, E> over panics for error handling
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/http_utils/src/lib.rsjans-cedarling/cedarling/src/common/policy_store/test.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow existing import patterns in the codebase
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/bindings/cedarling_wasm/src/lib.rsjans-cedarling/cedarling/src/init/policy_store.rsjans-cedarling/cedarling/src/common/policy_store/schema_parser.rsjans-cedarling/cedarling/src/bootstrap_config/policy_store_config.rsjans-cedarling/cedarling/src/lib.rsjans-cedarling/cedarling/src/jwt/validation.rsdocs/cedarling/tutorials/go.mdjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/vfs_adapter.rsjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rsjans-cedarling/cedarling/src/bootstrap_config/decode.rsjans-cedarling/cedarling/src/common/policy_store.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/tests/mod.rs
📚 Learning: 2025-12-01T00:02:51.580Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12768
File: jans-cedarling/cedarling/src/common/default_entities_limits.rs:52-119
Timestamp: 2025-12-01T00:02:51.580Z
Learning: In the jans-cedarling Rust codebase, avoid Python/Java-style doc comments with explicit `# Arguments` and `# Errors` sections. The project relies on Rust's type signatures and cargo doc's automatic documentation generation.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Review clippy.toml for project-specific lint rules
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/bootstrap_config/policy_store_config.rsjans-cedarling/cedarling/src/lib.rsdocs/cedarling/tutorials/go.mdjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/claim_mapping.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rsjans-cedarling/clippy.tomldocs/cedarling/tutorials/javascript.md
📚 Learning: 2025-12-24T14:16:17.748Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12896
File: jans-cedarling/cedarling/src/entity_builder/trusted_issuer_index.rs:23-30
Timestamp: 2025-12-24T14:16:17.748Z
Learning: In jans-cedarling Rust code targeting WASM, avoid using `eprintln!` for warnings in constructors or initialization functions. Instead, accept an `Option<&Arc<LogStrategy>>` parameter and use `logger.log_any(LogEntry::new_with_data(LogType::System, None).set_message(...).set_log_level(LogLevel::WARN))` to emit warnings that work in WASM environments.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/bindings/cedarling_wasm/src/lib.rsjans-cedarling/cedarling/src/log/log_strategy.rsjans-cedarling/cedarling/src/log/mod.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rsjans-cedarling/clippy.toml
📚 Learning: 2025-11-07T07:42:08.807Z
Learnt from: duttarnab
Repo: JanssenProject/jans PR: 12652
File: jans-auth-server/model/src/main/java/io/jans/as/model/config/adminui/UIConfiguration.java:9-9
Timestamp: 2025-11-07T07:42:08.807Z
Learning: In the UIConfiguration class (jans-auth-server/model/src/main/java/io/jans/as/model/config/adminui/UIConfiguration.java), the cedarlingPolicyStoreRetrievalPoint field is intentionally kept as a String type for database persistence, rather than using the CedarlingPolicyStrRetrievalPoint enum. The enum type is used in the API/service layer classes, with conversion happening at the boundaries.
Applied to files:
docs/cedarling/reference/cedarling-properties.mdjans-cedarling/bindings/cedarling-java/README.mdjans-cedarling/bindings/cedarling_uniffi/README.md
📚 Learning: 2025-12-26T17:33:14.632Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12903
File: jans-cedarling/bindings/cedarling_wasm/src/lib.rs:83-97
Timestamp: 2025-12-26T17:33:14.632Z
Learning: In Rust WASM bindings under bindings/cedarling_wasm (e.g., jans-cedarling/bindings/cedarling_wasm/src/lib.rs), require explicit documentation sections such as # Arguments and # Example for functions exported to JavaScript. This helps JS consumers understand parameter usage and provide usage examples. Ensure documentation is included in the relevant Rust doc comments where bindings are exposed.
Applied to files:
jans-cedarling/bindings/cedarling_wasm/src/lib.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Leverage serde for serialization/deserialization in Rust
Applied to files:
jans-cedarling/bindings/cedarling_wasm/src/lib.rsjans-cedarling/cedarling/src/common/policy_store/schema_parser.rsjans-cedarling/cedarling/src/bootstrap_config/policy_store_config.rsjans-cedarling/cedarling/src/lib.rsdocs/cedarling/tutorials/go.mdjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/entity_parser.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/metadata.rsdocs/cedarling/tutorials/javascript.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/bindings/cedarling_python/cedarling_python/**/*.pyi : Check if type hints in `.pyi` files need adjustment to match Rust interface changes
Applied to files:
jans-cedarling/bindings/cedarling_python/README.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Document public API items with docstrings focusing on 'why' not 'what'
Applied to files:
jans-cedarling/cedarling/src/lib.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/bindings/cedarling_go/README.mdjans-cedarling/bindings/cedarling_uniffi/README.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Build main cedarling crate using `cargo build -p cedarling`
Applied to files:
docs/cedarling/tutorials/go.mdjans-cedarling/cedarling/Cargo.tomldocs/cedarling/tutorials/javascript.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Generate and view documentation with `cargo doc -p cedarling --no-deps --open`
Applied to files:
docs/cedarling/tutorials/go.mdjans-cedarling/cedarling/Cargo.tomljans-cedarling/bindings/cedarling_go/README.mddocs/cedarling/tutorials/javascript.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Build updated Python bindings using `cd bindings/cedarling_python && maturin develop` and consult README.md if errors occur
Applied to files:
docs/cedarling/tutorials/go.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Run benchmarks using `cargo bench -p cedarling`
Applied to files:
docs/cedarling/tutorials/go.mdjans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/common/policy_store/test.rsdocs/cedarling/tutorials/javascript.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use rustfmt with project's rustfmt.toml settings for all Rust code
Applied to files:
docs/cedarling/tutorials/go.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Check formatting compliance with `cargo fmt --check` and follow rustfmt settings in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/Cargo.toml
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/Cargo.toml : Build all workspace members using `cargo build --workspace`
Applied to files:
jans-cedarling/cedarling/Cargo.tomldocs/cedarling/tutorials/javascript.md
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store/vfs_adapter.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Include examples in docstrings for complex functionality
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/claim_mapping.rs
📚 Learning: 2025-10-30T13:03:03.905Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12544
File: jans-cedarling/cedarling/src/tests/authorize_resource_entity.rs:65-109
Timestamp: 2025-10-30T13:03:03.905Z
Learning: In Rust, when `use tokio::test;` is present at the top of a file, the `#[test]` attribute refers to `tokio::test` (the async test macro), not the standard library's `#[test]`. This is a valid pattern for writing async tests with Tokio.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rsjans-cedarling/cedarling/src/log/stdout_logger/native_logger.rs
📚 Learning: 2025-12-10T14:10:52.927Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12819
File: jans-cedarling/cedarling/src/common/policy_store/manager.rs:101-107
Timestamp: 2025-12-10T14:10:52.927Z
Learning: Applies to jans-cedarling/**/*.rs: Avoid using `println!` or `eprintln!` as they don't work in WASM. Use the Logger with `logger.log(&System::log_msg(...))` pattern instead.
Applied to files:
jans-cedarling/clippy.toml
📚 Learning: 2025-12-17T13:08:11.604Z
Learnt from: dagregi
Repo: JanssenProject/jans PR: 12833
File: jans-cedarling/schema/minimal_policy_store.json:13-21
Timestamp: 2025-12-17T13:08:11.604Z
Learning: In jans-cedarling/schema/cedarling_core.cedarschema, the Access_token entity intentionally includes both a `scope?: Set<String>` attribute and `tags Set<String>` declaration. This dual approach is by design, allowing scope to be accessed either as an attribute or dynamically as a tag depending on the use case.
Applied to files:
jans-cedarling/schema/policy_store_schema.json
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use typed-builder crate for complex struct construction
Applied to files:
docs/cedarling/tutorials/javascript.mdjans-cedarling/cedarling/src/common/policy_store/test_utils.rs
🧬 Code graph analysis (10)
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rs (2)
jans-cedarling/cedarling/src/common/policy_store/test_utils.rs (8)
create_corrupted_archive(419-424)create_deep_nested_archive(427-440)create_path_traversal_archive(405-416)new(60-75)default(53-55)invalid_metadata_json(354-360)invalid_policy_syntax(363-366)minimal_valid(294-300)jans-cedarling/cedarling/src/common/policy_store/archive_handler.rs (1)
from_buffer(155-158)
jans-cedarling/cedarling/src/tests/policy_store_loader.rs (3)
jans-cedarling/cedarling/src/tests/utils/cedarling_util.rs (1)
get_cedarling_with_callback(51-61)jans-cedarling/cedarling/src/common/policy_store/test_utils.rs (3)
new(60-75)minimal_valid(294-300)default(53-55)jans-cedarling/cedarling/src/common/policy_store/loader.rs (1)
load_policy_store_archive_bytes(128-135)
jans-cedarling/cedarling/src/common/policy_store/log_entry.rs (3)
jans-cedarling/cedarling/src/log/memory_logger/mod.rs (1)
log(106-121)jans-cedarling/cedarling/src/log/log_strategy.rs (1)
new(37-60)jans-cedarling/cedarling/src/log/log_entry.rs (1)
new_opt_request_id(424-440)
jans-cedarling/bindings/cedarling_wasm/src/lib.rs (1)
jans-cedarling/cedarling/src/bootstrap_config/decode.rs (1)
from_raw_config(42-158)
jans-cedarling/cedarling/src/log/log_strategy.rs (3)
jans-cedarling/cedarling/src/common/app_types.rs (1)
new(19-22)jans-cedarling/cedarling/src/lib.rs (1)
new(114-156)jans-cedarling/cedarling/src/log/stdout_logger/native_logger.rs (2)
new(23-28)new(90-94)
jans-cedarling/cedarling/src/lib.rs (4)
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs (2)
validate_required_claims(324-331)validate_required_claims(351-375)jans-cedarling/cedarling/src/init/service_factory.rs (1)
policy_store(55-62)jans-cedarling/cedarling/src/common/policy_store/validator.rs (4)
name(153-155)id(148-150)version(163-165)cedar_version(143-145)jans-cedarling/cedarling/src/log/log_entry.rs (1)
new_with_data(51-60)
jans-cedarling/cedarling/src/common/app_types.rs (2)
jans-cedarling/cedarling/src/lib.rs (1)
new(114-156)jans-cedarling/cedarling/src/log/log_strategy.rs (1)
new(37-60)
jans-cedarling/cedarling/src/jwt/mod.rs (1)
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs (4)
validate_required_claims(324-331)validate_required_claims(351-375)with_logger(161-198)key_service(478-480)
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs (2)
jans-cedarling/cedarling/src/jwt/token_cache.rs (1)
cache_duration(131-158)jans-cedarling/cedarling/src/jwt/key_service.rs (1)
has_keys(157-159)
jans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs (2)
jans-cedarling/cedarling/src/common/policy_store/loader.rs (2)
new(195-197)load_manifest(353-374)jans-cedarling/cedarling/src/common/policy_store/vfs_adapter.rs (2)
new(81-84)new(164-167)
🪛 markdownlint-cli2 (0.18.1)
jans-cedarling/bindings/cedarling_wasm/README.md
73-73: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
75-75: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
81-81: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
271-271: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
284-284: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
296-296: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
docs/cedarling/tutorials/python.md
104-104: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
115-115: Ordered list item prefix
Expected: 1; Actual: 5; Style: 1/1/1
(MD029, ol-prefix)
117-117: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
122-122: Ordered list item prefix
Expected: 1; Actual: 6; Style: 1/1/1
(MD029, ol-prefix)
jans-cedarling/bindings/cedarling_go/README.md
289-289: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
Outdated
Show resolved
Hide resolved
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.
Review continued from previous batch...
jans-cedarling/cedarling/src/common/policy_store/issuer_parser.rs
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 3
♻️ Duplicate comments (3)
jans-cedarling/cedarling/src/jwt/mod.rs (2)
163-165: Clone is acceptable for initialization code.The clone here was previously discussed and accepted for initialization code. If performance becomes a concern in hot paths, this could be revisited to iterate once and build both data structures.
354-378: Debug logging for fallback path has been addressed.The debug logging when falling back to legacy issuer lookup was added in commit 5d901e6 per previous review feedback. This improves observability when the new trusted issuer validator doesn't match as expected.
jans-cedarling/cedarling/src/common/policy_store/loader.rs (1)
94-99: Consider manifest validation for archive-based loading.Both
load_policy_store_archive(lines 94-99) andload_policy_store_archive_bytes(lines 128-135) load archives without validating the manifest, whileload_policy_store_directory(lines 46-56) does validate manifests when present. This inconsistency could allow corrupted or tampered archives to be loaded without integrity checks.🔎 Proposed fix
Add manifest validation similar to directory loading:
tokio::task::spawn_blocking(move || { use super::archive_handler::ArchiveVfs; let archive_vfs = ArchiveVfs::from_file(&path)?; let loader = DefaultPolicyStoreLoader::new(archive_vfs); - loader.load_directory(".") + let loaded = loader.load_directory(".")?; + + // Note: For archive-based stores, manifest validation may need + // a different approach than PhysicalVfs, or document why it's skipped + // For now, we defer to the caller or document the limitation + + Ok(loaded) })And similarly for
load_policy_store_archive_bytes:pub fn load_policy_store_archive_bytes( bytes: Vec<u8>, ) -> Result<LoadedPolicyStore, PolicyStoreError> { use super::archive_handler::ArchiveVfs; let archive_vfs = ArchiveVfs::from_buffer(bytes)?; let loader = DefaultPolicyStoreLoader::new(archive_vfs); - loader.load_directory(".") + let loaded = loader.load_directory(".")?; + + // Note: Manifest validation for archive-based stores may require + // VFS-specific implementation or be intentionally skipped + + Ok(loaded) }Note: If manifest validation is intentionally skipped for archives (e.g., because the ZIP format itself provides integrity), this should be documented in the function docs or as a comment to clarify the design decision.
Also applies to: 128-135
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
jans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/jwt/mod.rs
🧰 Additional context used
📓 Path-based instructions (2)
jans-cedarling/**/*.rs
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
jans-cedarling/**/*.rs: Check formatting compliance withcargo fmt --checkand follow rustfmt settings in rustfmt.toml
Review clippy.toml for project-specific lint rules
Use rustfmt with project's rustfmt.toml settings for all Rust code
Enforce maximum line width of 100 characters in Rust code
Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Use 4-space indentation (no tabs) in all Rust code
Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Follow existing import patterns in the codebase
Use snake_case for variables, functions, and modules in Rust
Use PascalCase for types, traits, and enums in Rust
Use SCREAMING_SNAKE_CASE for constants in Rust
Follow Rust naming conventions as established by the language
Use thiserror crate for custom error types
Prefer Result<T, E> over panics for error handling
Use derive_more crate for error derivation when needed
Include context in error messages for better debugging
Use typed-builder crate for complex struct construction
Leverage serde for serialization/deserialization in Rust
Use smol_str for string optimization where appropriate in Rust
Prefer strong typing over stringly-typed APIs in Rust
Use standard Rust docstrings without Python-style sections (avoid# Arguments,# Returns)
Document public API items with docstrings focusing on 'why' not 'what'
Include examples in docstrings for complex functionality
Keep documentation concise, focusing on explanatory content rather than obvious details
Each Rust file must contain the Apache 2.0 license header with copyright attribution to Gluu, Inc.
Files:
jans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/jwt/mod.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
jans-cedarling/**/*test*.rs
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
jans-cedarling/**/*test*.rs: Use test_utils crate for shared test helpers
Include both positive and negative test cases in test files
For error checking in tests, useassert!(matches!(...), "explicit comment")instead ofassert!(result.is_err())
Useexpect_err("explicit comment")instead ofpanic()in tests
Always include explicit comments explaining what error is expected in test assertions
Files:
jans-cedarling/cedarling/src/common/policy_store/test_utils.rs
🧠 Learnings (28)
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Review clippy.toml for project-specific lint rules
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-11-28T05:59:26.842Z
Learnt from: haileyesus2433
Repo: JanssenProject/jans PR: 12455
File: jans-cedarling/cedarling/src/jwt/mod.rs:143-145
Timestamp: 2025-11-28T05:59:26.842Z
Learning: In jans-cedarling JWT service, the local-JWKS-only configuration (no trusted issuers) loads keys but does not initialize validators. This means signed tokens will hit ValidateJwtError::MissingValidator and be skipped. This is acceptable as the intended use case is authorize_unsigned. Validator setup for JWKS-only signed authorization is planned for future implementation.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/jwt/mod.rs
📚 Learning: 2025-12-17T13:07:08.750Z
Learnt from: pujavs
Repo: JanssenProject/jans PR: 12847
File: jans-config-api/docs/jans-config-api-swagger.yaml:15497-15498
Timestamp: 2025-12-17T13:07:08.750Z
Learning: When reviewing components like `jans-auth`, `jans-fido2`, `jans-lock` in the JanssenProject/jans repository, raise issues about missing property descriptions in API model classes, as these descriptions will be reflected in the auto-generated Swagger specifications.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/issuer_parser.rs
📚 Learning: 2025-12-04T12:17:12.662Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12797
File: jans-cedarling/AGENTS.md:82-88
Timestamp: 2025-12-04T12:17:12.662Z
Learning: In the jans-cedarling project, the AGENTS.md file is AI-generated and used only by AI agents, so markdown linting issues (such as MD031, MD040) for this file can be ignored during code reviews.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T14:10:48.131Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12819
File: jans-cedarling/cedarling/src/common/policy_store/manager.rs:101-107
Timestamp: 2025-12-10T14:10:48.131Z
Learning: In all Rust source files under the jans-cedarling directory, avoid using println! or eprintln! because they do not work in WASM builds. Use the provided Logger API, e.g. logger.log(&System::log_msg(...)) to log messages. Ensure the logger is properly initialized in the WASM context and replace direct prints with the logger pattern in relevant code paths (especially in WASM targets).
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/jwt/mod.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-24T14:16:17.748Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12896
File: jans-cedarling/cedarling/src/entity_builder/trusted_issuer_index.rs:23-30
Timestamp: 2025-12-24T14:16:17.748Z
Learning: In jans-cedarling Rust code targeting WASM, avoid using `eprintln!` for warnings in constructors or initialization functions. Instead, accept an `Option<&Arc<LogStrategy>>` parameter and use `logger.log_any(LogEntry::new_with_data(LogType::System, None).set_message(...).set_log_level(LogLevel::WARN))` to emit warnings that work in WASM environments.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Document public API items with docstrings focusing on 'why' not 'what'
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Keep documentation concise, focusing on explanatory content rather than obvious details
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-01T00:02:51.580Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12768
File: jans-cedarling/cedarling/src/common/default_entities_limits.rs:52-119
Timestamp: 2025-12-01T00:02:51.580Z
Learning: In the jans-cedarling Rust codebase, avoid Python/Java-style doc comments with explicit `# Arguments` and `# Errors` sections. The project relies on Rust's type signatures and cargo doc's automatic documentation generation.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use standard Rust docstrings without Python-style sections (avoid `# Arguments`, `# Returns`)
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow existing import patterns in the codebase
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Leverage serde for serialization/deserialization in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow Rust naming conventions as established by the language
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-26T17:33:14.632Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12903
File: jans-cedarling/bindings/cedarling_wasm/src/lib.rs:83-97
Timestamp: 2025-12-26T17:33:14.632Z
Learning: In jans-cedarling WASM bindings (jans-cedarling/bindings/cedarling_wasm/**/*.rs), explicit documentation sections like `# Arguments` and `# Example` are acceptable because these bindings expose Rust to JavaScript consumers who benefit from more explicit parameter documentation and JavaScript usage examples.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : For error checking in tests, use `assert!(matches!(...), "explicit comment")` instead of `assert!(result.is_err())`
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/authorize_*.rs : Follow existing test patterns in authorize_*.rs files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Use `expect_err("explicit comment")` instead of `panic()` in tests
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Always include explicit comments explaining what error is expected in test assertions
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/log_entry.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Use test_utils crate for shared test helpers
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/jwt/mod.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/src/tests/**/*.rs : Place integration tests in src/tests/ directory
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test_utils.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Include both positive and negative test cases in test files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test_utils.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use typed-builder crate for complex struct construction
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test_utils.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use PascalCase for types, traits, and enums in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use snake_case for variables, functions, and modules in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use smol_str for string optimization where appropriate in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Prefer strong typing over stringly-typed APIs in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/loader.rs
🧬 Code graph analysis (2)
jans-cedarling/cedarling/src/common/policy_store/log_entry.rs (3)
jans-cedarling/cedarling/src/lib.rs (1)
new(115-161)jans-cedarling/cedarling/src/log/log_strategy.rs (1)
new(40-67)jans-cedarling/cedarling/src/log/log_entry.rs (1)
new_system_opt_request_id(420-422)
jans-cedarling/cedarling/src/common/policy_store/loader.rs (4)
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rs (2)
from_file(118-139)from_reader(70-97)jans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs (2)
new(48-55)new(92-94)jans-cedarling/cedarling/src/common/policy_store/validator.rs (1)
parse_and_validate(125-137)jans-cedarling/cedarling/src/common/policy_store/policy_parser.rs (3)
parse_policies(134-149)parse_policy(52-85)parse_template(93-128)
🔇 Additional comments (9)
jans-cedarling/cedarling/src/common/policy_store/log_entry.rs (5)
1-11: LGTM! License header and import ordering are correct.The Apache 2.0 license header is properly formatted with Gluu, Inc. copyright attribution, and the imports are correctly grouped with external crates (serde) first, followed by a blank line, then internal modules.
13-19: LGTM! Clean struct design with appropriate derives.The struct properly embeds
BaseLogEntrywithserde(flatten)for seamless serialization, and derivesSerializeandClonefor logging infrastructure integration.
21-56: LGTM! Well-documented constructors with clear use cases.The constructors properly integrate with the logging framework:
new()provides flexible log level control with a sensible TRACE defaultinfo()andwarn()convenience helpers reduce boilerplate for common scenarios- Documentation effectively explains "why" each constructor exists and when to use them
- Constructor correctly calls
BaseLogEntry::new_system_opt_request_idwith unwrapped levelBased on learnings: The documentation follows Rust conventions by focusing on "why" rather than "what" and avoids Python-style doc sections.
58-76: LGTM! Trait implementations correctly delegate to base.The
LoggableandIndexedtrait implementations appropriately delegate to the embeddedBaseLogEntry, maintaining the logging framework's interface contracts.
78-102: LGTM! Test coverage is appropriate for the public API.The tests verify all three public constructors (
new,info,warn) and confirm both message content and log level behavior. Coverage is adequate for this delegation-based struct.jans-cedarling/cedarling/src/jwt/mod.rs (4)
79-86: LGTM: Public API expansion aligns with PR objectives.The visibility change for
test_utilstopub(crate)follows the test utilities pattern. The new public re-exports ofTrustedIssuerValidator,TrustedIssuerError, andvalidate_required_claimsappropriately expose the trusted issuer validation subsystem as part of the PR's goal to support the new Policy Store format with trusted issuer validation.Based on learnings, using
test_utilscrate for shared test helpers is the established pattern.
114-115: LGTM: Field addition is well-documented.The new
trusted_issuer_validatorfield is properly documented and integrates cleanly into theJwtServicestructure.
219-222: LGTM: Validator initialization is correct.The
TrustedIssuerValidatoris properly initialized with the cloned trusted issuers map and logger reference.
383-427: LGTM: Required claims validation is correctly implemented.The required claims validation logic is well-structured and correctly implements the policy-driven validation requirements:
- Properly skips validation for
StatusListtokens- Retrieves token metadata from the trusted issuer configuration based on token type
- The comment at lines 397-402 helpfully clarifies that this is the single point where policy-driven required claims validation occurs (distinct from standard JWT validation)
- Error handling appropriately converts
TrustedIssuerErrortoValidateJwtError- Uses the logger API correctly for WASM compatibility
Based on learnings, the logger API is used correctly (avoiding println!/eprintln! which don't work in WASM builds).
- Updated methods in `archive_handler` to return `Result` types for better error handling, including mutex lock errors. - Added a new error type `FileReadError` to provide more context when file reading fails. - Improved test assertions for clarity and added error messages for better debugging. - Enhanced comments in the policy parser for better understanding of ID extraction logic. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
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.
Actionable comments posted: 3
♻️ Duplicate comments (3)
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rs (2)
93-93: Fix incomplete documentation sentence.Similar to the issue in
parse_policy, line 93 contains the incomplete sentence "the ID to `Template::parse()` based on annotation or filename."🔎 Proposed fix
/// Parse a single template from Cedar policy text. /// /// Templates support slots (e.g., ?principal) and are parsed similarly to policies. /// The template ID is extracted from @id() annotation or derived from filename. /// -/// the ID to `Template::parse()` based on annotation or filename. +/// The method passes the derived ID to `Template::parse()` for Cedar engine validation.
51-52: Fix incomplete documentation sentence.The sentence "Pass the ID to `Policy::parse()` using the annotation or the filename (without the .cedar extension)." is grammatically incomplete—it lacks a subject.
🔎 Proposed fix
/// Parse a single policy from Cedar policy text. /// /// The policy ID is determined by: /// 1. Extracting from @id() annotation in the policy text, OR /// 2. Deriving from the filename (without .cedar extension) /// -/// Pass the ID to `Policy::parse()` using the annotation or the filename (without -/// the .cedar extension). +/// The method passes the derived ID to `Policy::parse()` for Cedar engine validation.jans-cedarling/cedarling/src/common/policy_store/loader.rs (1)
82-109: Add manifest validation for archive loading.This function loads a
.cjararchive but does not validate the manifest when present (lines 94-99). In contrast,load_policy_store_directoryvalidates the manifest (lines 54-56), andload_policy_store_archive_bytesvalidates it as well (lines 139-155). This inconsistency means archives loaded from files bypass integrity checks that directory-based stores receive, creating a security gap for archives from untrusted sources.🔎 Proposed fix
tokio::task::spawn_blocking(move || { use super::archive_handler::ArchiveVfs; let archive_vfs = ArchiveVfs::from_file(&path)?; let loader = DefaultPolicyStoreLoader::new(archive_vfs); - loader.load_directory(".") + let loaded = loader.load_directory(".")?; + + // Validate manifest if present (same pattern as load_policy_store_archive_bytes) + if let Some(ref _manifest) = loaded.manifest { + use super::manifest_validator::ManifestValidator; + let validator_vfs = super::archive_handler::ArchiveVfs::from_file(&path)?; + let validator = ManifestValidator::new(validator_vfs, std::path::PathBuf::from(".")); + let result = validator.validate(Some(&loaded.metadata.policy_store.id)); + + if !result.is_valid { + if let Some(error) = result.errors.first() { + return Err(PolicyStoreError::ManifestError { + err: error.error_type.clone(), + }); + } + } + } + + Ok(loaded) })
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
🧰 Additional context used
📓 Path-based instructions (2)
jans-cedarling/**/*.rs
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
jans-cedarling/**/*.rs: Check formatting compliance withcargo fmt --checkand follow rustfmt settings in rustfmt.toml
Review clippy.toml for project-specific lint rules
Use rustfmt with project's rustfmt.toml settings for all Rust code
Enforce maximum line width of 100 characters in Rust code
Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Use 4-space indentation (no tabs) in all Rust code
Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Follow existing import patterns in the codebase
Use snake_case for variables, functions, and modules in Rust
Use PascalCase for types, traits, and enums in Rust
Use SCREAMING_SNAKE_CASE for constants in Rust
Follow Rust naming conventions as established by the language
Use thiserror crate for custom error types
Prefer Result<T, E> over panics for error handling
Use derive_more crate for error derivation when needed
Include context in error messages for better debugging
Use typed-builder crate for complex struct construction
Leverage serde for serialization/deserialization in Rust
Use smol_str for string optimization where appropriate in Rust
Prefer strong typing over stringly-typed APIs in Rust
Use standard Rust docstrings without Python-style sections (avoid# Arguments,# Returns)
Document public API items with docstrings focusing on 'why' not 'what'
Include examples in docstrings for complex functionality
Keep documentation concise, focusing on explanatory content rather than obvious details
Each Rust file must contain the Apache 2.0 license header with copyright attribution to Gluu, Inc.
Files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
jans-cedarling/**/*test*.rs
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
jans-cedarling/**/*test*.rs: Use test_utils crate for shared test helpers
Include both positive and negative test cases in test files
For error checking in tests, useassert!(matches!(...), "explicit comment")instead ofassert!(result.is_err())
Useexpect_err("explicit comment")instead ofpanic()in tests
Always include explicit comments explaining what error is expected in test assertions
Files:
jans-cedarling/cedarling/src/common/policy_store/loader_tests.rs
🧠 Learnings (35)
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Review clippy.toml for project-specific lint rules
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Prefer Result<T, E> over panics for error handling
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Use `expect_err("explicit comment")` instead of `panic()` in tests
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : For error checking in tests, use `assert!(matches!(...), "explicit comment")` instead of `assert!(result.is_err())`
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/authorize_*.rs : Follow existing test patterns in authorize_*.rs files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow existing import patterns in the codebase
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Always include explicit comments explaining what error is expected in test assertions
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Include both positive and negative test cases in test files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T14:10:48.131Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12819
File: jans-cedarling/cedarling/src/common/policy_store/manager.rs:101-107
Timestamp: 2025-12-10T14:10:48.131Z
Learning: In all Rust source files under the jans-cedarling directory, avoid using println! or eprintln! because they do not work in WASM builds. Use the provided Logger API, e.g. logger.log(&System::log_msg(...)) to log messages. Ensure the logger is properly initialized in the WASM context and replace direct prints with the logger pattern in relevant code paths (especially in WASM targets).
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow Rust naming conventions as established by the language
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Leverage serde for serialization/deserialization in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/errors.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Document public API items with docstrings focusing on 'why' not 'what'
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use standard Rust docstrings without Python-style sections (avoid `# Arguments`, `# Returns`)
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use PascalCase for types, traits, and enums in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use snake_case for variables, functions, and modules in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Prefer strong typing over stringly-typed APIs in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Include context in error messages for better debugging
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Check formatting compliance with `cargo fmt --check` and follow rustfmt settings in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use 4-space indentation (no tabs) in all Rust code
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Keep documentation concise, focusing on explanatory content rather than obvious details
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use thiserror crate for custom error types
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs
📚 Learning: 2025-12-04T12:17:12.662Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12797
File: jans-cedarling/AGENTS.md:82-88
Timestamp: 2025-12-04T12:17:12.662Z
Learning: In the jans-cedarling project, the AGENTS.md file is AI-generated and used only by AI agents, so markdown linting issues (such as MD031, MD040) for this file can be ignored during code reviews.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-01T00:02:51.580Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12768
File: jans-cedarling/cedarling/src/common/default_entities_limits.rs:52-119
Timestamp: 2025-12-01T00:02:51.580Z
Learning: In the jans-cedarling Rust codebase, avoid Python/Java-style doc comments with explicit `# Arguments` and `# Errors` sections. The project relies on Rust's type signatures and cargo doc's automatic documentation generation.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Run specific test files using `cargo test -p cedarling --test authorize_unsigned` format
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/policy_parser.rsjans-cedarling/cedarling/src/common/policy_store/loader_tests.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use derive_more crate for error derivation when needed
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs
📚 Learning: 2025-12-26T17:33:14.632Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12903
File: jans-cedarling/bindings/cedarling_wasm/src/lib.rs:83-97
Timestamp: 2025-12-26T17:33:14.632Z
Learning: In jans-cedarling WASM bindings (jans-cedarling/bindings/cedarling_wasm/**/*.rs), explicit documentation sections like `# Arguments` and `# Example` are acceptable because these bindings expose Rust to JavaScript consumers who benefit from more explicit parameter documentation and JavaScript usage examples.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/errors.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/src/tests/**/*.rs : Place integration tests in src/tests/ directory
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/loader_tests.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Use test_utils crate for shared test helpers
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/loader_tests.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Run main crate tests with `cargo test -p cedarling`
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/loader_tests.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use SCREAMING_SNAKE_CASE for constants in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use smol_str for string optimization where appropriate in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manifest_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-24T14:16:17.748Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12896
File: jans-cedarling/cedarling/src/entity_builder/trusted_issuer_index.rs:23-30
Timestamp: 2025-12-24T14:16:17.748Z
Learning: In jans-cedarling Rust code targeting WASM, avoid using `eprintln!` for warnings in constructors or initialization functions. Instead, accept an `Option<&Arc<LogStrategy>>` parameter and use `logger.log_any(LogEntry::new_with_data(LogType::System, None).set_message(...).set_log_level(LogLevel::WARN))` to emit warnings that work in WASM environments.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-11-28T05:59:26.842Z
Learnt from: haileyesus2433
Repo: JanssenProject/jans PR: 12455
File: jans-cedarling/cedarling/src/jwt/mod.rs:143-145
Timestamp: 2025-11-28T05:59:26.842Z
Learning: In jans-cedarling JWT service, the local-JWKS-only configuration (no trusted issuers) loads keys but does not initialize validators. This means signed tokens will hit ValidateJwtError::MissingValidator and be skipped. This is acceptable as the intended use case is authorize_unsigned. Validator setup for JWKS-only signed authorization is planned for future implementation.
Applied to files:
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
🧬 Code graph analysis (3)
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rs (1)
jans-cedarling/cedarling/src/common/policy_store/vfs_adapter.rs (16)
read_file(48-53)exists(59-59)exists(134-138)exists(248-252)is_dir(62-62)is_dir(140-146)is_dir(254-260)is_file(67-67)is_file(148-154)is_file(262-268)read_dir(56-56)read_dir(112-132)read_dir(226-246)open_file(42-42)open_file(104-110)open_file(218-224)
jans-cedarling/cedarling/src/common/policy_store/loader_tests.rs (7)
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rs (1)
create_test_archive(392-408)jans-cedarling/cedarling/src/common/policy_store/loader.rs (5)
default(700-702)new(218-220)new_physical(228-230)parse_policies(666-675)create_policy_set(690-695)jans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs (3)
default(77-79)new(48-55)new(92-94)jans-cedarling/cedarling/src/common/policy_store.rs (3)
default(240-256)default(261-265)new(445-463)jans-cedarling/cedarling/src/common/policy_store/policy_parser.rs (2)
parse_policies(135-150)create_policy_set(156-183)jans-cedarling/cedarling/src/common/policy_store/schema_parser.rs (1)
parse_schema(70-92)jans-cedarling/cedarling/src/common/policy_store/entity_parser.rs (2)
parse_entities(150-183)create_entities_store(247-256)
jans-cedarling/cedarling/src/common/policy_store/manifest_validator.rs (2)
jans-cedarling/cedarling/src/common/policy_store/loader.rs (2)
new(218-220)load_manifest(384-405)jans-cedarling/cedarling/src/common/policy_store/vfs_adapter.rs (2)
new(82-85)new(171-174)
🔇 Additional comments (9)
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs (1)
251-273: Previous review feedback properly addressed.The code correctly implements the fixes from previous reviews:
Endpoint-specific JWKS loading (lines 257-268): Now checks
self.keys_fetch_time.get(endpoint_str)for each issuer endpoint individually instead of using globalhas_keys(), ensuring multiple issuers load their keys correctly.Security-first validation order (line 462): Required claims validation executes after JWT signature verification (line 458), preventing information leakage about claim requirements to attackers with invalid signatures.
The implementation now follows defense-in-depth principles and correctly handles multi-issuer scenarios.
Also applies to: 379-465
jans-cedarling/cedarling/src/common/policy_store/loader.rs (8)
1-5: LGTM!License header is correctly formatted with Apache 2.0 license and copyright attribution to Gluu, Inc.
21-27: LGTM!Imports are correctly ordered: standard library imports first, then internal module imports. This follows the project's import conventions.
28-69: LGTM!The native directory loading implementation correctly:
- Uses
spawn_blockingto offload blocking filesystem I/O from the async runtime- Validates the manifest when present (lines 54-56)
- Handles errors comprehensively, including panic recovery from the blocking task
160-204: LGTM!Data structures are well-designed with clear field names, appropriate derives, and consistent patterns. The use of
Stringfor file names and content is reasonable and straightforward.
206-298: LGTM!The loader implementation is well-structured:
- Generic design over
VfsFileSystemenables different storage backends- PhysicalVfs-specific convenience constructors are appropriately gated
- Logger handling (lines 286-294) correctly checks for
Somebefore callinglog_any, avoiding the compilation error flagged in previous reviews- Manifest validation methods provide flexibility with and without logging
300-656: LGTM!The loader methods demonstrate solid implementation quality:
- Consistent error handling with rich context (file paths, expected extensions)
- Proper validation of directory structure, file extensions, and UTF-8 content
- Graceful handling of optional directories (templates, entities, trusted-issuers)
- Recursive policy loading supports nested directory structures
- The main
load_directorymethod orchestrates all components cleanly
658-703: LGTM!Test-only helper methods are properly gated with
#[cfg(test)]and provide convenient wrappers for policy parsing in tests. TheDefaultimplementation forPhysicalVfsappropriately delegates tonew_physical()and is correctly restricted to native platforms.
122-158: Clarify that manifest validation is intentionally unavailable on WASM.Manifest validation is not performed in WASM (line 140:
#[cfg(not(target_arch = "wasm32"))]) becauseManifestValidatoritself is gated for non-WASM platforms and does not exist in WASM builds. This is an intentional architectural decision, not a compilation workaround.However, this creates a potential security gap: the function documentation claims it's useful for "WASM environments," yet archives loaded on WASM bypass integrity validation entirely. Since WASM archives may originate from untrusted sources (e.g., URLs), consider whether validation should be enabled for WASM as well. The validation logic itself (hex, SHA-256 checksums) should be compatible with WASM.
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
Outdated
Show resolved
Hide resolved
…or handling - Updated the benchmark for ZIP archive parsing to use `iter_batched` for better performance measurement. - Enhanced error handling in the `archive_handler` tests to use `expect` for clearer failure messages. - Adjusted the issuer parser tests to accept empty token metadata for JWKS-only configurations, improving validation logic. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
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.
Actionable comments posted: 4
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
🧰 Additional context used
📓 Path-based instructions (1)
jans-cedarling/**/*.rs
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
jans-cedarling/**/*.rs: Check formatting compliance withcargo fmt --checkand follow rustfmt settings in rustfmt.toml
Review clippy.toml for project-specific lint rules
Use rustfmt with project's rustfmt.toml settings for all Rust code
Enforce maximum line width of 100 characters in Rust code
Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Use 4-space indentation (no tabs) in all Rust code
Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Follow existing import patterns in the codebase
Use snake_case for variables, functions, and modules in Rust
Use PascalCase for types, traits, and enums in Rust
Use SCREAMING_SNAKE_CASE for constants in Rust
Follow Rust naming conventions as established by the language
Use thiserror crate for custom error types
Prefer Result<T, E> over panics for error handling
Use derive_more crate for error derivation when needed
Include context in error messages for better debugging
Use typed-builder crate for complex struct construction
Leverage serde for serialization/deserialization in Rust
Use smol_str for string optimization where appropriate in Rust
Prefer strong typing over stringly-typed APIs in Rust
Use standard Rust docstrings without Python-style sections (avoid# Arguments,# Returns)
Document public API items with docstrings focusing on 'why' not 'what'
Include examples in docstrings for complex functionality
Keep documentation concise, focusing on explanatory content rather than obvious details
Each Rust file must contain the Apache 2.0 license header with copyright attribution to Gluu, Inc.
Files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
🧠 Learnings (28)
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Run benchmarks using `cargo bench -p cedarling`
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-26T17:33:14.632Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12903
File: jans-cedarling/bindings/cedarling_wasm/src/lib.rs:83-97
Timestamp: 2025-12-26T17:33:14.632Z
Learning: In jans-cedarling WASM bindings (jans-cedarling/bindings/cedarling_wasm/**/*.rs), explicit documentation sections like `# Arguments` and `# Example` are acceptable because these bindings expose Rust to JavaScript consumers who benefit from more explicit parameter documentation and JavaScript usage examples.
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Keep documentation concise, focusing on explanatory content rather than obvious details
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Enforce maximum line width of 100 characters in Rust code
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Review clippy.toml for project-specific lint rules
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use smol_str for string optimization where appropriate in Rust
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Check formatting compliance with `cargo fmt --check` and follow rustfmt settings in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use standard Rust docstrings without Python-style sections (avoid `# Arguments`, `# Returns`)
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use 4-space indentation (no tabs) in all Rust code
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rs
📚 Learning: 2025-12-04T12:17:12.662Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12797
File: jans-cedarling/AGENTS.md:82-88
Timestamp: 2025-12-04T12:17:12.662Z
Learning: In the jans-cedarling project, the AGENTS.md file is AI-generated and used only by AI agents, so markdown linting issues (such as MD031, MD040) for this file can be ignored during code reviews.
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/common/policy_store/issuer_parser.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Use test_utils crate for shared test helpers
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow existing import patterns in the codebase
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-01T00:02:51.580Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12768
File: jans-cedarling/cedarling/src/common/default_entities_limits.rs:52-119
Timestamp: 2025-12-01T00:02:51.580Z
Learning: In the jans-cedarling Rust codebase, avoid Python/Java-style doc comments with explicit `# Arguments` and `# Errors` sections. The project relies on Rust's type signatures and cargo doc's automatic documentation generation.
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow Rust naming conventions as established by the language
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Each Rust file must contain the Apache 2.0 license header with copyright attribution to Gluu, Inc.
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rs
📚 Learning: 2025-12-10T14:10:48.131Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12819
File: jans-cedarling/cedarling/src/common/policy_store/manager.rs:101-107
Timestamp: 2025-12-10T14:10:48.131Z
Learning: In all Rust source files under the jans-cedarling directory, avoid using println! or eprintln! because they do not work in WASM builds. Use the provided Logger API, e.g. logger.log(&System::log_msg(...)) to log messages. Ensure the logger is properly initialized in the WASM context and replace direct prints with the logger pattern in relevant code paths (especially in WASM targets).
Applied to files:
jans-cedarling/cedarling/benches/policy_store_benchmark.rsjans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-11-28T05:59:26.842Z
Learnt from: haileyesus2433
Repo: JanssenProject/jans PR: 12455
File: jans-cedarling/cedarling/src/jwt/mod.rs:143-145
Timestamp: 2025-11-28T05:59:26.842Z
Learning: In jans-cedarling JWT service, the local-JWKS-only configuration (no trusted issuers) loads keys but does not initialize validators. This means signed tokens will hit ValidateJwtError::MissingValidator and be skipped. This is acceptable as the intended use case is authorize_unsigned. Validator setup for JWKS-only signed authorization is planned for future implementation.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/issuer_parser.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-17T13:07:08.750Z
Learnt from: pujavs
Repo: JanssenProject/jans PR: 12847
File: jans-config-api/docs/jans-config-api-swagger.yaml:15497-15498
Timestamp: 2025-12-17T13:07:08.750Z
Learning: When reviewing components like `jans-auth`, `jans-fido2`, `jans-lock` in the JanssenProject/jans repository, raise issues about missing property descriptions in API model classes, as these descriptions will be reflected in the auto-generated Swagger specifications.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/issuer_parser.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Use `expect_err("explicit comment")` instead of `panic()` in tests
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Prefer Result<T, E> over panics for error handling
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : For error checking in tests, use `assert!(matches!(...), "explicit comment")` instead of `assert!(result.is_err())`
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/authorize_*.rs : Follow existing test patterns in authorize_*.rs files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Always include explicit comments explaining what error is expected in test assertions
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Include both positive and negative test cases in test files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Include context in error messages for better debugging
Applied to files:
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Document public API items with docstrings focusing on 'why' not 'what'
Applied to files:
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
🧬 Code graph analysis (3)
jans-cedarling/cedarling/benches/policy_store_benchmark.rs (2)
jans-cedarling/cedarling/src/common/policy_store/loader.rs (2)
new(218-220)default(700-702)jans-cedarling/cedarling/src/common/policy_store/test_utils.rs (2)
new(60-75)default(53-55)
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rs (1)
jans-cedarling/cedarling/src/common/policy_store/vfs_adapter.rs (20)
new(82-85)new(171-174)read_file(48-53)exists(59-59)exists(134-138)exists(248-252)is_dir(62-62)is_dir(140-146)is_dir(254-260)is_file(67-67)is_file(148-154)is_file(262-268)read_dir(56-56)read_dir(112-132)read_dir(226-246)open_file(42-42)open_file(104-110)open_file(218-224)default(97-99)default(211-213)
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs (1)
jans-cedarling/cedarling/src/jwt/key_service.rs (1)
has_keys(157-159)
🔇 Additional comments (16)
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rs (3)
1-28: License header, module documentation, and imports look good.The Apache 2.0 license header with Gluu, Inc. copyright is present. The module documentation clearly explains WASM compatibility and the purpose of this VFS implementation. Imports follow the codebase patterns with std first, then external crates.
70-97: Proper path traversal prevention usingenclosed_name().The implementation correctly uses the zip crate's
enclosed_name()method to validate paths, which handles path traversal, backslashes, absolute paths, and Windows drive letters. This is the secure approach recommended by the zip crate documentation.
117-139: Native-only file loading with extension validation looks good.The
#[cfg(not(target_arch = "wasm32"))]gate is appropriate since file system access isn't available in WASM. Extension validation ensures only.cjarfiles are loaded through this path. Error handling properly captures the source IO error.jans-cedarling/cedarling/benches/policy_store_benchmark.rs (6)
1-51: License header, imports, and constants are well-structured.The Apache 2.0 license header is present. Constants are appropriately defined as byte slices for efficient archive writing. The different schema variants (basic vs. with attributes) support the varying benchmark scenarios.
52-94: Well-designed helper functions for benchmark setup.The
start_policy_store_archivehelper properly extracts common archive bootstrap logic. Theparse_archivefunction efficiently measures I/O overhead usingio::copyto sink rather than allocating buffers. Good use ofblack_boxto prevent compiler optimizations.
96-161: Archive creation helpers are well-implemented.The policy and entity archive creators properly use the extracted
start_policy_store_archivehelper. The entity batching strategy (500 per file) is reasonable for preventing excessively large JSON files. Theconcat!macro usage keeps format strings readable while avoiding line length issues.
167-182: Correct use ofiter_batchedto exclude setup overhead.The benchmark correctly uses
iter_batchedwithBatchSize::PerIterationto exclude thearchive.clone()cost from measurements. This ensures the benchmark accurately measures only ZIP parsing overhead.
199-241: Parsing benchmarks efficiently reuse archive data.The archive is created once per test case (outside the benchmark loop), and
parse_archiveoperates on a borrowed slice without cloning. This correctly measures only the parsing overhead without archive creation cost.
243-302: Proper WASM/native conditional compilation for directory benchmarks.The directory creation benchmark is correctly gated with
#[cfg(not(target_arch = "wasm32"))]. TheTempDiris passed toblack_boxto prevent premature cleanup before the benchmark iteration completes. The criterion groups are properly split for WASM vs native builds.jans-cedarling/cedarling/src/common/policy_store/issuer_parser.rs (7)
1-16: LGTM!License header is compliant. Module documentation is concise and clear. Imports follow the expected grouping pattern.
17-27: LGTM!Clean data structure with appropriate derives and documentation for each field.
28-69: LGTM!The namespace pattern using a unit struct is idiomatic. Error handling with contextual file information is well-implemented. Pre-allocation of the result vector is a good optimization.
71-137: LGTM!Required field validation is well-structured with clear error messages. The optional handling of
descriptionandtoken_metadataaligns with the design for supporting JWKS-only configurations.
200-229: LGTM!Duplicate detection logic is correct. The comment at lines 217-221 clearly documents the design decision to allow empty
token_metadatafor JWKS-only configurations, which aligns with the project's requirements for unsigned token authorization.
231-252: LGTM!The
EntryAPI usage is idiomatic Rust. The defensive duplicate handling with explanatory comments is appropriate. Pre-allocation optimizes performance.
254-611: LGTM!Comprehensive test coverage including:
- Happy path scenarios (simple issuer, token metadata, multiple issuers)
- Error cases (missing fields, invalid URL, invalid JSON)
- Validation scenarios (duplicates, empty token_metadata)
- Map creation
The
test_validate_issuers_no_token_metadatatest correctly validates that emptytoken_metadatais accepted for JWKS-only configurations.
…ructure - Revised the schema definitions for policies and trusted issuers to improve clarity and enforce structure. - Enhanced descriptions and types for various properties to ensure better understanding and validation. - Removed redundant definitions and streamlined the schema for easier maintenance and readability. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
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.
Actionable comments posted: 6
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
jans-cedarling/schema/policy_store_schema.json
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-12-17T13:07:08.750Z
Learnt from: pujavs
Repo: JanssenProject/jans PR: 12847
File: jans-config-api/docs/jans-config-api-swagger.yaml:15497-15498
Timestamp: 2025-12-17T13:07:08.750Z
Learning: When reviewing components like `jans-auth`, `jans-fido2`, `jans-lock` in the JanssenProject/jans repository, raise issues about missing property descriptions in API model classes, as these descriptions will be reflected in the auto-generated Swagger specifications.
Applied to files:
jans-cedarling/schema/policy_store_schema.json
📚 Learning: 2025-12-17T13:08:11.604Z
Learnt from: dagregi
Repo: JanssenProject/jans PR: 12833
File: jans-cedarling/schema/minimal_policy_store.json:13-21
Timestamp: 2025-12-17T13:08:11.604Z
Learning: In jans-cedarling/schema/cedarling_core.cedarschema, the Access_token entity intentionally includes both a `scope?: Set<String>` attribute and `tags Set<String>` declaration. This dual approach is by design, allowing scope to be accessed either as an attribute or dynamically as a tag depending on the use case.
Applied to files:
jans-cedarling/schema/policy_store_schema.json
🔇 Additional comments (3)
jans-cedarling/schema/policy_store_schema.json (3)
80-103: LGTM!The
SchemaDefinitionis well-structured with appropriate enums forencodingandcontent_type, sensible defaults, and strict validation viaadditionalProperties: false.
141-164: LGTM!The
PolicyContentdefinition is well-structured with clear documentation explaining thecedarlimitation. Consistent design withSchemaDefinition.
165-196: LGTM!The
TrustedIssuerdefinition appropriately requiresnameandopenid_configuration_endpoint, and correctly usesformat: "uri"for endpoint validation. Thetoken_metadatapatternProperties provide consistent key validation.
Signed-off-by: Haileyesus Ayanaw <85413826+haileyesus2433@users.noreply.github.com>
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.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
jans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store.rs
🧰 Additional context used
📓 Path-based instructions (2)
jans-cedarling/**/Cargo.toml
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
Build all workspace members using
cargo build --workspace
Files:
jans-cedarling/cedarling/Cargo.toml
jans-cedarling/**/*.rs
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
jans-cedarling/**/*.rs: Check formatting compliance withcargo fmt --checkand follow rustfmt settings in rustfmt.toml
Review clippy.toml for project-specific lint rules
Use rustfmt with project's rustfmt.toml settings for all Rust code
Enforce maximum line width of 100 characters in Rust code
Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Use 4-space indentation (no tabs) in all Rust code
Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Follow existing import patterns in the codebase
Use snake_case for variables, functions, and modules in Rust
Use PascalCase for types, traits, and enums in Rust
Use SCREAMING_SNAKE_CASE for constants in Rust
Follow Rust naming conventions as established by the language
Use thiserror crate for custom error types
Prefer Result<T, E> over panics for error handling
Use derive_more crate for error derivation when needed
Include context in error messages for better debugging
Use typed-builder crate for complex struct construction
Leverage serde for serialization/deserialization in Rust
Use smol_str for string optimization where appropriate in Rust
Prefer strong typing over stringly-typed APIs in Rust
Use standard Rust docstrings without Python-style sections (avoid# Arguments,# Returns)
Document public API items with docstrings focusing on 'why' not 'what'
Include examples in docstrings for complex functionality
Keep documentation concise, focusing on explanatory content rather than obvious details
Each Rust file must contain the Apache 2.0 license header with copyright attribution to Gluu, Inc.
Files:
jans-cedarling/cedarling/src/common/policy_store.rs
🧠 Learnings (27)
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Review clippy.toml for project-specific lint rules
Applied to files:
jans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Run benchmarks using `cargo bench -p cedarling`
Applied to files:
jans-cedarling/cedarling/Cargo.toml
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow existing import patterns in the codebase
Applied to files:
jans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Check formatting compliance with `cargo fmt --check` and follow rustfmt settings in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/Cargo.toml
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Generate and view documentation with `cargo doc -p cedarling --no-deps --open`
Applied to files:
jans-cedarling/cedarling/Cargo.toml
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Applied to files:
jans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/Cargo.toml : Build all workspace members using `cargo build --workspace`
Applied to files:
jans-cedarling/cedarling/Cargo.toml
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Run main crate tests with `cargo test -p cedarling`
Applied to files:
jans-cedarling/cedarling/Cargo.toml
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Leverage serde for serialization/deserialization in Rust
Applied to files:
jans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Use test_utils crate for shared test helpers
Applied to files:
jans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-04T12:17:12.662Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12797
File: jans-cedarling/AGENTS.md:82-88
Timestamp: 2025-12-04T12:17:12.662Z
Learning: In the jans-cedarling project, the AGENTS.md file is AI-generated and used only by AI agents, so markdown linting issues (such as MD031, MD040) for this file can be ignored during code reviews.
Applied to files:
jans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use smol_str for string optimization where appropriate in Rust
Applied to files:
jans-cedarling/cedarling/Cargo.toml
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Keep documentation concise, focusing on explanatory content rather than obvious details
Applied to files:
jans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-01T00:02:51.580Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12768
File: jans-cedarling/cedarling/src/common/default_entities_limits.rs:52-119
Timestamp: 2025-12-01T00:02:51.580Z
Learning: In the jans-cedarling Rust codebase, avoid Python/Java-style doc comments with explicit `# Arguments` and `# Errors` sections. The project relies on Rust's type signatures and cargo doc's automatic documentation generation.
Applied to files:
jans-cedarling/cedarling/Cargo.tomljans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-26T17:33:14.632Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12903
File: jans-cedarling/bindings/cedarling_wasm/src/lib.rs:83-97
Timestamp: 2025-12-26T17:33:14.632Z
Learning: In jans-cedarling WASM bindings (jans-cedarling/bindings/cedarling_wasm/**/*.rs), explicit documentation sections like `# Arguments` and `# Example` are acceptable because these bindings expose Rust to JavaScript consumers who benefit from more explicit parameter documentation and JavaScript usage examples.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Document public API items with docstrings focusing on 'why' not 'what'
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use snake_case for variables, functions, and modules in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use standard Rust docstrings without Python-style sections (avoid `# Arguments`, `# Returns`)
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Prefer strong typing over stringly-typed APIs in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use PascalCase for types, traits, and enums in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use SCREAMING_SNAKE_CASE for constants in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Include examples in docstrings for complex functionality
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-10-30T13:03:03.905Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12544
File: jans-cedarling/cedarling/src/tests/authorize_resource_entity.rs:65-109
Timestamp: 2025-10-30T13:03:03.905Z
Learning: In Rust, when `use tokio::test;` is present at the top of a file, the `#[test]` attribute refers to `tokio::test` (the async test macro), not the standard library's `#[test]`. This is a valid pattern for writing async tests with Tokio.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use thiserror crate for custom error types
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Build main cedarling crate using `cargo build -p cedarling`
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
📚 Learning: 2025-12-10T14:10:48.131Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12819
File: jans-cedarling/cedarling/src/common/policy_store/manager.rs:101-107
Timestamp: 2025-12-10T14:10:48.131Z
Learning: In all Rust source files under the jans-cedarling directory, avoid using println! or eprintln! because they do not work in WASM builds. Use the provided Logger API, e.g. logger.log(&System::log_msg(...)) to log messages. Ensure the logger is properly initialized in the WASM context and replace direct prints with the logger pattern in relevant code paths (especially in WASM targets).
Applied to files:
jans-cedarling/cedarling/src/common/policy_store.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: python_tests (3.11)
- GitHub Check: python_tests (3.10)
- GitHub Check: rust_tests
- GitHub Check: golang_tests
- GitHub Check: rust_benchmarks
- GitHub Check: wasm_tests
- GitHub Check: python_tests (3.10)
- GitHub Check: python_tests (3.11)
- GitHub Check: rust_tests
- GitHub Check: wasm_tests
- GitHub Check: rust_benchmarks
- GitHub Check: golang_tests
🔇 Additional comments (5)
jans-cedarling/cedarling/src/common/policy_store.rs (4)
13-13: Verify intentional public exposure of test utilities.The
test_utilsmodule is nowpubinstead ofpub(crate), exposing test utilities to external consumers. If these utilities are only intended for internal testing, consider restricting visibility topub(crate).Based on learnings, test utilities should typically use the
test_utilscrate pattern for shared helpers within the project.
46-48: LGTM! Clear public API surface.The re-exports are well-documented and appropriately expose the required types for external consumers and internal modules.
195-209: LGTM! Well-integrated metadata support.The optional
metadatafield properly supports the new directory/archive format while maintaining backward compatibility with legacy stores. The documentation clearly explains when metadata is present.
476-504: LGTM! Constructors properly support format conversion.The constructors correctly support converting from the new directory/archive format to the legacy format:
new()properly maps descriptions while creating empty policy content (consistent with the TODO about not needing raw content at runtime)new_empty()handles cases without descriptionsBoth implementations are straightforward and correct.
jans-cedarling/cedarling/Cargo.toml (1)
85-88: Benchmark file is properly implemented and ready for execution.The
policy_store_benchmark.rsfile exists and is correctly structured with criterion benchmarks, appropriate use of tempfile for test data generation, and proper documentation.
…agement - Updated `CedarSchema` to use an optional `ValidatorSchema` for better compatibility with WebAssembly targets. - Improved error handling in `archive_handler` by refining path validation and ensuring clearer error messages. - Enhanced entity and issuer parsing tests to ensure proper validation and error reporting for invalid JSON structures. - Streamlined logging conditions in the policy store loader for unlisted files. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
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.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
jans-cedarling/cedarling/src/jwt/status_list.rs (1)
178-178: Fix typo in documentation.The word "stull" should be "still".
🔎 Proposed fix
- /// Helper function to figure out if the JWT is stull valid based on it's status + /// Helper function to figure out if the JWT is still valid based on it's status
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (10)
jans-cedarling/cedarling/src/common/cedar_schema/mod.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/loader.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/init/service_factory.rsjans-cedarling/cedarling/src/jwt/status_list.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
🧰 Additional context used
📓 Path-based instructions (2)
jans-cedarling/**/*.rs
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
jans-cedarling/**/*.rs: Check formatting compliance withcargo fmt --checkand follow rustfmt settings in rustfmt.toml
Review clippy.toml for project-specific lint rules
Use rustfmt with project's rustfmt.toml settings for all Rust code
Enforce maximum line width of 100 characters in Rust code
Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Use 4-space indentation (no tabs) in all Rust code
Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Follow existing import patterns in the codebase
Use snake_case for variables, functions, and modules in Rust
Use PascalCase for types, traits, and enums in Rust
Use SCREAMING_SNAKE_CASE for constants in Rust
Follow Rust naming conventions as established by the language
Use thiserror crate for custom error types
Prefer Result<T, E> over panics for error handling
Use derive_more crate for error derivation when needed
Include context in error messages for better debugging
Use typed-builder crate for complex struct construction
Leverage serde for serialization/deserialization in Rust
Use smol_str for string optimization where appropriate in Rust
Prefer strong typing over stringly-typed APIs in Rust
Use standard Rust docstrings without Python-style sections (avoid# Arguments,# Returns)
Document public API items with docstrings focusing on 'why' not 'what'
Include examples in docstrings for complex functionality
Keep documentation concise, focusing on explanatory content rather than obvious details
Each Rust file must contain the Apache 2.0 license header with copyright attribution to Gluu, Inc.
Files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/cedar_schema/mod.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/init/service_factory.rsjans-cedarling/cedarling/src/jwt/status_list.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
jans-cedarling/**/*test*.rs
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
jans-cedarling/**/*test*.rs: Use test_utils crate for shared test helpers
Include both positive and negative test cases in test files
For error checking in tests, useassert!(matches!(...), "explicit comment")instead ofassert!(result.is_err())
Useexpect_err("explicit comment")instead ofpanic()in tests
Always include explicit comments explaining what error is expected in test assertions
Files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rs
🧠 Learnings (36)
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Use `expect_err("explicit comment")` instead of `panic()` in tests
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : For error checking in tests, use `assert!(matches!(...), "explicit comment")` instead of `assert!(result.is_err())`
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Always include explicit comments explaining what error is expected in test assertions
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/jwt/status_list.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Include both positive and negative test cases in test files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/src/tests/**/*.rs : Place integration tests in src/tests/ directory
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/authorize_*.rs : Follow existing test patterns in authorize_*.rs files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Prefer Result<T, E> over panics for error handling
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Include context in error messages for better debugging
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Use test_utils crate for shared test helpers
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Review clippy.toml for project-specific lint rules
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Run specific test files using `cargo test -p cedarling --test authorize_unsigned` format
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Run main crate tests with `cargo test -p cedarling`
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Run benchmarks using `cargo bench -p cedarling`
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Leverage serde for serialization/deserialization in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/cedar_schema/mod.rs
📚 Learning: 2025-12-10T14:10:48.131Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12819
File: jans-cedarling/cedarling/src/common/policy_store/manager.rs:101-107
Timestamp: 2025-12-10T14:10:48.131Z
Learning: In all Rust source files under the jans-cedarling directory, avoid using println! or eprintln! because they do not work in WASM builds. Use the provided Logger API, e.g. logger.log(&System::log_msg(...)) to log messages. Ensure the logger is properly initialized in the WASM context and replace direct prints with the logger pattern in relevant code paths (especially in WASM targets).
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/test.rsjans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/cedar_schema/mod.rsjans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rsjans-cedarling/cedarling/src/common/policy_store/test_utils.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/init/service_factory.rsjans-cedarling/cedarling/src/jwt/status_list.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow existing import patterns in the codebase
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/cedar_schema/mod.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow Rust naming conventions as established by the language
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use thiserror crate for custom error types
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/cedar_schema/mod.rs
📚 Learning: 2025-12-04T12:17:12.662Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12797
File: jans-cedarling/AGENTS.md:82-88
Timestamp: 2025-12-04T12:17:12.662Z
Learning: In the jans-cedarling project, the AGENTS.md file is AI-generated and used only by AI agents, so markdown linting issues (such as MD031, MD040) for this file can be ignored during code reviews.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/archive_handler.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-26T17:33:20.543Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12903
File: jans-cedarling/bindings/cedarling_wasm/src/lib.rs:83-97
Timestamp: 2025-12-26T17:33:20.543Z
Learning: In jans-cedarling WASM bindings (jans-cedarling/bindings/cedarling_wasm/**/*.rs), explicit documentation sections like `# Arguments` and `# Example` are acceptable because these bindings expose Rust to JavaScript consumers who benefit from more explicit parameter documentation and JavaScript usage examples.
Applied to files:
jans-cedarling/cedarling/src/common/cedar_schema/mod.rsjans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use PascalCase for types, traits, and enums in Rust
Applied to files:
jans-cedarling/cedarling/src/common/cedar_schema/mod.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use derive_more crate for error derivation when needed
Applied to files:
jans-cedarling/cedarling/src/common/cedar_schema/mod.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Keep documentation concise, focusing on explanatory content rather than obvious details
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use standard Rust docstrings without Python-style sections (avoid `# Arguments`, `# Returns`)
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-01T00:02:51.580Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12768
File: jans-cedarling/cedarling/src/common/default_entities_limits.rs:52-119
Timestamp: 2025-12-01T00:02:51.580Z
Learning: In the jans-cedarling Rust codebase, avoid Python/Java-style doc comments with explicit `# Arguments` and `# Errors` sections. The project relies on Rust's type signatures and cargo doc's automatic documentation generation.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Document public API items with docstrings focusing on 'why' not 'what'
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Include examples in docstrings for complex functionality
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use 4-space indentation (no tabs) in all Rust code
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Check formatting compliance with `cargo fmt --check` and follow rustfmt settings in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Enforce maximum line width of 100 characters in Rust code
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-11-28T05:59:26.842Z
Learnt from: haileyesus2433
Repo: JanssenProject/jans PR: 12455
File: jans-cedarling/cedarling/src/jwt/mod.rs:143-145
Timestamp: 2025-11-28T05:59:26.842Z
Learning: In jans-cedarling JWT service, the local-JWKS-only configuration (no trusted issuers) loads keys but does not initialize validators. This means signed tokens will hit ValidateJwtError::MissingValidator and be skipped. This is acceptable as the intended use case is authorize_unsigned. Validator setup for JWKS-only signed authorization is planned for future implementation.
Applied to files:
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Applied to files:
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rsjans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-24T14:16:17.748Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12896
File: jans-cedarling/cedarling/src/entity_builder/trusted_issuer_index.rs:23-30
Timestamp: 2025-12-24T14:16:17.748Z
Learning: In jans-cedarling Rust code targeting WASM, avoid using `eprintln!` for warnings in constructors or initialization functions. Instead, accept an `Option<&Arc<LogStrategy>>` parameter and use `logger.log_any(LogEntry::new_with_data(LogType::System, None).set_message(...).set_log_level(LogLevel::WARN))` to emit warnings that work in WASM environments.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use smol_str for string optimization where appropriate in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/loader.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Prefer strong typing over stringly-typed APIs in Rust
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/loader.rs
🧬 Code graph analysis (3)
jans-cedarling/cedarling/src/common/policy_store/test.rs (2)
jans-cedarling/cedarling/src/common/policy_store/manager.rs (1)
parse_cedar_version(396-404)jans-cedarling/cedarling/src/common/policy_store.rs (1)
parse_cedar_version(312-325)
jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rs (2)
jans-cedarling/cedarling/src/common/policy_store/test_utils.rs (5)
create_corrupted_archive(418-423)create_deep_nested_archive(426-439)create_path_traversal_archive(404-415)new(59-74)default(52-54)jans-cedarling/cedarling/src/common/policy_store/archive_handler.rs (2)
from_buffer(167-170)from_file(129-150)
jans-cedarling/cedarling/src/init/service_factory.rs (3)
jans-cedarling/cedarling/src/common/policy_store.rs (1)
new(476-494)jans-cedarling/cedarling/src/entity_builder/mod.rs (1)
new(62-93)jans-cedarling/cedarling/src/lib.rs (1)
new(115-161)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
- GitHub Check: build-with-disabled-tests (jans-bom, true)
- GitHub Check: run-tests (PGSQL)
- GitHub Check: run-tests (MYSQL)
- GitHub Check: python_tests (3.11)
- GitHub Check: rust_tests
- GitHub Check: python_tests (3.10)
- GitHub Check: golang_tests
- GitHub Check: golang_tests
- GitHub Check: rust_benchmarks
- GitHub Check: rust_tests
- GitHub Check: rust_benchmarks
- GitHub Check: wasm_tests
- GitHub Check: python_tests (3.11)
- GitHub Check: wasm_tests
- GitHub Check: python_tests (3.10)
🔇 Additional comments (58)
jans-cedarling/cedarling/src/jwt/status_list.rs (1)
334-334: The TTL value change from 600 to 300 is correct. TheMockServer::generate_status_list_endpointmethod (jans-cedarling/cedarling/src/jwt/test_utils.rs, line 262) explicitly defaults to 300 seconds when thettlparameter isNone, as documented in the comment: "defaults to 5 mins if the ttl is None". The test assertion expectingSome(300)is accurate.jans-cedarling/cedarling/src/common/cedar_schema/mod.rs (3)
6-7: LGTM! Correct conditional import for WASM compatibility.The
Extensionsimport is appropriately gated for non-wasm32 targets only, aligning with its usage at line 164 whereValidatorSchemais initialized.
53-53: LGTM! Clean WASM-compatible validator schema handling.The
Option<ValidatorSchema>approach correctly handles target differences:
- Non-wasm32 targets populate the validator schema with full validation
- wasm32 targets skip validator schema initialization (set to
None)- Mutually exclusive
cfgblocks ensure the field is always initializedThis maintains consistent API surface while accommodating WASM constraints.
Also applies to: 162-176
197-199: LGTM! Error variant correctly gated for non-WASM targets.The
ParseCedarSchemaJsonerror variant is appropriately conditional, matching its usage at line 168 whereValidatorSchema::from_json_stris called only on non-wasm32 targets.jans-cedarling/cedarling/src/init/service_factory.rs (2)
14-16: LGTM! Clean metadata accessor for new policy store format.The new
policy_store_metadata()method appropriately:
- Exposes
PolicyStoreMetadatawhen available (directory/archive formats)- Returns
Optionto handle legacy formats that lack metadata- Includes clear documentation explaining availability
Also applies to: 64-70
115-115: LGTM! Correct Option handling for validator schema.The change from
&policy_store.schema.validator_schemato.as_ref()correctly adapts to theOption<ValidatorSchema>type introduced incedar_schema/mod.rs. This properly converts toOption<&ValidatorSchema>as expected byEntityBuilder::new().Also applies to: 119-119
jans-cedarling/cedarling/src/common/policy_store/test.rs (10)
88-96: LGTM!The change from
unwrap_err()toexpect_err()with an explicit error message follows the project's test guidelines. The assertion clearly verifies that the error contains the expected base64 decoding failure message.Based on learnings, as per coding guidelines for test files.
159-175: LGTM!The error handling follows the project's test guidelines with
expect_err()and explicit error messages. The assertions provide clear failure messages that identify both the failing policy ID and the specific syntax error.Based on learnings, as per coding guidelines for test files.
196-228: LGTM!All three version parsing error tests correctly use
expect_err()with explicit, descriptive messages explaining the expected failure. The assertions verify that error messages contain the expected "error parsing cedar version" text, and each test case covers a distinct invalid version format scenario.Based on learnings, as per coding guidelines for test files.
267-301: LGTM!The missing field validation tests properly use
expect_err()with explicit messages for both test cases (missing cedar_version and missing policy_stores). The assertions verify that error messages correctly identify which required field is missing, with clear failure messages for debugging.Based on learnings, as per coding guidelines for test files.
306-368: LGTM!The invalid policy store entry tests correctly validate three distinct missing field scenarios (name, schema, policies) using
expect_err()with explicit messages. Each assertion verifies the appropriate missing field error message, and the comments clearly separate the test cases.Based on learnings, as per coding guidelines for test files.
385-390: LGTM!The test properly uses
expect_err()with an explicit message and verifies that the error contains the expected "invalid cedar_version format" text.Based on learnings, as per coding guidelines for test files.
407-412: LGTM!The test properly uses
expect_err()with an explicit message and verifies that the error contains the expected "error parsing schema" text.Based on learnings, as per coding guidelines for test files.
435-440: LGTM!The test properly uses
expect_err()with an explicit message and verifies that the error contains the expected "unable to decode policy with id" text, which appropriately identifies policy decoding failures.Based on learnings, as per coding guidelines for test files.
465-471: LGTM!The test properly uses
expect_err()with an explicit message and verifies that the error contains the expected invalid URL message for the openid_configuration_endpoint field.Based on learnings, as per coding guidelines for test files.
142-149: The test correctly checks forParsePolicySetMessage::String, which is the proper error variant for UTF-8 parsing failures. The enum variant is explicitly documented as "Indicates failure to decode policy content to a UTF-8 string," and the error handling code at line 594 of policy_store.rs maps UTF-8 decoding errors to this variant. NoParsePolicySetMessage::Utf8variant exists in the codebase.Likely an incorrect or invalid review comment.
jans-cedarling/cedarling/src/jwt/validation/trusted_issuer_validator.rs (14)
1-18: LGTM!License header and module documentation are well-structured and comply with project guidelines.
19-34: LGTM!Imports are properly grouped following the project guidelines: std crates first, then external crates, then internal modules.
36-107: LGTM!Error enum is well-designed using
thiserrorwith descriptive, contextual error messages. The structured error variants support debugging and error handling.
109-119: LGTM!Result type alias and JWKS cache duration constants are well-defined with sensible bounds.
121-143: LGTM!Struct design is well-thought-out with the reverse lookup map (
url_to_issuer) for O(1) issuer matching and per-endpoint JWKS timing for correct multi-issuer support.
145-195: LGTM!Constructor implementation correctly builds both forward and reverse lookup maps with proper URL normalization. The pre-allocation with
HashMap::with_capacityis a good performance optimization.
197-220: LGTM!Issuer lookup is efficient with O(1) HashMap lookups and proper URL normalization. The fallback from ID match to URL match handles common issuer claim formats.
222-249: LGTM!OIDC configuration fetching with caching is correctly implemented. The cache-first approach and Arc wrapping for shared ownership are appropriate.
One consideration: OIDC configs are cached indefinitely. This is generally acceptable since these configurations change infrequently, and JWKS keys (which do change) have their own TTL-based refresh logic.
314-325: LGTM!Clean delegation to the standalone function, allowing both instance-based and standalone usage patterns.
345-369: LGTM!Standalone validation function correctly validates entity type configuration and required claims. The separation between "mapping fields" (hints for extraction) and "required claims" (strictly validated) is well-documented.
383-469: LGTM with minor observation on audience validation.The validation flow is correctly structured:
- Header decode → issuer extraction → trusted issuer lookup
- JWKS preload → signature verification
- Required claims validation (correctly placed after signature verification)
The
validate_aud = falseon line 459 disables audience validation. This is acceptable if audience validation is handled elsewhere or not required by the use case, but consider documenting this decision.
482-517: LGTM!Test utilities are well-designed with
create_test_issuerandcreate_test_issuer_with_metadataproviding flexible test data setup.
917-996: LGTM!Comprehensive integration test covering the full validation flow with mocked OIDC and JWKS endpoints. The test correctly validates that missing required claims (defined in
required_claimsset) are caught after signature verification.
291-299: No action needed. The logger pattern safely handles theNonecase via the explicitLogWriterimplementation forOption<Arc<LogStrategy>>, which usesif let Some(logger)to gracefully skip logging when the logger is unavailable.jans-cedarling/cedarling/src/common/policy_store/archive_security_tests.rs (6)
1-28: LGTM! Well-structured security test module.The file has proper Apache 2.0 license header, clear module documentation explaining what the tests cover (path traversal, malicious archives, input validation, resource exhaustion), and appropriate imports. The organization into submodules by concern is clean.
34-131: Path traversal tests are comprehensive and follow coding guidelines.Tests cover parent directory traversal, absolute paths, double-dot sequences, and Windows-style separators. All assertions use
expect_err()with explicit comments andmatches!()with descriptive messages as required by coding guidelines.
137-235: LGTM! Comprehensive malicious archive handling tests.Good coverage of edge cases including corrupted ZIPs, non-ZIP files, empty files, empty ZIPs, deeply nested paths (100 levels), and long filenames (1000 chars). The deeply nested path test correctly validates file content after loading.
241-410: LGTM! Input validation tests cover important error scenarios.Tests properly validate rejection of invalid JSON, invalid Cedar syntax, invalid entities, invalid trusted issuers, and duplicate entity UIDs. The unicode filename and special character tests verify graceful handling of edge cases. Error assertions follow the coding guidelines pattern.
416-576: LGTM! Manifest security tests properly validate integrity checking.The checksum mismatch test correctly modifies a file post-archive-extraction to trigger the validation error. Tests appropriately use
#[cfg(not(target_arch = "wasm32"))]since they require filesystem access. Error matching uses the full path toManifestErrorTypevariants which is clear and explicit.
582-710: LGTM! Resource exhaustion and extension validation tests are well-designed.Resource exhaustion tests cover 100 policies, large policy conditions (1000 attribute checks), and 50-level entity hierarchies. File extension validation correctly tests rejection of
.zipand acceptance of.cjar. Tests appropriately use#[cfg(not(target_arch = "wasm32"))]for file-based tests.jans-cedarling/cedarling/src/common/policy_store/archive_handler.rs (5)
1-52: LGTM! Well-documented module with clear WASM compatibility notes.The module documentation clearly explains the WASM support model, and the
ArchiveVfs<T>struct is properly documented with thread safety notes. UsingMutex<ZipArchive<T>>is appropriate for thread-safe access.
71-108: LGTM! Path traversal protection uses recommendedenclosed_name()API.The implementation correctly uses
file.enclosed_name()from the zip crate to validate and normalize paths, which properly handles path traversal, backslashes, and absolute paths. The additional check for".."sequences provides defense-in-depth.
128-151: LGTM! Extension validation and file opening are correct.The
from_fileconstructor properly validates the.cjarextension before attempting to open the file, and uses appropriate error types. The#[cfg(not(target_arch = "wasm32"))]attribute correctly restricts this to native platforms.
264-385: LGTM! VfsFileSystem implementation handles mutex poisoning gracefully.The implementation properly handles mutex poisoning by returning errors or false values rather than panicking. The two-pass algorithm in
read_dirwithis_directory_lockedhelper correctly avoids deadlocks. Theopen_fileimplementation appropriately reads file content and wraps it in aCursorfor theReadtrait.
387-608: LGTM! Comprehensive test coverage for ArchiveVfs.Tests cover valid archive creation, invalid ZIP handling, path traversal rejection, file reading, existence checks, directory detection, directory listing, extension validation, and complex directory structures. The test helper
create_test_archiveis well-designed for building test fixtures.jans-cedarling/cedarling/src/common/policy_store/loader.rs (5)
1-27: LGTM! Clean module documentation and imports.The module documentation clearly explains the internal API nature and archive loading design. Import ordering follows the project convention with
std::path::Pathfirst, then internalsuper::imports.
161-205: LGTM! Clean data structures for loaded policy store components.The
LoadedPolicyStoreand related file structures are well-documented and appropriately designed. UsingStringfor file names and content is acceptable.
301-363: LGTM! Directory structure validation is thorough.The
validate_directory_structuremethod properly checks for directory existence, required files (metadata.json,schema.cedarschema), and required directories (policies/). Error messages are clear and actionable.
626-657: LGTM!load_directoryorchestrates loading correctly.The method validates directory structure first, then loads all components in a logical order. Documentation correctly notes that manifest validation is not performed here and should be called separately for backends that need it.
659-708: LGTM! Test helpers are appropriately scoped with#[cfg(test)].The test-only helper functions provide convenient wrappers around
PolicyParsermethods. TheDefaultimplementation forPhysicalVfsloader is a nice convenience for native platforms.jans-cedarling/cedarling/src/common/policy_store/test_utils.rs (5)
1-49: LGTM! Well-documented test utilities module with clear builder pattern.The
PolicyStoreTestBuilderstruct has all necessary fields for creating test policy stores, including support for manifest generation and extra files. Public fields enable direct manipulation when needed.
159-282: LGTM! Builder implementation correctly generates metadata, manifest, and archives.The
build_metadata_jsoncreates valid JSON structure with optional description. Thebuild_manifest_jsoncorrectly computes SHA-256 checksums for all files except itself. Thebuild_archivemethod properly creates a ZIP archive with Deflated compression and handles errors viaPolicyStoreError::Io.
288-397: LGTM! Fixtures provide comprehensive test scenarios.The fixtures module provides both valid scenarios (
minimal_valid,with_multiple_policies,with_multiple_entities) and invalid scenarios (invalid_metadata_json,invalid_policy_syntax,duplicate_entity_uids,invalid_trusted_issuer). This follows the coding guidelines for including both positive and negative test cases.
403-525: LGTM! Archive and performance utilities are well-designed.The archive utilities (
create_path_traversal_archive,create_corrupted_archive,create_deep_nested_archive) are useful for security testing. Thecreate_large_policy_storefunction generates realistic large stores with proper issuer configuration includingopenid_configuration_endpointandentity_type_name.
527-594: LGTM! Tests validate builder and utility functionality.Tests cover metadata JSON generation, archive creation (verifying ZIP magic number), fixture behavior, and utility functions. The tests are appropriately simple for validating test utilities.
jans-cedarling/cedarling/src/common/policy_store/manager.rs (7)
1-40: LGTM! Clear module documentation and appropriate imports.The architecture diagram in the module docs clearly shows the conversion mapping from
LoadedPolicyStoretoPolicyStore. Imports are well-organized with conditional compilation for WASM-incompatible types.
41-67: LGTM! ConversionError enum uses thiserror correctly.The error enum covers all conversion failure scenarios with clear, descriptive messages. Using
thiserrorfor derive follows the coding guidelines for custom error types.
171-229: LGTM! Schema conversion with documented performance tradeoff.The implementation correctly documents the double-parsing at lines 191-194, acknowledging it as a performance consideration rather than a correctness issue. The WASM-conditional
ValidatorSchemacreation is handled appropriately.
236-279: LGTM! Policy and template conversion handles all cases correctly.The implementation properly handles the empty case, parses policies and templates with error context, creates the combined
PolicySet, and builds theraw_policy_infomap. Error messages include the filename for debugging.
315-404: LGTM! Entity conversion with comprehensive validation pipeline.The 5-step entity conversion process is well-documented: parse → detect duplicates → validate hierarchy (non-fatal) → create store validation → convert to HashMap. The clone at line 352 is explained in the comment. Error messages include content truncation for debugging large entities.
407-739: LGTM! Comprehensive test coverage for all conversion scenarios.Tests cover valid and invalid cases for version parsing, schema conversion, policy/template conversion, issuer conversion, entity conversion, and full end-to-end conversion. Error assertions use
expect_err()withmatches!()pattern following coding guidelines.
110-160: No action needed -logger.log_any()pattern is correct.The code correctly uses
logger.log_any()onOption<Logger>(which isOption<Arc<LogStrategy>>). This works through a blanket trait implementation ofLogWriterforOption<Arc<LogStrategy>>defined inlog/interface.rs:31-36, which safely handles theNonecase. This is idiomatic Rust and is used consistently throughout the codebase.Likely an incorrect or invalid review comment.
…ecessary conditionals - Updated `CedarSchema` and `PolicyStoreManager` to use a non-optional `ValidatorSchema`, simplifying the code and improving clarity. - Removed conditional compilation for WebAssembly targets related to `ValidatorSchema`, ensuring consistent behavior across platforms. - Enhanced logging and error handling in the schema deserialization process. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
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.
Actionable comments posted: 2
♻️ Duplicate comments (1)
jans-cedarling/cedarling/src/common/policy_store/manager.rs (1)
108-158: Fix docstring format to comply with Rust conventions.The
# Arguments,# Returns, and# Errorssections (lines 95-107) use Python-style documentation format. Per the coding guidelines, use standard Rust docstrings without these Python-style sections. Rewrite to focus on explaining the 'why' in narrative form:/// Converts a loaded policy store to the legacy format with optional logging. /// /// This function orchestrates the conversion of all policy store components /// (schema, policies, issuers, entities) from the new directory/archive format /// into the legacy format used by existing Cedarling services. If a logger is /// provided, it logs key conversion milestones and validation warnings. /// /// # Errors /// /// Returns `ConversionError` if schema, policy, issuer, entity, or Cedar version /// conversion fails.The logger.log_any() calls on lines 114, 141, and 353 work correctly with
Option<Logger>due to the LogWriter trait implementation forOption<Arc<LogStrategy>>.
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
jans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/init/service_factory.rs
🧰 Additional context used
📓 Path-based instructions (1)
jans-cedarling/**/*.rs
📄 CodeRabbit inference engine (jans-cedarling/AGENTS.md)
jans-cedarling/**/*.rs: Check formatting compliance withcargo fmt --checkand follow rustfmt settings in rustfmt.toml
Review clippy.toml for project-specific lint rules
Use rustfmt with project's rustfmt.toml settings for all Rust code
Enforce maximum line width of 100 characters in Rust code
Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Use 4-space indentation (no tabs) in all Rust code
Group imports with std/external crates first, then internal modules, using imports_granularity = "Module"
Follow existing import patterns in the codebase
Use snake_case for variables, functions, and modules in Rust
Use PascalCase for types, traits, and enums in Rust
Use SCREAMING_SNAKE_CASE for constants in Rust
Follow Rust naming conventions as established by the language
Use thiserror crate for custom error types
Prefer Result<T, E> over panics for error handling
Use derive_more crate for error derivation when needed
Include context in error messages for better debugging
Use typed-builder crate for complex struct construction
Leverage serde for serialization/deserialization in Rust
Use smol_str for string optimization where appropriate in Rust
Prefer strong typing over stringly-typed APIs in Rust
Use standard Rust docstrings without Python-style sections (avoid# Arguments,# Returns)
Document public API items with docstrings focusing on 'why' not 'what'
Include examples in docstrings for complex functionality
Keep documentation concise, focusing on explanatory content rather than obvious details
Each Rust file must contain the Apache 2.0 license header with copyright attribution to Gluu, Inc.
Files:
jans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/init/service_factory.rs
🧠 Learnings (17)
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Review clippy.toml for project-specific lint rules
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Keep documentation concise, focusing on explanatory content rather than obvious details
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use standard Rust docstrings without Python-style sections (avoid `# Arguments`, `# Returns`)
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-01T00:02:51.580Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12768
File: jans-cedarling/cedarling/src/common/default_entities_limits.rs:52-119
Timestamp: 2025-12-01T00:02:51.580Z
Learning: In the jans-cedarling Rust codebase, avoid Python/Java-style doc comments with explicit `# Arguments` and `# Errors` sections. The project relies on Rust's type signatures and cargo doc's automatic documentation generation.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Document public API items with docstrings focusing on 'why' not 'what'
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-26T17:33:20.543Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12903
File: jans-cedarling/bindings/cedarling_wasm/src/lib.rs:83-97
Timestamp: 2025-12-26T17:33:20.543Z
Learning: In jans-cedarling WASM bindings (jans-cedarling/bindings/cedarling_wasm/**/*.rs), explicit documentation sections like `# Arguments` and `# Example` are acceptable because these bindings expose Rust to JavaScript consumers who benefit from more explicit parameter documentation and JavaScript usage examples.
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Include examples in docstrings for complex functionality
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use 4-space indentation (no tabs) in all Rust code
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Check formatting compliance with `cargo fmt --check` and follow rustfmt settings in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Use HorizontalVertical imports layout with StdExternalCrate grouping in rustfmt.toml
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Include both positive and negative test cases in test files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*test*.rs : Always include explicit comments explaining what error is expected in test assertions
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Enforce maximum line width of 100 characters in Rust code
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/authorize_*.rs : Follow existing test patterns in authorize_*.rs files
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T08:24:27.240Z
Learnt from: CR
Repo: JanssenProject/jans PR: 0
File: jans-cedarling/AGENTS.md:0-0
Timestamp: 2025-12-10T08:24:27.240Z
Learning: Applies to jans-cedarling/**/*.rs : Follow existing import patterns in the codebase
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rs
📚 Learning: 2025-12-10T14:10:48.131Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12819
File: jans-cedarling/cedarling/src/common/policy_store/manager.rs:101-107
Timestamp: 2025-12-10T14:10:48.131Z
Learning: In all Rust source files under the jans-cedarling directory, avoid using println! or eprintln! because they do not work in WASM builds. Use the provided Logger API, e.g. logger.log(&System::log_msg(...)) to log messages. Ensure the logger is properly initialized in the WASM context and replace direct prints with the logger pattern in relevant code paths (especially in WASM targets).
Applied to files:
jans-cedarling/cedarling/src/common/policy_store/manager.rsjans-cedarling/cedarling/src/init/service_factory.rs
📚 Learning: 2025-12-24T14:16:17.748Z
Learnt from: olehbozhok
Repo: JanssenProject/jans PR: 12896
File: jans-cedarling/cedarling/src/entity_builder/trusted_issuer_index.rs:23-30
Timestamp: 2025-12-24T14:16:17.748Z
Learning: In jans-cedarling Rust code targeting WASM, avoid using `eprintln!` for warnings in constructors or initialization functions. Instead, accept an `Option<&Arc<LogStrategy>>` parameter and use `logger.log_any(LogEntry::new_with_data(LogType::System, None).set_message(...).set_log_level(LogLevel::WARN))` to emit warnings that work in WASM environments.
Applied to files:
jans-cedarling/cedarling/src/init/service_factory.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: wasm_tests
- GitHub Check: golang_tests
- GitHub Check: python_tests (3.10)
- GitHub Check: python_tests (3.11)
- GitHub Check: rust_tests
- GitHub Check: rust_benchmarks
🔇 Additional comments (10)
jans-cedarling/cedarling/src/init/service_factory.rs (3)
14-16: LGTM: Import addition follows project conventions.The addition of
PolicyStoreMetadatato the existingcrate::common::policy_storeimport follows the module-level imports grouping pattern established in the coding guidelines.
64-70: LGTM: Well-documented accessor method.The new
policy_store_metadata()method is a clean, idiomatic accessor that properly returnsOption<&PolicyStoreMetadata>. The documentation effectively explains when metadata is available versus when it's not, focusing on the 'why' as recommended by the coding guidelines.
104-108: LGTM: Formatting improvement with proper WASM-compatible logging.The reformatted log entry construction improves readability while maintaining correct usage of the Logger API (avoiding
println!/eprintln!), which is essential for WASM compatibility as noted in the project learnings.jans-cedarling/cedarling/src/common/policy_store/manager.rs (7)
1-21: LGTM!The license header and module documentation are well-structured. The architecture diagram effectively illustrates the conversion mapping between new and legacy formats.
22-37: LGTM!Imports are properly organized following the project's conventions with external crates grouped before internal modules.
39-65: LGTM!The
ConversionErrorenum follows project conventions withthiserrorderivation and provides clear, contextual error messages for each failure mode.
169-222: LGTM!The schema conversion logic is correct, and the double-parsing tradeoff is appropriately documented. Error handling provides good context at each step.
274-306: LGTM!The issuer conversion correctly aggregates issuers from multiple files, validates for duplicates, and provides clear error messages with joined validation errors.
388-398: LGTM!The version parsing correctly handles the optional "v" prefix and provides clear error context including both the invalid version string and parsing details.
341-364: No issues identified. The code correctly usesall_parsed_entitieson line 361 (shown as line 62 in full context) because the?operator on line 346 ensures the function returns early ifdetect_duplicatesfinds any duplicates. By the time line 361 executes,all_parsed_entitiesis guaranteed to be duplicate-free. The clone strategy is intentional: cloning preserves the original for hierarchy validation while detecting duplicates, then failing fast if any are found. The code is sound.
…asurement - Reduced policy counts in benchmark tests to [5, 10] to ensure execution stays under the 1ms threshold. - Updated comments to clarify the rationale behind keeping policy counts low for more accurate benchmarking. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com> Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
| for entry in entries { | ||
| if !entry.is_dir { | ||
| // Validate .json extension | ||
| if !entry.name.ends_with(".json") { |
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.
Have you considered making this check case-insensitive, although the chances of this happening is low what if the file extension is .JSON this would fail
| self.load_cedar_files_recursive(&entry.path, files)?; | ||
| } else { | ||
| // Validate .cedar extension | ||
| if !entry.name.ends_with(".cedar") { |
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.
Case-sensitive comparison here
| for entry in entries { | ||
| if !entry.is_dir { | ||
| // Validate .json extension | ||
| if !entry.name.ends_with(".json") { |
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.
The same idea here as well
| source: PolicyStoreSource::LockServer(policy_store_uri), | ||
| // Case: get the policy store from a URI (auto-detect .cjar archives) | ||
| (None, Some(policy_store_uri), None) => { | ||
| let source = if policy_store_uri.to_lowercase().ends_with(".cjar") { |
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 might be an edgecase but what if the url is used to fetch a policy store from a lock server and it ends with .cjar wouldn't this just fail?
| source: PolicyStoreSource::LockServer(policy_store_uri), | ||
| // Case: get the policy store from a URI (auto-detect .cjar archives) | ||
| (None, Some(policy_store_uri), None) => { | ||
| let source = if policy_store_uri.to_lowercase().ends_with(".cjar") { |
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.
Also another comment I have is if we want to load an archive from a url we shouldn't check if it ends with a .cjar or not but if the url points to a policy store file or if it's an archive
…rusted issuer files - Introduced new sections in the policy store documentation to explain the structure and requirements for template files, entity files, and trusted issuer configuration files. - Provided examples for each file type to enhance clarity and understanding of their formats and attributes. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
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.
Actionable comments posted: 4
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
docs/cedarling/reference/cedarling-policy-store.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: python_tests (3.11)
- GitHub Check: python_tests (3.10)
- GitHub Check: rust_benchmarks
- GitHub Check: Deploy docs
- GitHub Check: golang_tests
- GitHub Check: wasm_tests
- GitHub Check: rust_tests
- GitHub Check: python_tests (3.10)
- GitHub Check: rust_tests
- GitHub Check: wasm_tests
- GitHub Check: rust_benchmarks
- GitHub Check: golang_tests
- GitHub Check: python_tests (3.11)
🔇 Additional comments (1)
docs/cedarling/reference/cedarling-policy-store.md (1)
241-253: Verify Rust and WASM function names and signatures match implementation.Line 246 references
load_policy_store_archive_bytes()and line 245 referencesinit_from_archive_bytes()for WASM. These function names and their exact signatures should be verified against the actual implementation to ensure documentation accuracy.The documentation references external APIs that should be validated. Can you confirm:
- Does the Rust implementation export
PolicyStoreSource::ArchiveBytesvariant andload_policy_store_archive_bytes()function?- Does the WASM binding export
init_from_archive_bytes()function with the documented signature?- Are these the official public API functions users should call?
| import "C" | ||
| ``` | ||
| ```go | ||
| // #cgo LDFLAGS: -L. -lcedarling_go |
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.
We have changed indentation from 4 spaces to 3, why?
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 other places indentation also changed for no reason
|
|
||
| AuthorizeMultiIssuerRequest | ||
| =========================== | ||
| ## Policy Store Sources |
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.
this file is autogenerated by python3 ./print_documentation.py > ./PYTHON_TYPES.md . So, eventually any comment will we rewritten by that command.
| } | ||
| ``` | ||
|
|
||
| **manifest.json structure (optional, for integrity validation):** |
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.
I think we can add link to the documentation, for this topic.
Same to other files.
| } | ||
| ``` | ||
|
|
||
| #### Cedar Archive (.cjar) Format |
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.
I think we can add link to the documentation, for this topic.
Same to other files.
| * @param config - Bootstrap configuration (policy store config is ignored) | ||
| * @param archive_bytes - The .cjar archive as Uint8Array | ||
| */ | ||
| export function init_from_archive_bytes( |
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, build WASM bindings and copy paste from file bindings/cedarling_wasm/pkg/cedarling_wasm.d.ts part related to function init_from_archive_bytes. To be consistent.
| #[error("failed to deserialize the JWT's status claim: {0}")] | ||
| DeserializeStatusClaim(#[from] serde_json::Error), | ||
| #[error("failed to validate the JWT's trusted issuer: {0}")] | ||
| TrustedIssuerValidation(String), |
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.
Isn't better to use TrustedIssuerError here?
| TrustedIssuerValidation(String), | |
| TrustedIssuerValidation(TrustedIssuerError), |
| .validators | ||
| .get(&validator_key) | ||
| .ok_or(ValidateJwtError::MissingValidator(validator_key.owned()))?; | ||
| let validator: Arc<std::sync::RwLock<JwtValidator>> = |
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.
You remove use std::sync::RwLock; from top. Just to use here std::sync::RwLock what is the point?
| hex = "0.4.3" | ||
| sha2 = "0.10.8" | ||
| zip = "6.0.0" | ||
|
|
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.
how about update zip to 7.0.0?
| // Fetch the JWKS from the jwks_uri | ||
| /// Retries are performed silently - the final error is returned if all attempts fail. | ||
| /// This keeps HttpClient as a simple, low-level utility without logging dependencies. | ||
| async fn get_with_retry(&self, uri: &str) -> Result<reqwest::Response, HttpClientError> { |
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.
Isn't better to use Sender and Backoff from http_utils crate?
| } | ||
| } | ||
| } | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", |
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.
I see that indentation was 4 space, but now only 2. And it is really hard to see what actually changed.
Prepare
Description
Target issue
closes #12253
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.Summary by CodeRabbit
New Features
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.