@@ -11,7 +11,7 @@ permissions:
1111 issues : read
1212engine :
1313 id : claude
14- max-turns : 10
14+ max-turns : 6
1515features :
1616 cli-proxy : true
1717tools :
@@ -20,6 +20,31 @@ tools:
2020network :
2121 allowed :
2222 - github
23+ if : needs.check_security_relevance.outputs.security_files_changed != '0'
24+ jobs :
25+ check_security_relevance :
26+ runs-on : ubuntu-latest
27+ permissions :
28+ pull-requests : read
29+ outputs :
30+ security_files_changed : ${{ steps.check.outputs.count }}
31+ steps :
32+ - name : Check security relevance
33+ id : check
34+ run : |
35+ if [ -z "${PR_NUMBER}" ]; then
36+ echo "count=1" >> "$GITHUB_OUTPUT"
37+ exit 0
38+ fi
39+ SECURITY_RE="host-iptables|setup-iptables|squid-config|docker-manager|seccomp-profile|domain-patterns|entrypoint\.sh|Dockerfile|(^|/)containers/"
40+ COUNT=$(gh api "repos/${GH_REPO}/pulls/${PR_NUMBER}/files" \
41+ --paginate --jq '.[].filename' \
42+ | grep -cE "$SECURITY_RE" || true)
43+ echo "count=$COUNT" >> "$GITHUB_OUTPUT"
44+ env :
45+ GH_TOKEN : ${{ github.token }}
46+ PR_NUMBER : ${{ github.event.pull_request.number }}
47+ GH_REPO : ${{ github.repository }}
2348safe-outputs :
2449 threat-detection :
2550 enabled : false
5782 id : security-relevance
5883 if : github.event.pull_request.number
5984 run : |
60- SECURITY_RE="host-iptables|setup-iptables|squid-config|docker-manager|seccomp-profile|domain-patterns|entrypoint\.sh|Dockerfile|containers/"
85+ SECURITY_RE="host-iptables|setup-iptables|squid-config|docker-manager|seccomp-profile|domain-patterns|entrypoint\.sh|Dockerfile|(^|/) containers/"
6186 COUNT=$(gh api "repos/${GH_REPO}/pulls/${PR_NUMBER}/files" \
6287 --paginate --jq '.[].filename' \
6388 | grep -cE "$SECURITY_RE" || true)
6691 GH_TOKEN : ${{ github.token }}
6792 PR_NUMBER : ${{ github.event.pull_request.number }}
6893 GH_REPO : ${{ github.repository }}
94+
6995---
7096
7197# Security Guard
@@ -74,7 +100,7 @@ steps:
74100
75101** Security-critical files changed in this PR:** ${{ steps.security-relevance.outputs.security_files_changed }}
76102
77- > If this value is ` 0 ` , no security-critical files were modified. Use ` noop ` immediately without further analysis — this PR does not require a security review .
103+ > If this value is ` 0 ` , the workflow skips the agent job .
78104
79105## Repository Context
80106
@@ -119,40 +145,7 @@ Analyze PR #${{ github.event.pull_request.number }} in repository ${{ github.rep
119145
120146## Security Checks
121147
122- Look for these types of security-weakening changes:
123-
124- ### iptables and Network Filtering
125- - Changes that add new ACCEPT rules without proper justification
126- - Removal or weakening of DROP/REJECT rules
127- - Changes to the firewall chain structure (FW_WRAPPER, DOCKER-USER)
128- - DNS exfiltration prevention bypasses (allowing arbitrary DNS servers)
129- - IPv6 filtering gaps that could allow bypasses
130-
131- ### Squid Proxy Configuration
132- - Changes to ACL rule ordering that could allow blocked traffic
133- - Removal of domain blocking functionality
134- - Addition of overly permissive domain patterns (e.g., ` *.* ` )
135- - Changes that allow non-standard ports (only 80/443 should be allowed)
136- - Timeout changes that could enable connection-based attacks
137-
138- ### Container Security
139- - Removal or weakening of capability dropping (cap_drop)
140- - Addition of dangerous capabilities (SYS_ADMIN, NET_RAW readdition)
141- - Changes to seccomp profile that allow dangerous syscalls
142- - Removal of resource limits
143- - Changes that run as root instead of unprivileged user
144-
145- ### Domain Pattern Security
146- - Removal of wildcard pattern validation
147- - Allowing overly broad patterns like ` * ` or ` *.* `
148- - Changes to protocol handling that could bypass restrictions
149-
150- ### General Security
151- - Hardcoded credentials or secrets
152- - Removal of input validation
153- - Introduction of command injection vulnerabilities
154- - Changes that disable security features via environment variables
155- - Dependency updates that introduce known vulnerabilities
148+ Check for these security-weakening changes: new/expanded ACCEPT rules, weakened DROP/REJECT, firewall chain rewiring, DNS or IPv6 bypasses, Squid ACL/order regressions, non-80/443 egress allowances, wildcard/domain validation bypasses, capability additions (` SYS_ADMIN ` , ` NET_RAW ` ), seccomp relaxations, removal of resource/user hardening, input validation removal, command injection risk, hardcoded secrets, security-disabling env var changes, or risky dependency updates.
156149
157150## Output Format
158151
0 commit comments