Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
affd79fd
Unverified
Commit
affd79fd
authored
Jul 20, 2016
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InitContainers are not checked for hostPort ranges
PodSecurityPolicy must verify that host port ranges are guarded on init containers.
parent
d0ddefff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
provider.go
pkg/security/podsecuritypolicy/provider.go
+6
-0
admission_test.go
...kg/admission/security/podsecuritypolicy/admission_test.go
+5
-2
No files found.
pkg/security/podsecuritypolicy/provider.go
View file @
affd79fd
...
...
@@ -250,6 +250,12 @@ func (s *simpleProvider) ValidateContainerSecurityContext(pod *api.Pod, containe
allErrs
=
append
(
allErrs
,
s
.
hasInvalidHostPort
(
&
c
,
idxPath
)
...
)
}
containersPath
=
fldPath
.
Child
(
"initContainers"
)
for
idx
,
c
:=
range
pod
.
Spec
.
InitContainers
{
idxPath
:=
containersPath
.
Index
(
idx
)
allErrs
=
append
(
allErrs
,
s
.
hasInvalidHostPort
(
&
c
,
idxPath
)
...
)
}
if
!
s
.
psp
.
Spec
.
HostPID
&&
pod
.
Spec
.
SecurityContext
.
HostPID
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
.
Child
(
"hostPID"
),
pod
.
Spec
.
SecurityContext
.
HostPID
,
"Host PID is not allowed to be used"
))
}
...
...
plugin/pkg/admission/security/podsecuritypolicy/admission_test.go
View file @
affd79fd
...
...
@@ -394,8 +394,11 @@ func TestAdmitHostPorts(t *testing.T) {
},
}
for
k
,
v
:=
range
tests
{
testPSPAdmit
(
k
,
v
.
psps
,
v
.
pod
,
v
.
shouldPass
,
v
.
expectedPSP
,
t
)
for
i
:=
0
;
i
<
2
;
i
++
{
for
k
,
v
:=
range
tests
{
v
.
pod
.
Spec
.
Containers
,
v
.
pod
.
Spec
.
InitContainers
=
v
.
pod
.
Spec
.
InitContainers
,
v
.
pod
.
Spec
.
Containers
testPSPAdmit
(
k
,
v
.
psps
,
v
.
pod
,
v
.
shouldPass
,
v
.
expectedPSP
,
t
)
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment