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

adding an event of deleting bash history #106

Merged
merged 5 commits into from
Apr 2, 2024
Merged

Conversation

h4l0gen
Copy link
Contributor

@h4l0gen h4l0gen commented Mar 14, 2024

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind documentation

/kind tests

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area commands

/area pkg

/area events

What this PR does / why we need it:
this event will trigger rule Delete_or_rename_shell_history
Which issue(s) this PR fixes:

Fixes #105

Special notes for your reviewer:

@poiana poiana requested review from FedeDP and leogr March 14, 2024 17:30
@poiana poiana added the size/M label Mar 14, 2024
@h4l0gen h4l0gen changed the title adding an event of deleting bash history wip: adding an event of deleting bash history Mar 16, 2024
@h4l0gen
Copy link
Contributor Author

h4l0gen commented Mar 29, 2024

@FedeDP as expected this rule iss triggered in above terminal when attempted by event-generator in terminal below.
Screenshot from 2024-03-29 14-31-25

Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

I don't think we should remove the user bash_history file :/
first of all this CANNOT be accepted by any user, moreover this is not idempotent since the second time one runs it it will fail to generate a Falco event because the file is not present anymore.
The rule (https://github.com/falcosecurity/rules/blob/main/rules/falco-incubating_rules.yaml#L1017) just checks that either we rename or remove a file whose name ends in ash_history, therefore there is no need to actually delete user bash_history, we can just create a file named ash_history anywhere (in a temp folder) and then remove it.

@h4l0gen
Copy link
Contributor Author

h4l0gen commented Mar 29, 2024

@FedeDP I was thinking about renaming .bash_history file but that will create problem of second time one runs it it will fail to generate a Falco event because the file is not present anymore as you sugegsted, So going with way you suggested would be great. I will make change in it ASAP!!

@h4l0gen
Copy link
Contributor Author

h4l0gen commented Mar 29, 2024

I changed event as per @FedeDP suggestions. And this event triggered related rule.
image

@h4l0gen h4l0gen requested a review from FedeDP March 29, 2024 16:25
Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

Left a suggestion.
Also, is this still wip?

events/syscall/delete_or_rename_shell_history.go Outdated Show resolved Hide resolved
@h4l0gen h4l0gen changed the title wip: adding an event of deleting bash history adding an event of deleting bash history Apr 2, 2024
Co-authored-by: Federico Di Pierro <[email protected]>
Signed-off-by: Kapil Sharma <[email protected]>
Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

/approve

@poiana poiana added the lgtm label Apr 2, 2024
@poiana
Copy link

poiana commented Apr 2, 2024

LGTM label has been added.

Git tree hash: 4b3efb2b121100ab9171a77128af265398739d2e

@poiana
Copy link

poiana commented Apr 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, h4l0gen

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana added the approved label Apr 2, 2024
@poiana poiana merged commit e048d5c into falcosecurity:main Apr 2, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

event for deleting shell history
3 participants