8000 rename scopes related to policies by geyslan · Pull Request #2845 · aquasecurity/tracee · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rename scopes related to policies #2845

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

Merged
merged 3 commits into from
Mar 16, 2023

Conversation

geyslan
Copy link
Member
@geyslan geyslan commented Mar 10, 2023

1. Explain what the PR does

commit a0fdbb6

go.mod: bump types

commit c774757

user: rename scope references to policy

This continues the renaming of scope to policy, in user land.

commit b3611d7

bpf: rename fields related to policies

event_context_t, net_task_context_t:
  matched_scopes -> matched_policies

This also renames other parts that are related to policies.

2. Explain how to test it

3. Other comments

This is part of:

@geyslan geyslan self-assigned this Mar 10, 2023
@geyslan geyslan mentioned this pull request Mar 10, 2023
10 tasks
@yanivagman
Copy link
Collaborator

Making this change also requires changes in userspace, i.e Context of bufferdecoder and Event matchedScopes

@geyslan
Copy link
Member Author
geyslan commented Mar 13, 2023

Making this change also requires changes in userspace, i.e Context of bufferdecoder and Event matchedScopes

I was leaving the user land changes to one single PR, since we'll have to bump types and so. Let me check it again. 👍🏻

@geyslan geyslan force-pushed the 2665-rename-bpf-side branch from ae4950a to bd5206e Compare March 13, 2023 15:54
@geyslan geyslan changed the title bpf: rename fields related to policies bpf: rename scopes related to policies Mar 13, 2023
@geyslan geyslan force-pushed the 2665-rename-bpf-side branch 5 times, most recently from 4d79a1c to 659b515 Compare March 13, 2023 18:21
@geyslan
Copy link
Member Author
geyslan commented Mar 13, 2023

The checks will fail as we have a change in types pkg. After this is merged, we need to bump the go.mod.

@rafaeldtinoco
Copy link
Contributor

Please rebase to HEAD before trying tests again. The rate limit issue with docker hub has been fixed.

@geyslan geyslan force-pushed the 2665-rename-bpf-side branch from 659b515 to 25965e3 Compare March 14, 2023 13:26
@geyslan geyslan changed the title bpf: rename scopes related to policies rename scopes related to policies Mar 14, 2023
Comment on lines -100 to +113
-f 42:event=sched_process_exec -f 42:binary=/usr/bin/ls | trace in scope 42 sched_process_exec event from /usr/bin/ls binary
-f 42:event=sched_process_exec -f 42:binary=/usr/bin/ls | trace in policy 42 sched_process_exec event from /usr/bin/ls binary

-f 3:event=openat -f 3:comm=id -f 9:event=close -f 9:comm=ls - trace in scope 3 only openat event from id command
-f 3:event=openat -f 3:comm=id -f 9:event=close -f 9:comm=ls - trace in policy 3 only openat event from id command
| and
- trace in scope 9 only close event from ls command
- trace in policy 9 only close event from ls command

-f 6:event=openat -f 6:comm=id -f 7:event=close -f 7:comm=id - trace in scope 6 only openat event from id command
-f 6:event=openat -f 6:comm=id -f 7:event=close -f 7:comm=id - trace in policy 6 only openat event from id command
| and
_ trace in scope 7 only close event from id command
_ trace in policy 7 only close event from id command

-f 3:event=openat -f 3:comm=id -f 9:event=close - trace in scope 3 only openat event from id command
-f 3:event=openat -f 3:comm=id -f 9:event=close - trace in policy 3 only openat event from id command
| and
- trace in scope 9 only close event from all
- trace in policy 9 only close event from all
Copy link
Collaborator

Choose a reason for hiding this comment

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

We're going to remove all of that from the CLI soon, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Definitely. Just renaming it accordingly. Once we receive the policies being loaded, this CLI will be removed, as that part of documentation.

@@ -121,31 +121,31 @@ type filterFlag struct {
full string
filterName string
operatorAndValues string
scopeIdx int
policyIdx int
Copy link
Collaborator

Choose a reason for hiding this comment

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

and this will be removed as well (and all following changes to filterFlag)?

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to think since it's part of the infrastructure and not exposed. It should be the part or not of the policy name mapping. We'll see.

Copy link
Contributor

Choose a reason for hiding this comment

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

@yanivagman why should we remove the index?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@yanivagman why should we remove the index?

Since this struct is the parsed filter flag, and we are going to remove multiscopes from CLI

Copy link
Contributor

Choose a reason for hiding this comment

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

But we are using it for policies. Policies are parsed and generate an []filterFlag

Copy link
Collaborator

Choose a reason for hiding this comment

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

So at least we better rename this struct and not call it filterFlag.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. Can this struct rename take place in the next PR (policies)? So this can enter to unlock the next ones.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure. This should probably be part of the removal of multiscopes from the CLI

@rafaeldtinoco rafaeldtinoco linked an issue Mar 14, 2023 that may be closed by this pull request
10 tasks
@josedonizetti josedonizetti removed a link to an issue Mar 15, 2023
10 tasks
@geyslan geyslan force-pushed the 2665-rename-bpf-side branch from 25965e3 to d72bbb9 Compare March 15, 2023 12:30
@geyslan
Copy link
Member Author
geyslan commented Mar 15, 2023

The checks will fail as we have a change in types pkg. After this is merged, we need to bump the go.mod.

Please, after approval, don't merge this before I remove this temp e71c43d commit.

@@ -37,7 +37,7 @@ type Event struct {
PodSandbox bool `json:"podSandbox"`
EventID int `json:"eventId,string"`
EventName string `json:"eventName"`
MatchedScopes uint64 `json:"matchedScopes"`
MatchedPolicies uint64 `json:"matchedPolicies"`
Copy link
Member Author

Choose a reason for hiding this comment

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

@yanivagman a question for a next PR:

Does it make sense to expose in Event type a field like MatchedPoliciesNames []string?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes.
Actually, the bitmap won't make sense anymore if we remove multiscopes and only leave policies.
In that case, we can have MatchedPolicies []string

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. After this merge, I'm going to tackle the ID<=>Name on top of #2873.

@geyslan geyslan requested a review from NDStrahilevitz March 16, 2023 11:02
Copy link
Collaborator
@yanivagman yanivagman left a comment

Choose a reason for hiding this comment

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

LGTM

geyslan added 3 commits March 16, 2023 10:12
event_context_t, net_task_context_t:
  matched_scopes -> matched_policies

This also renames other parts that are related to policies.
This continues the renaming of scope to policy, in user land.
@aqua-ci
Copy link
aqua-ci commented Mar 16, 2023

[ERROR]
GitHub self-host runner 'github-self-hosted_ami-0f23165db12015479_2845-4437586167_x64c' failed with connecting to GitHub.
Please cancel workflow and wait until infrastructure team investigation.

@aqua-ci
Copy link
aqua-ci commented Mar 16, 2023

[ERROR]
GitHub self-host runner 'github-self-hosted_ami-0f23165db12015479_2845-4437586167_x64' failed with connecting to GitHub.
Please cancel workflow and wait until infrastructure team investigation.

@geyslan geyslan merged commit 74460e6 into aquasecurity:main Mar 16, 2023
@geyslan geyslan deleted the 2665-rename-bpf-side branch May 29, 2023 22:20
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.

6 participants
0