feat(cli): append-only compliance audit log#102
Conversation
|
🚀 First PR — welcome aboard! A few things to expect:
If you get stuck, reply here or jump to Discussions. We want this PR to land. |
|
Hi @btwshivam, all CI checks are passing. Let me know if you need any changes. Thanks! |
There was a problem hiding this comment.
genuinely solid work ... metadata-only records (prompt sizes not content), hashed payloads, nil-safe and mutex-guarded logging, IP/path redaction at the call sites. resolve the conflicting merge state first (branch is on current main HEAD locally, so a rebase/re-push should clear it). one redaction gap and a dep note inline, plus a design
question: append-only here is file-level via lumberjack, no hash chain between records, so it's not tamper-evident, is that in scope for #48 or a follow-up?
| if maxMB == 0 { | ||
| maxMB = 100 | ||
| } | ||
| lj := &lumberjack.Logger{ |
There was a problem hiding this comment.
lumberjack is a new dependency, CLAUDE.md asks for the alternative considered. it's a reasonable choice for rotation, just name what you weighed it against (raw os.OpenFile with O_APPEND and no built-in rotation, say). also worth confirming the defaults fit a compliance log: Compress: true gzips rotated files and MaxBackups/MaxAge can delete old ones, which may conflict with retention requirements.
There was a problem hiding this comment.
lumberjack was chosen over raw os.OpenFile + O_APPEND because it provides built-in size-based rotation without requiring external logrotate setup. Issue #48 explicitly says "rotation handled by the OS or the user's log shipper" — lumberjack fits that model cleanly.
Re retention: changed MaxBackups default to 0 (unlimited — lumberjack never auto-deletes). Operators who are storage-constrained can set a non-zero value, but the safe default for compliance is no auto-deletion.
Re Compress: true — this gzips rotated files only, not the active log. Operators who need uncompressed files for their log shipper can set compress: false in config.
47a7a0a to
64c5937
Compare
append-only here means O_APPEND file writes via lumberjack — no hash chain between records, so not tamper-evident in the cryptographic sense. Issue #48 doesn't require tamper-evidence — it asks for an audit trail that compliance reviewers can use to trace events. |
|
/retest |
|
Re-running 1 failed workflow run(s) on |
|
Hi @btwshivam, I've addressed all the review feedback and updated the branch. Please take another look and let me know if any further changes are needed. Thanks! |
|
fix conflict |
Add structured NDJSON audit log for SOC 2 / ISO 27001 / HIPAA compliance. - internal/audit: Logger with 8 event types, lumberjack rotation, PII redaction - internal/audit: Redact() strips PIDs/IPs/paths, RedactRemoteAddr for HTTP - internal/config: AuditConfig + PrometheusConfig.BearerToken - internal/ai/analyzer: ai.call audit on every LLM call (hit/miss/error) - internal/cli/start: daemon lifecycle, bpf.load, SIGHUP, auth.failure wired - internal/cli/doctor: auditLog passed to NewEngine - internal/doctor/engine: finding.emit wired for WARNING/CRITICAL findings - docs/audit-schema.md: versioned NDJSON schema documentation Closes optiqor#48 Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
33a3426 to
49ec73a
Compare
|
Re-running 2 failed workflow run(s) on |
Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
|
Hi @btwshivam, all CI checks are now passing. Ready for final review! |
|
/retest |
|
Re-running 1 failed workflow run(s) on |
FIXED !! @btwshivam |
btwshivam
left a comment
There was a problem hiding this comment.
the audit fixes are good (bpf errors redacted, max_backups handled). but this bumps go.mod to 1.26 and rewrites ci.yml + release.yml to match, that is a repo-wide toolchain change riding in an audit-log PR. revert to 1.25 and drop the workflow edits.
Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
ff1da42 to
016b9b0
Compare
Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
@btwshivam — go.mod is back on 1.25.4, workflows reverted, all 17 CI checks passing. Ready for final review! |
|
@btwshivam Please review the PR !! |
Add structured NDJSON audit log for SOC 2 / ISO 27001 / HIPAA compliance.
Closes #48
What
Add append-only NDJSON audit log for SOC 2 / ISO 27001 / HIPAA compliance. Emits structured records for every privileged action kerno takes — config reloads, AI calls, finding emissions, auth failures, and daemon lifecycle events.
Why
Fixes #48
How
Testing
sudo ./bin/bpf-verify --read 5sconfirms 6/6 programs still load./scripts/verify.shpasses (or specific phase:./scripts/verify.sh quality)Checklist