Skip to content

Commit

Permalink
fix(apparmor): use regex replace to remove all special characters to …
Browse files Browse the repository at this point in the history
…maintain older apparmor compat

Signed-off-by: daemon1024 <[email protected]>
  • Loading branch information
daemon1024 committed Nov 5, 2024
1 parent d2a9a88 commit f16ad02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions KubeArmor/enforcer/appArmorTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ profile {{.Name}} flags=(attach_disconnected,mediate_deleted) {
{{template "file-section" . }}
## == DISPATCHER START == ##
{{- range $source, $value:= $.FromSource}}
{{$source}} px -> {{$v := $.Name | split "."}}{{$v._0}}_{{ $source | replace "/" "" | replace "." "" }},
{{$source}} px -> {{$v := $.Name | split "."}}{{$v._0}}_{{ regexReplaceAllLiteral "[^a-z A-Z 0-9]" $source "" }},
{{- end}}
{{- range $value, $data := .ProcessPaths}}
{{- $suffix := ""}}
Expand Down Expand Up @@ -146,7 +146,7 @@ profile {{.Name}} flags=(attach_disconnected,mediate_deleted) {
## == FromSource per binary profiles START == ##
{{- range $source, $value := $.FromSource}}
profile {{$v := $.Name | split "."}}{{$v._0}}_{{ $source | replace "/" "" | replace "." "" }} {
profile {{$v := $.Name | split "."}}{{$v._0}}_{{ regexReplaceAllLiteral "[^a-z A-Z 0-9]" $source "" }} {
{{$source}} rix,
{{template "pre-section" $value }}
{{template "file-section" $value}}
Expand Down

0 comments on commit f16ad02

Please sign in to comment.