File tree Expand file tree Collapse file tree 3 files changed +4
-22
lines changed
Expand file tree Collapse file tree 3 files changed +4
-22
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ const osType = "linux"
2424// substituteUVMPath substitutes mount prefix to an appropriate path inside
2525// UVM. At policy generation time, it's impossible to tell what the sandboxID
2626// will be, so the prefix substitution needs to happen during runtime.
27+ //
28+ //nolint:unused // linting is wrong, this is used in rego_utils_test.go
2729func substituteUVMPath (sandboxID string , m mountInternal ) mountInternal {
2830 if strings .HasPrefix (m .Source , guestpath .SandboxMountPrefix ) {
2931 m .Source = specInternal .SandboxMountSource (sandboxID , m .Source )
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ const osType = "windows"
1212// substituteUVMPath substitutes mount prefix to an appropriate path inside
1313// UVM. At policy generation time, it's impossible to tell what the sandboxID
1414// will be, so the prefix substitution needs to happen during runtime.
15+ //
16+ //nolint:unused // linting is wrong, this is used in rego_utils_test.go
1517func substituteUVMPath (sandboxID string , m mountInternal ) mountInternal {
1618 //no-op for windows
1719 _ = sandboxID
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ package securitypolicy
22
33import (
44 "context"
5- "encoding/base64"
6- "encoding/json"
75 "fmt"
86 "syscall"
97
@@ -144,26 +142,6 @@ func (s stringSet) contains(item string) bool {
144142 return contains
145143}
146144
147- func newSecurityPolicyFromBase64JSON (base64EncodedPolicy string ) (* SecurityPolicy , error ) {
148- // base64 decode the incoming policy string
149- // its base64 encoded because it is coming from an annotation
150- // annotations are a map of string to string
151- // we want to store a complex json object so.... base64 it is
152- jsonPolicy , err := base64 .StdEncoding .DecodeString (base64EncodedPolicy )
153- if err != nil {
154- return nil , errors .Wrap (err , "unable to decode policy from Base64 format" )
155- }
156-
157- // json unmarshall the decoded to a SecurityPolicy
158- securityPolicy := new (SecurityPolicy )
159- err = json .Unmarshal (jsonPolicy , securityPolicy )
160- if err != nil {
161- return nil , errors .Wrap (err , "unable to unmarshal JSON policy" )
162- }
163-
164- return securityPolicy , nil
165- }
166-
167145// CreateSecurityPolicyEnforcer returns an appropriate enforcer for input
168146// parameters. Returns an error if the requested `enforcer` implementation
169147// isn't registered.
You can’t perform that action at this time.
0 commit comments