Skip to content

Commit 3a96a14

Browse files
authored
(chore): Ignore request originated from terminal when allowed all origin serviceAccount is set (#30)
Signed-off-by: Shubham Chaudhary <[email protected]>
1 parent 8daf11f commit 3a96a14

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/pods/restrict.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func validateOriginServiceAccount(serviceAccount string) (bool, string) {
2828

2929
serviceAccountList := strings.Split(serviceAccount, ":")
3030
if len(serviceAccountList) != 4 {
31-
return false, fmt.Sprintf("%v serviceAccount is not in a valid format 'system:serviceaccount:<ns><name>'")
31+
return false, fmt.Sprintf("%v serviceAccount is not in a valid format 'system:serviceaccount:<ns><name>'", serviceAccount)
3232
}
3333

3434
for _, v := range utils.WebHookFilters.AllowedOriginServiceAccount.AllowedList {
@@ -79,6 +79,9 @@ func validateOriginPodImage(namespace string, extras map[string]v1.ExtraValue, c
7979
}
8080

8181
func originFromTerminal(serviceAccount string) bool {
82+
if utils.WebHookFilters.AllowedOriginServiceAccount.AllowedAll {
83+
return true
84+
}
8285
if strings.Contains(serviceAccount, "system:serviceaccount") {
8386
return false
8487
}

0 commit comments

Comments
 (0)