fix(openshift): block SCC escalation via annotations - #3994
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3994 +/- ##
==========================================
+ Coverage 26.44% 26.70% +0.25%
==========================================
Files 465 465
Lines 24991 25009 +18
==========================================
+ Hits 6609 6678 +69
+ Misses 17661 17601 -60
- Partials 721 730 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@pratap0007 Can you update docs/SCCConfig.md with the new approch |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jkhelil The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
khrm
left a comment
There was a problem hiding this comment.
@pratap0007 Can you squash this? And push after fix?
Fixes a security vulnerability where empty maxAllowed in
TektonConfig.spec.platforms.openshift.scc allowed privilege
escalation to any SCC (including privileged) via namespace
annotations.
Implemented three-layer defense-in-depth:
- Layer 1: Default maxAllowed to match default SCC (prevents
empty configuration)
- Layer 2: Namespace webhook validates the maxAllowed if it is empty
then allow only default SCC.
- Layer 3: RBAC reconciler treats empty maxAllowed as default
SCC (final enforcement)
This prevents attackers from annotating namespaces with
operator.tekton.dev/scc=privileged to gain node-level access.
Signed-off-by: pratap0007 <shverma@redhat.com.com>
Empty maxAllowed is now treated as "only the default SCC is allowed" to prevent privilege escalation via the operator.tekton.dev/scc namespace annotation. Document the new defaulting (maxAllowed defaults to default SCC) and note that requesting a less restrictive SCC such as anyuid now requires setting maxAllowed explicitly in TektonConfig. Signed-off-by: Anitha Natarajan <anataraj@redhat.com> Assisted-by: GitHub Copilot
785a739 to
6f7df4a
Compare
|
Thank you, @anithapriyanatarajan, for the document updated and looks good to me. |
Changes
Fixes a security vulnerability where empty maxAllowed in
TektonConfig.spec.platforms.openshift.scc allowed privilege
escalation to any SCC (including privileged) via namespace
annotations.
Implemented three-layer defense-in-depth:
This prevents attackers from annotating namespaces with
operator.tekton.dev/scc=privileged to gain node-level access.
Manual Testing on OpenShift Cluster
Prerequisites
oc get tektonconfig configTest Cases
✅ Test 1: Default SCC Should Be Allowed
Expected: Namespace created successfully
Cleanup:
oc delete namespace test-default-scc❌ Test 2: Privileged SCC Should Be Blocked (Security Fix)
Expected: Error message:
❌ Test 3: Anyuid SCC Should Be Blocked (Security Fix)
Expected: Similar rejection with
anyuidin the error message✅ Test 4: Set maxAllowed - Verify Normal Flow Still Works
Expected: Namespace created successfully
Cleanup:
oc delete namespace test-anyuid-allowedSubmitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make test lintbefore submitting a PRSee the contribution guide for more details.
Release Notes
-->