-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
auditbeat/module/file_integrity: clean paths obtained from fsnotify before sending #28354
Conversation
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
4bc1d67
to
a3c7ed9
Compare
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
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.
LGTM. Just one minor change requested for the logger.
…nd fsevents before sending Document that while users should configure with an absolute path, the module will attempt to resolve paths to their absolute equivalent.
a3c7ed9
to
7e594c5
Compare
@efd6 changelog entries should go to the |
…nd fsevents before sending (elastic#28354) Document that while users should configure with an absolute path, the module will attempt to resolve paths to their absolute equivalent.
@andresrc Thanks. I knew this but fumbled. Sorry. |
What does this PR do?
This cleans incorrectly constructed, but valid, paths obtained from fsnotify and makes relative paths useful.
Note that the code is duplicated across the fsnotify and fsevent functions due to separation by build tags and differences in the types that are being handled. They could be factored into a single
func absolutePathFor(path string, logger *logp.Logger) string
, but there was no obvious place to put that.Why is it important?
Currently paths of files identified in root by the file integrity module have path with either a
//
prefix or with a./
if a relative or empty path configuration is provided. This change resolves relative paths to absolute event paths and cleans paths with extraneous path separators and dots.Testing the root path behaviour in automated testing does not seem feasible.
Checklist
- [ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
N/A
How to test this PR locally
Run auditbeat with the following configuration
or
and then create a file in
/
or in the current working directory for auditbeat.Related issues
Use cases
N/A
Screenshots
N/A
Logs
N/A