Skip to content

Commit 217484d

Browse files
committed
Remove unused function and add nolint where it's wrong
Signed-off-by: Tingmao Wang <[email protected]>
1 parent f1b3bcf commit 217484d

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

pkg/securitypolicy/securitypolicy_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ 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+
//nolint:unused // linting is wrong, this is used in rego_utils_test.go
2728
func substituteUVMPath(sandboxID string, m mountInternal) mountInternal {
2829
if strings.HasPrefix(m.Source, guestpath.SandboxMountPrefix) {
2930
m.Source = specInternal.SandboxMountSource(sandboxID, m.Source)

pkg/securitypolicy/securitypolicyenforcer.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package securitypolicy
22

33
import (
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.

0 commit comments

Comments
 (0)