Skip to content

Commit 2cd2ff6

Browse files
committed
all: avoid awkward wording from CL 236857
CL 236857 removed all uses of whitelist/blacklist, which is great. But it substituted awkward phrasing using allowlist/blocklist, especially as verbs or participles. This CL uses more standard English, like "allow the function" or "blocked functions" instead of "allowlist the function" or "blocklisted functions". Change-Id: I9106a2fdbd62751c4cbda3a77181358a8a6d0f13 Reviewed-on: https://go-review.googlesource.com/c/go/+/236917 Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent bddf75d commit 2cd2ff6

File tree

10 files changed

+26
-28
lines changed

10 files changed

+26
-28
lines changed

doc/go1.10.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ <h3 id="cgo">Cgo</h3>
267267

268268
<p>
269269
Options specified by cgo using <code>#cgo CFLAGS</code> and the like
270-
are now checked against an allowlist of permitted options.
270+
are now checked against a list of permitted options.
271271
This closes a security hole in which a downloaded package uses
272272
compiler options like
273273
<span style="white-space: nowrap"><code>-fplugin</code></span>

src/cmd/compile/fmt_test.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func TestFormats(t *testing.T) {
9696
}
9797

9898
importPath := filepath.Join("cmd/compile", path)
99-
if blocklistedPackages[filepath.ToSlash(importPath)] {
99+
if ignoredPackages[filepath.ToSlash(importPath)] {
100100
return filepath.SkipDir
101101
}
102102

@@ -344,8 +344,7 @@ func collectPkgFormats(t *testing.T, pkg *build.Package) {
344344
for index, file := range files {
345345
ast.Inspect(file, func(n ast.Node) bool {
346346
if call, ok := n.(*ast.CallExpr); ok {
347-
// ignore blocklisted functions
348-
if blocklistedFunctions[nodeString(call.Fun)] {
347+
if ignoredFunctions[nodeString(call.Fun)] {
349348
return true
350349
}
351350
// look for an arguments that might be a format string
@@ -354,7 +353,7 @@ func collectPkgFormats(t *testing.T, pkg *build.Package) {
354353
// make sure we have enough arguments
355354
n := numFormatArgs(s)
356355
if i+1+n > len(call.Args) {
357-
t.Errorf("%s: not enough format args (blocklist %s?)", posString(call), nodeString(call.Fun))
356+
t.Errorf("%s: not enough format args (ignore %s?)", posString(call), nodeString(call.Fun))
358357
break // ignore this call
359358
}
360359
// assume last n arguments are to be formatted;
@@ -549,14 +548,14 @@ func formatReplace(in string, f func(i int, s string) string) string {
549548
return string(append(buf, in[i0:]...))
550549
}
551550

552-
// blocklistedPackages is the set of packages which can
551+
// ignoredPackages is the set of packages which can
553552
// be ignored.
554-
var blocklistedPackages = map[string]bool{}
553+
var ignoredPackages = map[string]bool{}
555554

556-
// blocklistedFunctions is the set of functions which may have
555+
// ignoredFunctions is the set of functions which may have
557556
// format-like arguments but which don't do any formatting and
558557
// thus may be ignored.
559-
var blocklistedFunctions = map[string]bool{}
558+
var ignoredFunctions = map[string]bool{}
560559

561560
func init() {
562561
// verify that knownFormats entries are correctly formatted

src/cmd/go/internal/work/gc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func gcBackendConcurrency(gcflags []string) int {
168168
CheckFlags:
169169
for _, flag := range gcflags {
170170
// Concurrent compilation is presumed incompatible with any gcflags,
171-
// except for a small allowlist of commonly used flags.
171+
// except for known commonly used flags.
172172
// If the user knows better, they can manually add their own -c to the gcflags.
173173
switch flag {
174174
case "-N", "-l", "-S", "-B", "-C", "-I":

src/cmd/link/internal/loader/loader.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -634,15 +634,15 @@ func (l *Loader) checkdup(name string, r *oReader, li int, dup Sym) {
634634
}
635635
fmt.Fprintf(os.Stderr, "cmd/link: while reading object for '%v': duplicate symbol '%s', previous def at '%v', with mismatched payload: %s\n", r.unit.Lib, name, rdup.unit.Lib, reason)
636636

637-
// For the moment, allowlist DWARF subprogram DIEs for
637+
// For the moment, allow DWARF subprogram DIEs for
638638
// auto-generated wrapper functions. What seems to happen
639639
// here is that we get different line numbers on formal
640640
// params; I am guessing that the pos is being inherited
641641
// from the spot where the wrapper is needed.
642-
allowlist := strings.HasPrefix(name, "go.info.go.interface") ||
642+
allowed := strings.HasPrefix(name, "go.info.go.interface") ||
643643
strings.HasPrefix(name, "go.info.go.builtin") ||
644644
strings.HasPrefix(name, "go.debuglines")
645-
if !allowlist {
645+
if !allowed {
646646
l.strictDupMsgs++
647647
}
648648
}

src/cmd/oldlink/internal/objfile/objfile.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -411,16 +411,16 @@ overwrite:
411411
}
412412
fmt.Fprintf(os.Stderr, "cmd/link: while reading object for '%v': duplicate symbol '%s', previous def at '%v', with mismatched payload: %s\n", r.lib, dup, dup.Unit.Lib, reason)
413413

414-
// For the moment, allowlist DWARF subprogram DIEs for
414+
// For the moment, allow DWARF subprogram DIEs for
415415
// auto-generated wrapper functions. What seems to happen
416416
// here is that we get different line numbers on formal
417417
// params; I am guessing that the pos is being inherited
418418
// from the spot where the wrapper is needed.
419-
allowlist := (strings.HasPrefix(dup.Name, "go.info.go.interface") ||
419+
allowed := (strings.HasPrefix(dup.Name, "go.info.go.interface") ||
420420
strings.HasPrefix(dup.Name, "go.info.go.builtin") ||
421421
strings.HasPrefix(dup.Name, "go.isstmt.go.builtin") ||
422422
strings.HasPrefix(dup.Name, "go.debuglines"))
423-
if !allowlist {
423+
if !allowed {
424424
r.strictDupMsgs++
425425
}
426426
}

src/html/template/html.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,7 @@ func htmlNameFilter(args ...interface{}) string {
240240
}
241241
s = strings.ToLower(s)
242242
if t := attrType(s); t != contentTypePlain {
243-
// TODO: Split attr and element name part filters so we can allowlist
244-
// attributes.
243+
// TODO: Split attr and element name part filters so we can recognize known attributes.
245244
return filterFailsafe
246245
}
247246
for _, r := range s {

src/net/http/request.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ func valueOrDefault(value, def string) string {
503503

504504
// NOTE: This is not intended to reflect the actual Go version being used.
505505
// It was changed at the time of Go 1.1 release because the former User-Agent
506-
// had ended up on a blocklist for some intrusion detection systems.
506+
// had ended up blocked by some intrusion detection systems.
507507
// See https://codereview.appspot.com/7532043.
508508
const defaultUserAgent = "Go-http-client/1.1"
509509

src/net/http/server.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1698,9 +1698,9 @@ func (c *conn) closeWriteAndWait() {
16981698
time.Sleep(rstAvoidanceDelay)
16991699
}
17001700

1701-
// validNextProto reports whether the proto is not a blocklisted ALPN
1702-
// protocol name. Empty and built-in protocol types are blocklisted
1703-
// and can't be overridden with alternate implementations.
1701+
// validNextProto reports whether the proto is a valid ALPN protocol name.
1702+
// Everything is valid except the empty string and built-in protocol types,
1703+
// so that those can't be overridden with alternate implementations.
17041704
func validNextProto(proto string) bool {
17051705
switch proto {
17061706
case "", "http/1.1", "http/1.0":

src/runtime/cgo_sigaction.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ var _cgo_sigaction unsafe.Pointer
1818
//go:nosplit
1919
//go:nowritebarrierrec
2020
func sigaction(sig uint32, new, old *sigactiont) {
21-
// The runtime package is explicitly blocklisted from sanitizer
22-
// instrumentation in racewalk.go, but we might be calling into instrumented C
23-
// functions here — so we need the pointer parameters to be properly marked.
21+
// racewalk.go avoids adding sanitizing instrumentation to package runtime,
22+
// but we might be calling into instrumented C functions here,
23+
// so we need the pointer parameters to be properly marked.
2424
//
25-
// Mark the input as having been written before the call and the output as
26-
// read after.
25+
// Mark the input as having been written before the call
26+
// and the output as read after.
2727
if msanenabled && new != nil {
2828
msanwrite(unsafe.Pointer(new), unsafe.Sizeof(*new))
2929
}

src/runtime/debugcall.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func debugCallCheck(pc uintptr) string {
6161
"debugCall16384",
6262
"debugCall32768",
6363
"debugCall65536":
64-
// These functions are allowlisted so that the debugger can initiate multiple function calls.
64+
// These functions are allowed so that the debugger can initiate multiple function calls.
6565
// See: https://golang.org/cl/161137/
6666
return
6767
}

0 commit comments

Comments
 (0)