Open rmarinn opened 4 days ago
The pull request focuses on improving the security of the Cedarling application, including extensive configuration options for JWT validation, policy store management, logging and monitoring, and dependency management.
We ran 9 analyzers
against 30 files
and 0 analyzers
had findings. 9 analyzers
had no findings.
:green_circle: Risk threshold not exceeded.
Why we need bindings\cedarling_python\src\config\jwt_config.rs
if we use jwt_sig_validation
in bootstrap config?
It would be great to understand why BootstrapConfigRaw
in unused in bindings
?
Actually we can use **kwargs
in python to collect all parameters and deserialize (using serde-pyobject
) it to BootstrapConfigRaw
, and hold this value as inner
(usual pattern in rust)
Also, we need to understand if user specify some parameter or not. To add seamlessly loading parameters from env vars and check if it was not defined by user, try to load it from env and if not present in env vars use default value.
Or in other priority...
Prepare
Description
This PR implements
serde::Deserialize
forBootstrapConfig
, enabling an alternative way of creating aBootStrapConfig
struct instead of just instantiating one through a Builder pattern via code.Target issue
target issue: #10200
closes #10200
Implementation Details
1. Deserialization
Implementing
serde::Deserialize
for bootstrap config now enables us to deserialize a JSON or YAML string into aBootStrapConfig
struct.And for the users, they can use the convenient
load_from_file
method:2. Loading Policy Store From File
Loading a policy store from a file was introduced by a new bootstrap property and this feature was implemented by updating the
load_policy_store
function.3. Python Bindings
The python bindings required a complex setup to load a
BootstrapConfig
class. This PR simplifies theBootstrapConfig
implementation in the Python bindings into a "flat" class to simplify things. Additionally,TryInto<cedarling::BootstrapConfig>
was implemented for the class to be able to easily convert to the core code'sBootstrapConfig
struct.Loading the bootstrap configs via code should now look like this in python:
What about loading from a file in the Python bindings?
I tried implementing this but due to the deeply
BootstrapConfig
struct in the core code, it quickly turned into a mess.The method i tried was to use the core code's
BoostrapConfigRaw
then load that from a file... which would work but we now have this weird flow when loading a config in the python binding: loads from a core struct -> converts it into the python binding class -> then it's gonna get converted back into the core struct again when Cedarling gets initialized.Then i realized that this might be better to implement in another issue since it feels too out of scope already.
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.