-
Notifications
You must be signed in to change notification settings - Fork 106
Security monitoring feature parity with Agent V2 #1463
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
base: main
Are you sure you want to change the base?
Security monitoring feature parity with Agent V2 #1463
Conversation
|
✅ All required contributors have signed the F5 CLA for this PR. Thank you! |
b3af22a to
5271a0f
Compare
…asic struct.
This has been done to allow for management-plane can reference it as a contract with backward/forward compatibility
… the logic in line with agent v2
… adds additional assertions and validations to ensure of expected final output
cbf8c1d to
36b2d35
Compare
…to make this the docker0 IP identified from network lookup)
| if i >= len(fieldOrder) { | ||
| break | ||
| } | ||
| fieldValueMap[fieldOrder[i]] = strings.TrimSpace(field) |
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 we prebuild this map? If we expect to be high-volume, rebuilding the map log parse is probably not needed?
|
|
||
| parts := strings.Split(value, ",") | ||
|
|
||
| var trimmedParts []string |
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.
nit, you can preallocate with length
trimmedParts := make([]string, 0, len(parts))
| // Remove the "ASM:" prefix if present so we only process the values | ||
| message = strings.TrimPrefix(message, "ASM:") | ||
|
|
||
| fields := strings.Split(message, ",") |
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.
did we explore the golang csv parser? https://pkg.go.dev/encoding/csv
Proposed changes
Commit 1:
The
securityviolationsprocessornow processes NGINX App Protect WAF syslog messages, and transforms them intoSecurityViolationEventprotobuf messages. This protobuf definition replaces the existing struct definition in/internalfolder. This was done to allow management-plane to import this schema as a contract for handling security violations.Commit 2:
Additionally, added the following capabilities to the parsing the details extraction from raw violations, to bring the feature in parity with Agent V2 implementation:
Commit 3:
These changes were thoroughly tested with addition of
/testdatain Agent V2 implementation (https://github.com/nginx/agent/tree/dev-v2/src/extensions/nginx-app-protect/monitoring/processor/testdata) and additional variety of violations, to ensure robust coverage.Commit 4:
Added temporarily the hardcoded docker0 interface IP, required to enable NAP V5 integration.
Agent Config Modifications for Test
Testing
Violations Triggered
Expected Violations: VIOL_FILETYPE, VIOL_HTTP_PROTOCOL, VIOL_BOT_CLIENT
Output Payload:
Expected Violations: VIOL_METHOD, VIOL_HTTP_PROTOCOL, VIOL_BOT_CLIENT
Output Payload:
Expected Violations: VIOL_ATTACK_SIGNATURE, VIOL_HTTP_PROTOCOL, VIOL_BOT_CLIENT, VIOL_URL_METACHAR, VIOL_RATING_THREAT
Expected Signature IDs ": 200000099, 200000093
Output Payload:
Checklist
Before creating a PR, run through this checklist and mark each as complete.
CONTRIBUTINGdocumentmake install-toolsand have attached any dependency changes to this pull requestREADME.md)