Skip to content

Commit

Permalink
Fixing non large cluster optimization (limiting to runid)
Browse files Browse the repository at this point in the history
  • Loading branch information
jt-dd committed Dec 2, 2024
1 parent 75de949 commit 6c46a37
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion pkg/kubehound/graph/edge/pod_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ func (e *PodCreate) Traversal() types.EdgeTraversal {
} else {
// In smaller clusters we can still show the (large set of) attack paths generated by this attack
g.V().
HasLabel("Node").
Has("runID", e.runtime.RunID.String()).
Has("cluster", e.runtime.ClusterName).
Has("class", "Node").
As("n").
V(inserts...).
Expand Down
3 changes: 2 additions & 1 deletion pkg/kubehound/graph/edge/pod_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ func (e *PodExec) Traversal() types.EdgeTraversal {
} else {
// In smaller clusters we can still show the (large set of) attack paths generated by this attack
g.V().
HasLabel("Pod").
Has("runID", e.runtime.RunID.String()).
Has("cluster", e.runtime.ClusterName).
Has("class", "Pod").
As("p").
V(inserts...).
Expand Down
3 changes: 2 additions & 1 deletion pkg/kubehound/graph/edge/pod_patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ func (e *PodPatch) Traversal() types.EdgeTraversal {
} else {
// In smaller clusters we can still show the (large set of) attack paths generated by this attack
g.V().
HasLabel("Pod").
Has("runID", e.runtime.RunID.String()).
Has("cluster", e.runtime.ClusterName).
Has("class", "Pod").
As("p").
V(inserts...).
Expand Down
7 changes: 5 additions & 2 deletions pkg/kubehound/graph/edge/token_bruteforce.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ func (e *TokenBruteforce) Traversal() types.EdgeTraversal {
if e.cfg.LargeClusterOptimizations {
// For larger clusters simply target the system:masters group to reduce redundant attack paths
g.V().
HasLabel("Identity").
Has("runID", e.runtime.RunID.String()).
Has("cluster", e.runtime.ClusterName).
Has("class", "Identity").
Has("name", "system:masters").
As("i").
V(inserts...).
Expand All @@ -75,7 +77,8 @@ func (e *TokenBruteforce) Traversal() types.EdgeTraversal {
} else {
// In smaller clusters we can still show the (large set of) attack paths generated by this attack
g.V().
HasLabel("Identity").
Has("runID", e.runtime.RunID.String()).
Has("cluster", e.runtime.ClusterName).
Has("class", "Identity").
As("i").
V(inserts...).
Expand Down
7 changes: 5 additions & 2 deletions pkg/kubehound/graph/edge/token_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ func (e *TokenList) Traversal() types.EdgeTraversal {
if e.cfg.LargeClusterOptimizations {
// For larger clusters simply target the system:masters group to reduce redundant attack paths
g.V().
HasLabel("Identity").
Has("runID", e.runtime.RunID.String()).
Has("cluster", e.runtime.ClusterName).
Has("class", "Identity").
Has("name", "system:masters").
As("i").
V(inserts...).
Expand All @@ -75,7 +77,8 @@ func (e *TokenList) Traversal() types.EdgeTraversal {
} else {
// In smaller clusters we can still show the (large set of) attack paths generated by this attack
g.V().
HasLabel("Identity").
Has("runID", e.runtime.RunID.String()).
Has("cluster", e.runtime.ClusterName).
Has("class", "Identity").
As("i").
V(inserts...).
Expand Down

0 comments on commit 6c46a37

Please sign in to comment.