Repository navigation
fix(plugins/cloudtrail): apply s3Interval to logs at the bucket root - #1610
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
The S3 prefix is taken from the open params without the bucket name, so a trail that writes to the bucket root gives a prefix that starts with `AWSLogs/`. Since the AWSLogs patterns started to require a leading slash, such prefixes no longer match. The plugin then skips the region lookup, lists the whole prefix, and silently ignores s3Interval and s3AccountList. Match `AWSLogs` either at the start of the prefix or after a slash. Signed-off-by: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com>
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: RaphaelFakhri The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
|
Welcome @RaphaelFakhri! It looks like this is your first PR to falcosecurity/plugins 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area plugins
What this PR does / why we need it:
The S3 prefix comes from the open params without the bucket name, so a trail that writes to the bucket root (the CloudTrail default) gives a prefix that starts with
AWSLogs/. Since #650,awsLogsREandawsLogsOrgRErequire a leading/beforeAWSLogs, so these prefixes no longer match. The plugin then skips the region lookup, lists the whole prefix, and silently ignoress3Intervalands3AccountList.This PR matches
AWSLogseither at the start of the prefix or after a/. Prefixes such asfooAWSLogs/still do not match.A new test,
TestOpenS3Interval, runsopenS3against a fake S3 endpoint with a fixeds3Interval. It covers account, organization (with and withouts3AccountList) and pre-ControlTower trails at the bucket root, plus a trail below a key prefix. Without the fix, the four bucket-root cases fail because every log file is returned.Which issue(s) this PR fixes:
Fixes #1609
Special notes for your reviewer:
go vetwith Go 1.27 already reports non-constant format strings incloudtrail.goandsource.goonmain, so the tests were run withgo test -vet=off ./.... The new test file has no vet findings.