fix(aa-log): ensure we also split quote in log value

fix #229
This commit is contained in:
Alexandre Pujol 2024-10-02 21:06:45 +01:00
parent 3f98e86e24
commit 14a5d8deae
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
3 changed files with 28 additions and 1 deletions

View file

@ -138,7 +138,12 @@ func New(file io.Reader, profile string) AppArmorLogs {
aa := make(AppArmorLog)
for _, item := range tmp {
kv := strings.Split(item, "=")
kv := strings.FieldsFunc(item, func(r rune) bool {
if r == '"' {
quoted = !quoted
}
return !quoted && r == '='
})
if len(kv) >= 2 {
key, value := kv[0], kv[1]
if slices.Contains(toClean, key) {