-
Notifications
You must be signed in to change notification settings - Fork 74
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
feat(jans-cedarling): Log Startup message #9546
Conversation
DryRun Security SummaryThe pull request focuses on improving the documentation, configuration, and logging functionality of the Cedarling application, a performant local authorization service that runs the Rust Cedar Engine. Expand for full summarySummary: The changes in this pull request focus on improving the documentation, configuration, and logging functionality of the Cedarling application, which is a performant local authorization service that runs the Rust Cedar Engine. The key changes include:
From an application security perspective, the changes do not introduce any obvious security vulnerabilities. The use of Rust, a memory-safe language, and the inclusion of unit tests and code coverage reporting are positive signs for the security and reliability of the project. Additionally, the support for different log types, including a "lock" type that sends logs to a server, could be useful for security monitoring and incident response purposes. However, it is important to ensure that the logging system does not inadvertently expose sensitive information, that the configuration management is secure, and that any user input is properly validated to prevent potential security issues. Files Changed:
Code AnalysisWe ran Riskiness🟢 Risk threshold not exceeded. |
Quality Gate passed for 'jans-cli'Issues Measures |
Quality Gate passed for 'jans-config-api-parent'Issues Measures |
|
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'm ok to approve this as a starting point. My main comment is I don't understand why the Logging interface seems to be defined in the Authz engine.
/// return logs and remove them from the storage | ||
pub fn pop_logs(&self) -> Vec<LogEntry> { | ||
self.log_service.pop_logs() | ||
} | ||
|
||
/// get specific log entry | ||
pub fn get_log_by_id(&self, id: &str) -> Option<LogEntry> { | ||
self.log_service.get_log_by_id(id) | ||
} | ||
|
||
/// returns a list of all log ids | ||
pub fn get_log_ids(&self) -> Vec<String> { | ||
self.log_service.get_log_ids() |
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 don't understand why this is in the Authz engine.
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.
Created Cedarling
instance
and removed from Authz
53a449b
to
d081bca
Compare
@@ -67,3 +67,203 @@ impl LogStorage for LogStrategy { | |||
} | |||
} | |||
} | |||
|
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.
Is it possible to add the test cases in a separate file (or files) at jans-lock/cedarling/cedarling/src/log/test
directory> It is easy to search the test cases of a module when placed together rather than in application code.
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.
Thanks, unit tests for LogStrategy
moved to log/test
module
I am not sure if we need to move others unit tests. Because It will be a mess. And actually, LogStrategy
unit tests duplicate some parts of other unit tests.
jans-lock/cedarling/README.md
Outdated
cargo run -p cedarling --example log_init -- lock | ||
``` | ||
|
||
## Code coverage |
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.
can you also include the commands to build, run and test Cedarling.
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.
Added information how to run unit tests.
And we have nothing to build because we have library and have no bindings to python for now.
How to run examples, it was explained.
let logger = StdOutLogger::new_with(buffer); | ||
|
||
// Log the entry | ||
logger.log(log_entry); |
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 could not see the log entry on the console.
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.
Yes, because I have used the TestWriter
. To mock writer to stdout. And after writing log we get logged content via test_writer.into_inner_buf()
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.
Great start.
…arling` top level Squash all previous changes: chore(jans-cedarling): refactor, improve organization of config entity imports docs(jans-cedarling): add to README how to generate documentation chore(jans-cedarling): rename unexported field in the writer feat(jans-cedarling): add Authz to the Cedarling instance feat(jans-cedarling): add Cedarling instance docs(jans-cedarling): fix docstring test(jans-cedarling): fix log/test, import LogWriter docs(jans-cedarling): added to README information how to run unit tests test(jans-cedarling): move unit test for LogStrategy to log/test module docs(jans-cedarling): added to README information how to get code-coverage test(jans-cedarling): add unit test for LogStrategy test(jans-cedarling): add unit test for MemoryLogger chore(jans-cedarling): make fields in AuthorizationLogInfo struct public test(jans-cedarling): add unit test for StdOutLogger docs(jans-cedarling): added README to log module chore(jans-cedarling): add note about using uuids in different situation docs(jans-cedarling): improved README, added not about `log_init.rs` file. And information about each log type. chore(jans-cedarling): fix clippy warnings about doc identation chore(jans-cedarling): fix clippy warnings docs(jans-cedarling): improved documentation in the log crate. docs(jans-cedarling): add links to the bootstrap properties in the documentation docs(jans-cedarling): improved documentation in the log crate. Made it public to see message from autogenerated documentation page chore(jans-cedarling): remove unused imports chore(jans-cedarling): add macros allow(dead_code) to the Authz struct chore(jans-cedarling): refactor make StdOutLogger more simple chore(jans-cedarling): refactor to use imported names for shorter match cases feat(jans-cedarling): add example of run cedarling Authz and updated Readme chore(jans-cedarling): refactor implementation MemoryLogger method log chore(jans-cedarling): rename method get_logs to get_log_ids according to last changes in the `Final Cedarling Log Design` chore(jans-cedarling): change name on init Authz chore(jans-cedarling): add derive Clone, Copy to the LogType and MemoryLogConfig chore(jans-cedarling): added doc message to MemoryLogConfig chore(jans-cedarling): add documentation notes for LogStrategy chore(jans-cedarling): add copyright note chore(jans-cedarling): add simple Authz with initialization logger service chore(jans-cedarling): add init_logger function chore(jans-cedarling): fix missed documentation chore(jans-cedarling): initialize logger using configuration settings chore(jans-cedarling): add configs for logger chore(jans-cedarling): add LogStrategy to unify multiple implementations under a common API chore(jans-cedarling): add MemoryLogger chore(jans-cedarling): add MemoryLogger and implement LogWriter trait chore(jans-cedarling): make LogEntry properties public chore(jans-cedarling): added to sparkv error text error message chore(jans-cedarling): added сopyright note to sparkv chore(jans-cedarling): added StdOutLogger chore(jans-cedarling): added NopLogger, that do nothing. chore(jans-cedarling): added log interfaces chore(jans-cedarling): added log LogEntry struct and related to it. feat(jans-cedarling): added fork of the SparKV as is Signed-off-by: Oleh Bohzok <[email protected]>
f79e264
to
55b33a2
Compare
chore(jans-cedarling): move `cedarling` from `jans-lock` to `jans-cedarling` top level Squash all previous changes: chore(jans-cedarling): refactor, improve organization of config entity imports docs(jans-cedarling): add to README how to generate documentation chore(jans-cedarling): rename unexported field in the writer feat(jans-cedarling): add Authz to the Cedarling instance feat(jans-cedarling): add Cedarling instance docs(jans-cedarling): fix docstring test(jans-cedarling): fix log/test, import LogWriter docs(jans-cedarling): added to README information how to run unit tests test(jans-cedarling): move unit test for LogStrategy to log/test module docs(jans-cedarling): added to README information how to get code-coverage test(jans-cedarling): add unit test for LogStrategy test(jans-cedarling): add unit test for MemoryLogger chore(jans-cedarling): make fields in AuthorizationLogInfo struct public test(jans-cedarling): add unit test for StdOutLogger docs(jans-cedarling): added README to log module chore(jans-cedarling): add note about using uuids in different situation docs(jans-cedarling): improved README, added not about `log_init.rs` file. And information about each log type. chore(jans-cedarling): fix clippy warnings about doc identation chore(jans-cedarling): fix clippy warnings docs(jans-cedarling): improved documentation in the log crate. docs(jans-cedarling): add links to the bootstrap properties in the documentation docs(jans-cedarling): improved documentation in the log crate. Made it public to see message from autogenerated documentation page chore(jans-cedarling): remove unused imports chore(jans-cedarling): add macros allow(dead_code) to the Authz struct chore(jans-cedarling): refactor make StdOutLogger more simple chore(jans-cedarling): refactor to use imported names for shorter match cases feat(jans-cedarling): add example of run cedarling Authz and updated Readme chore(jans-cedarling): refactor implementation MemoryLogger method log chore(jans-cedarling): rename method get_logs to get_log_ids according to last changes in the `Final Cedarling Log Design` chore(jans-cedarling): change name on init Authz chore(jans-cedarling): add derive Clone, Copy to the LogType and MemoryLogConfig chore(jans-cedarling): added doc message to MemoryLogConfig chore(jans-cedarling): add documentation notes for LogStrategy chore(jans-cedarling): add copyright note chore(jans-cedarling): add simple Authz with initialization logger service chore(jans-cedarling): add init_logger function chore(jans-cedarling): fix missed documentation chore(jans-cedarling): initialize logger using configuration settings chore(jans-cedarling): add configs for logger chore(jans-cedarling): add LogStrategy to unify multiple implementations under a common API chore(jans-cedarling): add MemoryLogger chore(jans-cedarling): add MemoryLogger and implement LogWriter trait chore(jans-cedarling): make LogEntry properties public chore(jans-cedarling): added to sparkv error text error message chore(jans-cedarling): added сopyright note to sparkv chore(jans-cedarling): added StdOutLogger chore(jans-cedarling): added NopLogger, that do nothing. chore(jans-cedarling): added log interfaces chore(jans-cedarling): added log LogEntry struct and related to it. feat(jans-cedarling): added fork of the SparKV as is Signed-off-by: Oleh Bohzok <[email protected]>
chore(jans-cedarling): move `cedarling` from `jans-lock` to `jans-cedarling` top level Squash all previous changes: chore(jans-cedarling): refactor, improve organization of config entity imports docs(jans-cedarling): add to README how to generate documentation chore(jans-cedarling): rename unexported field in the writer feat(jans-cedarling): add Authz to the Cedarling instance feat(jans-cedarling): add Cedarling instance docs(jans-cedarling): fix docstring test(jans-cedarling): fix log/test, import LogWriter docs(jans-cedarling): added to README information how to run unit tests test(jans-cedarling): move unit test for LogStrategy to log/test module docs(jans-cedarling): added to README information how to get code-coverage test(jans-cedarling): add unit test for LogStrategy test(jans-cedarling): add unit test for MemoryLogger chore(jans-cedarling): make fields in AuthorizationLogInfo struct public test(jans-cedarling): add unit test for StdOutLogger docs(jans-cedarling): added README to log module chore(jans-cedarling): add note about using uuids in different situation docs(jans-cedarling): improved README, added not about `log_init.rs` file. And information about each log type. chore(jans-cedarling): fix clippy warnings about doc identation chore(jans-cedarling): fix clippy warnings docs(jans-cedarling): improved documentation in the log crate. docs(jans-cedarling): add links to the bootstrap properties in the documentation docs(jans-cedarling): improved documentation in the log crate. Made it public to see message from autogenerated documentation page chore(jans-cedarling): remove unused imports chore(jans-cedarling): add macros allow(dead_code) to the Authz struct chore(jans-cedarling): refactor make StdOutLogger more simple chore(jans-cedarling): refactor to use imported names for shorter match cases feat(jans-cedarling): add example of run cedarling Authz and updated Readme chore(jans-cedarling): refactor implementation MemoryLogger method log chore(jans-cedarling): rename method get_logs to get_log_ids according to last changes in the `Final Cedarling Log Design` chore(jans-cedarling): change name on init Authz chore(jans-cedarling): add derive Clone, Copy to the LogType and MemoryLogConfig chore(jans-cedarling): added doc message to MemoryLogConfig chore(jans-cedarling): add documentation notes for LogStrategy chore(jans-cedarling): add copyright note chore(jans-cedarling): add simple Authz with initialization logger service chore(jans-cedarling): add init_logger function chore(jans-cedarling): fix missed documentation chore(jans-cedarling): initialize logger using configuration settings chore(jans-cedarling): add configs for logger chore(jans-cedarling): add LogStrategy to unify multiple implementations under a common API chore(jans-cedarling): add MemoryLogger chore(jans-cedarling): add MemoryLogger and implement LogWriter trait chore(jans-cedarling): make LogEntry properties public chore(jans-cedarling): added to sparkv error text error message chore(jans-cedarling): added сopyright note to sparkv chore(jans-cedarling): added StdOutLogger chore(jans-cedarling): added NopLogger, that do nothing. chore(jans-cedarling): added log interfaces chore(jans-cedarling): added log LogEntry struct and related to it. feat(jans-cedarling): added fork of the SparKV as is Signed-off-by: Oleh Bohzok <[email protected]> Former-commit-id: ed80ee6
Prepare
Description
Target issue
link
closes #9495
Implementation Details
After a lot of discussion added implementation of 3 types of logger.
off
stdout
memory
Next stage is to add unit test and python bindings
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.