forked from kubescape/node-agent
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(cel): wildcard-aware exec arg matching #35
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
Open
entlein
wants to merge
1
commit into
main
Choose a base branch
from
feat/exec-arg-wildcards
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
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.
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.
🧹 Nitpick | 🔵 Trivial
🧩 Analysis chain
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 51
🏁 Script executed:
# Check if the file exists and get basic info wc -l pkg/rulemanager/cel/libraries/applicationprofile/exec_test.goRepository: k8sstormcenter/node-agent
Length of output: 135
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 3418
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 240
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 300
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 358
🏁 Script executed:
# Read the exec.go implementation to understand wildcard matching semantics cat -n pkg/rulemanager/cel/libraries/applicationprofile/exec.goRepository: k8sstormcenter/node-agent
Length of output: 8561
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 51
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 51
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 1114
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 4229
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 361
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 51
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 543
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 1012
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 8958
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 51
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 243
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 705
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 623
🏁 Script executed:
Repository: k8sstormcenter/node-agent
Length of output: 1502
Add an explicit mid-profile
*re-anchoring test case.Current test coverage validates trailing
*patterns well, but there's no explicit scenario where*must re-anchor to a later literal token. Adding one positive+negative pair will lock in the anchored behavior contract.Proposed test additions
@@ Execs: []v1beta1.ExecCalls{ @@ // echo with any number of greeting words after a literal anchor. { Path: "/bin/echo", Args: []string{"hello", "*"}, }, + // wildcard in the middle must re-anchor to trailing literal. + { + Path: "/usr/bin/env", + Args: []string{"A", "*", "Z"}, + }, }, }) @@ // echo hello * {"echo hello world from test", "/bin/echo", []string{"hello", "world", "from", "test"}, true}, {"echo hello (no trailing args)", "/bin/echo", []string{"hello"}, true}, {"echo goodbye world — wrong literal anchor", "/bin/echo", []string{"goodbye", "world"}, false}, + + // mid-profile * re-anchoring + {"env A x y Z — wildcard re-anchors to trailing literal", "/usr/bin/env", []string{"A", "x", "y", "Z"}, true}, + {"env A x y — missing trailing literal anchor", "/usr/bin/env", []string{"A", "x", "y"}, false}, }Also applies to: 364-390
🤖 Prompt for AI Agents