Skip to content

Commit 26a56a3

Browse files
author
OpenShift Bot
authored
Merge pull request #14548 from php-coder/scc_prioritization_and_projected_type
Merged by openshift-bot
2 parents b140175 + b79d723 commit 26a56a3

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

pkg/security/scc/byrestrictions.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ func pointValue(constraint *kapi.SecurityContextConstraints) int {
4949
return points
5050
}
5151

52-
// allowsHostPathVolume returns a score based on the volumes allowed by the SCC.
53-
// Allowing a host volume wil return a score of 10. Allowance of anything other
54-
// than kapi.FSTypeSecret, kapi.FSTypeConfigMap, kapi.FSTypeConfigMap, kapi.FSTypeDownwardAPI
55-
// will result in a score of 5. If the SCC only allows kapi.FSTypeSecret, kapi.FSTypeConfigMap,
56-
// kapi.FSTypeEmptyDir, kapi.FSTypeDownwardAPI it will have a score of 0.
52+
// volumePointValue returns a score based on the volumes allowed by the SCC.
53+
// Allowing a host volume will return a score of 10. Allowance of anything other
54+
// than Secret, ConfigMap, EmptyDir, DownwardAPI, Projected, and None will result in
55+
// a score of 5. If the SCC only allows these trivial types, it will have a
56+
// score of 0.
5757
func volumePointValue(scc *kapi.SecurityContextConstraints) int {
5858
hasHostVolume := false
5959
hasNonTrivialVolume := false
@@ -66,8 +66,8 @@ func volumePointValue(scc *kapi.SecurityContextConstraints) int {
6666
// it is easier to specifically list the trivial volumes and allow the
6767
// default case to be non-trivial so we don't have to worry about adding
6868
// volumes in the future unless they're trivial.
69-
case kapi.FSTypeSecret, kapi.FSTypeConfigMap,
70-
kapi.FSTypeEmptyDir, kapi.FSTypeDownwardAPI, kapi.FSTypeNone:
69+
case kapi.FSTypeSecret, kapi.FSTypeConfigMap, kapi.FSTypeEmptyDir,
70+
kapi.FSTypeDownwardAPI, kapi.FSProjected, kapi.FSTypeNone:
7171
// do nothing
7272
default:
7373
hasNonTrivialVolume = true

pkg/security/scc/byrestrictions_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@ func TestVolumePointValue(t *testing.T) {
144144
},
145145
expectedPoints: 0,
146146
},
147+
"trivial - projected": {
148+
scc: &kapi.SecurityContextConstraints{
149+
Volumes: []kapi.FSType{kapi.FSProjected},
150+
},
151+
expectedPoints: 0,
152+
},
153+
"trivial - none": {
154+
scc: &kapi.SecurityContextConstraints{
155+
Volumes: []kapi.FSType{kapi.FSTypeNone},
156+
},
157+
expectedPoints: 0,
158+
},
147159
"no volumes allowed": {
148160
scc: newSCC(false, false, false),
149161
expectedPoints: 0,

0 commit comments

Comments
 (0)