Browse code

Replace uses of blacklist/whitelist

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2020/07/14 17:41:34
Showing 3 changed files
... ...
@@ -14,7 +14,7 @@ import (
14 14
 	"golang.org/x/sys/windows"
15 15
 )
16 16
 
17
-var pathBlacklist = map[string]bool{
17
+var pathDenyList = map[string]bool{
18 18
 	"c:\\":        true,
19 19
 	"c:\\windows": true,
20 20
 }
... ...
@@ -98,7 +98,7 @@ func validateCopySourcePath(imageSource *imageMount, origPath, platform string)
98 98
 			p = filepath.Join("c:\\", p)
99 99
 		}
100 100
 	}
101
-	if _, blacklisted := pathBlacklist[p]; blacklisted {
101
+	if _, ok := pathDenyList[p]; ok {
102 102
 		return errors.New("copy from c:\\ or c:\\windows is not allowed on windows")
103 103
 	}
104 104
 	return nil
... ...
@@ -298,17 +298,17 @@ func (pm *Manager) GC() {
298 298
 	pm.muGC.Lock()
299 299
 	defer pm.muGC.Unlock()
300 300
 
301
-	whitelist := make(map[digest.Digest]struct{})
301
+	used := make(map[digest.Digest]struct{})
302 302
 	for _, p := range pm.config.Store.GetAll() {
303
-		whitelist[p.Config] = struct{}{}
303
+		used[p.Config] = struct{}{}
304 304
 		for _, b := range p.Blobsums {
305
-			whitelist[b] = struct{}{}
305
+			used[b] = struct{}{}
306 306
 		}
307 307
 	}
308 308
 
309 309
 	ctx := context.TODO()
310 310
 	pm.blobStore.Walk(ctx, func(info content.Info) error {
311
-		_, ok := whitelist[info.Digest]
311
+		_, ok := used[info.Digest]
312 312
 		if ok {
313 313
 			return nil
314 314
 		}
... ...
@@ -40,7 +40,7 @@ func arches() []types.Architecture {
40 40
 	}
41 41
 }
42 42
 
43
-// DefaultProfile defines the whitelist for the default seccomp profile.
43
+// DefaultProfile defines the allowed syscalls for the default seccomp profile.
44 44
 func DefaultProfile() *types.Seccomp {
45 45
 	syscalls := []*types.Syscall{
46 46
 		{