Skip to content

Commit cd4a53a

Browse files
committed
fix(helm-automount-audit): audit AutoscalingRunnerSet and bare Pods, not just workload controllers (M2)
1 parent 16fed3b commit cd4a53a

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

‎.github/workflows/helm-automount-audit.yaml‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,26 @@ jobs:
6060
- name: Audit pod token automount
6161
shell: bash
6262
run: |
63+
# Covers workload controllers (Deployment/StatefulSet/DaemonSet),
64+
# ARC runner scale sets (AutoscalingRunnerSet — its pod spec lives at
65+
# .spec.template.spec, same as a Deployment), and bare Pods (whose
66+
# automount field is at .spec, not .spec.template.spec). Without ARC
67+
# + Pod the audit emits a false all-clear for exactly the runner pods
68+
# that most need a token-automount check.
69+
# $isPod below is a yq variable (not shell) — do not let the shell
70+
# expand it.
6371
# shellcheck disable=SC2016
6472
automounts=$(yq -N \
65-
'select((.kind == "Deployment" or .kind == "StatefulSet" or .kind == "DaemonSet")
66-
and .spec.template.spec.automountServiceAccountToken != false)
67-
| .metadata.name' \
73+
'select(.kind == "Deployment" or .kind == "StatefulSet" or .kind == "DaemonSet"
74+
or .kind == "AutoscalingRunnerSet" or .kind == "Pod")
75+
| (.kind == "Pod") as $isPod
76+
| {"name": .metadata.name,
77+
"automount": (
78+
(select($isPod) | .spec.automountServiceAccountToken),
79+
(select($isPod == false) | .spec.template.spec.automountServiceAccountToken)
80+
)}
81+
| select(.automount != false)
82+
| .name' \
6883
/tmp/rendered.yaml | sort -u || true)
6984
{
7085
echo "### Pod Token Automount Audit"

0 commit comments

Comments
 (0)