From cdab2588aa6eefcb9b330a0c1157d98a5f34022e Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Wed, 19 Jun 2024 18:44:55 +0100 Subject: [PATCH] refractor(aa): newRuleFromLog -> newBaseFromLog --- pkg/aa/base.go | 2 +- pkg/aa/capability.go | 2 +- pkg/aa/change_profile.go | 2 +- pkg/aa/dbus.go | 2 +- pkg/aa/file.go | 4 ++-- pkg/aa/io_uring.go | 2 +- pkg/aa/mount.go | 6 +++--- pkg/aa/mqueue.go | 2 +- pkg/aa/network.go | 2 +- pkg/aa/pivot_root.go | 2 +- pkg/aa/ptrace.go | 2 +- pkg/aa/rlimit.go | 2 +- pkg/aa/signal.go | 2 +- pkg/aa/unix.go | 2 +- pkg/aa/userns.go | 2 +- 15 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pkg/aa/base.go b/pkg/aa/base.go index b65e81bb6..112f32b34 100644 --- a/pkg/aa/base.go +++ b/pkg/aa/base.go @@ -49,7 +49,7 @@ func newRule(rule []string) RuleBase { } } -func newRuleFromLog(log map[string]string) RuleBase { +func newBaseFromLog(log map[string]string) RuleBase { comment := "" fileInherit, noNewPrivs, optional := false, false, false diff --git a/pkg/aa/capability.go b/pkg/aa/capability.go index 285f473e5..7f370c575 100644 --- a/pkg/aa/capability.go +++ b/pkg/aa/capability.go @@ -33,7 +33,7 @@ type Capability struct { func newCapabilityFromLog(log map[string]string) Rule { return &Capability{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), Names: Must(toValues(CAPABILITY, "name", log["capname"])), } diff --git a/pkg/aa/change_profile.go b/pkg/aa/change_profile.go index 611fe2ce3..061389727 100644 --- a/pkg/aa/change_profile.go +++ b/pkg/aa/change_profile.go @@ -24,7 +24,7 @@ type ChangeProfile struct { func newChangeProfileFromLog(log map[string]string) Rule { return &ChangeProfile{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), ExecMode: log["mode"], Exec: log["exec"], diff --git a/pkg/aa/dbus.go b/pkg/aa/dbus.go index afddd3ef5..f1f880a14 100644 --- a/pkg/aa/dbus.go +++ b/pkg/aa/dbus.go @@ -42,7 +42,7 @@ func newDbusFromLog(log map[string]string) Rule { peerName = log["name"] } return &Dbus{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), Access: []string{log["mask"]}, Bus: log["bus"], diff --git a/pkg/aa/file.go b/pkg/aa/file.go index 66a577fe0..a74025742 100644 --- a/pkg/aa/file.go +++ b/pkg/aa/file.go @@ -55,7 +55,7 @@ func newFileFromLog(log map[string]string) Rule { return newLinkFromLog(log) } return &File{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), Owner: isOwner(log), Path: log["name"], @@ -114,7 +114,7 @@ type Link struct { func newLinkFromLog(log map[string]string) Rule { return &Link{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), Owner: isOwner(log), Path: log["name"], diff --git a/pkg/aa/io_uring.go b/pkg/aa/io_uring.go index 78c3b1227..ad18a6104 100644 --- a/pkg/aa/io_uring.go +++ b/pkg/aa/io_uring.go @@ -25,7 +25,7 @@ type IOUring struct { func newIOUringFromLog(log map[string]string) Rule { return &IOUring{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), Access: Must(toAccess(IOURING, log["requested"])), Label: log["label"], diff --git a/pkg/aa/mount.go b/pkg/aa/mount.go index a81401e3c..f2efc143a 100644 --- a/pkg/aa/mount.go +++ b/pkg/aa/mount.go @@ -64,7 +64,7 @@ type Mount struct { func newMountFromLog(log map[string]string) Rule { return &Mount{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), MountConditions: newMountConditionsFromLog(log), Source: log["srcname"], @@ -114,7 +114,7 @@ type Umount struct { func newUmountFromLog(log map[string]string) Rule { return &Umount{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), MountConditions: newMountConditionsFromLog(log), MountPoint: log["name"], @@ -160,7 +160,7 @@ type Remount struct { func newRemountFromLog(log map[string]string) Rule { return &Remount{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), MountConditions: newMountConditionsFromLog(log), MountPoint: log["name"], diff --git a/pkg/aa/mqueue.go b/pkg/aa/mqueue.go index 9809039c2..2428b9042 100644 --- a/pkg/aa/mqueue.go +++ b/pkg/aa/mqueue.go @@ -39,7 +39,7 @@ func newMqueueFromLog(log map[string]string) Rule { mqueueType = "sysv" } return &Mqueue{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), Access: Must(toAccess(MQUEUE, log["requested"])), Type: mqueueType, diff --git a/pkg/aa/network.go b/pkg/aa/network.go index 4970bc972..4051ee1f5 100644 --- a/pkg/aa/network.go +++ b/pkg/aa/network.go @@ -72,7 +72,7 @@ type Network struct { func newNetworkFromLog(log map[string]string) Rule { return &Network{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), AddressExpr: newAddressExprFromLog(log), Domain: log["family"], diff --git a/pkg/aa/pivot_root.go b/pkg/aa/pivot_root.go index 0adeb62cb..7ac0b02f6 100644 --- a/pkg/aa/pivot_root.go +++ b/pkg/aa/pivot_root.go @@ -16,7 +16,7 @@ type PivotRoot struct { func newPivotRootFromLog(log map[string]string) Rule { return &PivotRoot{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), OldRoot: log["srcname"], NewRoot: log["name"], diff --git a/pkg/aa/ptrace.go b/pkg/aa/ptrace.go index 5276d315f..7614c69c7 100644 --- a/pkg/aa/ptrace.go +++ b/pkg/aa/ptrace.go @@ -27,7 +27,7 @@ type Ptrace struct { func newPtraceFromLog(log map[string]string) Rule { return &Ptrace{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), Access: Must(toAccess(PTRACE, log["requested_mask"])), Peer: log["peer"], diff --git a/pkg/aa/rlimit.go b/pkg/aa/rlimit.go index 415f443bf..5491446e7 100644 --- a/pkg/aa/rlimit.go +++ b/pkg/aa/rlimit.go @@ -29,7 +29,7 @@ type Rlimit struct { func newRlimitFromLog(log map[string]string) Rule { return &Rlimit{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Key: log["key"], Op: log["op"], Value: log["value"], diff --git a/pkg/aa/signal.go b/pkg/aa/signal.go index 53dcc3a5a..514fd6b99 100644 --- a/pkg/aa/signal.go +++ b/pkg/aa/signal.go @@ -41,7 +41,7 @@ type Signal struct { func newSignalFromLog(log map[string]string) Rule { return &Signal{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), Access: Must(toAccess(SIGNAL, log["requested_mask"])), Set: []string{log["signal"]}, diff --git a/pkg/aa/unix.go b/pkg/aa/unix.go index 41afbad6c..23066fdaf 100644 --- a/pkg/aa/unix.go +++ b/pkg/aa/unix.go @@ -36,7 +36,7 @@ type Unix struct { func newUnixFromLog(log map[string]string) Rule { return &Unix{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), Access: Must(toAccess(UNIX, log["requested_mask"])), Type: log["sock_type"], diff --git a/pkg/aa/userns.go b/pkg/aa/userns.go index 8a1338550..28bc948c6 100644 --- a/pkg/aa/userns.go +++ b/pkg/aa/userns.go @@ -16,7 +16,7 @@ type Userns struct { func newUsernsFromLog(log map[string]string) Rule { return &Userns{ - RuleBase: newRuleFromLog(log), + RuleBase: newBaseFromLog(log), Qualifier: newQualifierFromLog(log), Create: true, }