-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from rohaquinlop/issue-16
feat(build): #16 enhance try cognitive complexity
- Loading branch information
Showing
4 changed files
with
79 additions
and
631 deletions.
There are no files selected for viewing
This file contains 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# code taken from: | ||
# https://gitlab.com/fluidattacks/universe/-/blob/trunk/skims/skims/lib_sast/root/f267/kubernetes.py | ||
|
||
|
||
@atatus.capture_span() | ||
def k8s_check_host_pid( | ||
shard: GraphShard, method_supplies: MethodSupplies | ||
) -> MethodExecutionResult: | ||
method = MethodsEnum.K8S_CHECK_HOST_PID | ||
|
||
def n_ids() -> Iterator[NId]: | ||
graph = shard.syntax_graph | ||
integrity = check_template_integrity_for_all_nodes( | ||
graph, method_supplies.selected_nodes | ||
) | ||
if integrity: # 2 (nested = 1) | ||
for nid in method_supplies.selected_nodes: # 3 (nested = 2) | ||
for c_id in get_host_pid(graph, nid): # 4 (nested = 3) | ||
yield c_id | ||
|
||
return get_vulnerabilities_from_n_ids( | ||
n_ids=n_ids(), | ||
query_supplies=QuerySupplies( | ||
desc_key="f267.k8s_check_host_pid", | ||
desc_params={}, | ||
method=method, | ||
method_calls=len(method_supplies.selected_nodes), | ||
graph_shard=shard, | ||
), | ||
) |
Oops, something went wrong.