Skip to content
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: adds auditlog plugins API #787

Merged
merged 15 commits into from May 16, 2023
Merged

Conversation

jcchavezs
Copy link
Member

@jcchavezs jcchavezs commented May 6, 2023

This PR does a few things that need to happen together:

  • moves auditlog package into an internal package
  • drops some public APIs like auditlog.Config.Writer as it was half baked API for extending auditlogs and exposed an internal API
  • adds the experimental functions to register audit log writer and formatter

Hopefully this will be the last breaking change for public API.

@jcchavezs jcchavezs requested a review from a team as a code owner May 6, 2023 21:14
@jcchavezs jcchavezs requested review from jptosso and fzipi May 6, 2023 21:14
@jcchavezs jcchavezs added the v3 label May 6, 2023
@codecov
Copy link

codecov bot commented May 6, 2023

Codecov Report

Patch coverage: 76.13% and project coverage change: -0.62 ⚠️

Comparison is base (fea6c68) 81.85% compared to head (4b8a4a8) 81.24%.

Additional details and impacted files
@@            Coverage Diff             @@
##           v3/dev     #787      +/-   ##
==========================================
- Coverage   81.85%   81.24%   -0.62%     
==========================================
  Files         153      155       +2     
  Lines        8252     8424     +172     
==========================================
+ Hits         6755     6844      +89     
- Misses       1277     1352      +75     
- Partials      220      228       +8     
Flag Coverage Δ
default 77.63% <76.56%> (-0.48%) ⬇️
examples 25.32% <7.98%> (-0.51%) ⬇️
ftw 48.20% <6.06%> (-1.01%) ⬇️
ftw-multiphase 48.31% <6.06%> (-1.01%) ⬇️
tinygo 75.77% <43.44%> (-1.49%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
config.go 70.27% <ø> (-18.76%) ⬇️
internal/auditlog/noop_closer.go 100.00% <ø> (ø)
internal/auditlog/noop_formater.go 0.00% <0.00%> (ø)
internal/auditlog/init_tinygo.go 70.00% <50.00%> (ø)
internal/auditlog/auditlog.go 54.00% <54.00%> (ø)
internal/auditlog/noop_writer.go 66.66% <66.66%> (ø)
internal/auditlog/formats_json.go 85.93% <85.93%> (ø)
internal/auditlog/serial_writer.go 90.62% <90.62%> (ø)
internal/corazawaf/transaction.go 78.02% <90.74%> (+0.22%) ⬆️
experimental/plugins/auditlog.go 100.00% <100.00%> (ø)
... and 6 more

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

config.go Outdated Show resolved Hide resolved
HostIP: tx.variables.serverAddr.Get(),
HostPort: hostPort,
ServerID: tx.variables.serverName.Get(), // TODO check
alTransaction = auditlog.Transaction{
Copy link
Member Author

@jcchavezs jcchavezs May 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code specifically requires the AuditLogPartAuditLogHeader(aka A) part to be present and be the first one declared. The first condition is right as it is mandatory but the second isn't so I will change that in a next PR to not to grow this one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcchavezs jcchavezs requested a review from anuraaga May 15, 2023 04:42
@jcchavezs
Copy link
Member Author

Please do review @jptosso @anuraaga @M4tteoP

@jcchavezs jcchavezs changed the title chore: moves auditlog to internal package. feat: adds auditlog plugins API May 15, 2023
experimental/plugins/auditlog.go Outdated Show resolved Hide resolved
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
@jcchavezs jcchavezs merged commit 27b14f8 into v3/dev May 16, 2023
8 of 10 checks passed
@jcchavezs jcchavezs deleted the moves_auditlog_to_internal branch May 16, 2023 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants