seclog: add seclog with nop implementation (part 1) - #16987
Conversation
|
Wed Apr 29 20:57:22 UTC 2026 Failures:Preparing:
Executing:
Restoring:
Skipped tests from snapd-testing-skipIf you wish to have any of the below tests run in your PR, in your PR description, add 'unskip:' followed by a copy-and-pasted list (without variants) of the below tests you wish to run (unskip plus test list must be valid yaml)
|
There was a problem hiding this comment.
Pull request overview
This PR introduces the initial seclog (security/audit logging) package with a global logger API, a no-op default implementation, and test helpers to validate emitted events without depending on slog/JSON. This fits into snapd as a foundational subsystem for structured security event emission, intended to later plug into the system audit pipeline.
Changes:
- Add
seclogcore types and global logging entrypoints (levels, events, attrs, setup, and a few initial AUTHN/SYS events). - Add a no-op
SecurityLoggerimplementation as the default backend. - Add test helpers (
seclogtest) plus initial unit tests for formatting and logger replacement behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
seclog/seclog.go |
Core security logging API: level formatting, event/attr types, global logger setup, and initial event emitters. |
seclog/nop.go |
Default no-op SecurityLogger implementation. |
seclog/seclog_test.go |
Unit tests for level/user/reason formatting and basic global logger setup/replacement behavior. |
seclog/nop_test.go |
Unit tests ensuring the no-op logger accepts calls without error. |
seclog/seclogtest/seclogtest.go |
Test helper SecurityLogger that records events to a buffer. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #16987 +/- ##
==========================================
+ Coverage 79.05% 79.11% +0.06%
==========================================
Files 1371 1362 -9
Lines 190706 190551 -155
Branches 2465 2465
==========================================
+ Hits 150757 150759 +2
+ Misses 30864 30723 -141
+ Partials 9085 9069 -16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
miguelpires
left a comment
There was a problem hiding this comment.
Looks good, just some questions/small notes
pedronis
left a comment
There was a problem hiding this comment.
bunch of comments and questions
Implement security logging: Part 1
This PR introduces a dedicated security/audit logging subsystem:
See complete implementation for reference: https://github.com/ernestl/snapd/pull/5/changes
Jira: https://warthogs.atlassian.net/browse/SNAPDENG-35756
Spec: https://docs.google.com/document/d/1fl7Gy3GJVu8VwUtT1_LWwZ7DEAW9sUMAzF3XGrcZ_d4/edit?tab=t.0