Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Strokov <pstrokov@gitlab.com>2020-09-08 18:30:35 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2020-09-08 18:30:35 +0300
commitc8ab60d96bfec0c9f13e70f2a03e8207df9e7922 (patch)
tree48abac31d7fa5858dbd7a78851ef7b5551309fac
parentf51896682ed1b30293c8fb3e54beda4c4cde5aa5 (diff)
Renaming of the 'whitelist' to 'allowlist'
All 'whitelist's replaced with 'allowlist'. Closes: https://gitlab.com/gitlab-org/gitaly/-/issues/3031
-rw-r--r--internal/gitaly/rubyserver/proxy.go10
-rw-r--r--internal/gitaly/rubyserver/proxy_test.go8
-rw-r--r--internal/praefect/replicator.go14
3 files changed, 16 insertions, 16 deletions
diff --git a/internal/gitaly/rubyserver/proxy.go b/internal/gitaly/rubyserver/proxy.go
index 17c64c6ba..153e699ed 100644
--- a/internal/gitaly/rubyserver/proxy.go
+++ b/internal/gitaly/rubyserver/proxy.go
@@ -12,7 +12,7 @@ import (
"google.golang.org/grpc/metadata"
)
-// Headers prefixed with this string get whitelisted automatically
+// Headers prefixed with this string get allowlisted automatically
const rubyFeaturePrefix = "gitaly-feature-ruby-"
const (
@@ -76,21 +76,21 @@ func setHeaders(ctx context.Context, repo *gitalypb.Repository, mustExist bool)
}
// list of http/2 headers that will be forwarded as-is to gitaly-ruby
- proxyHeaderWhitelist := []string{
+ proxyHeaderAllowlist := []string{
"gitaly-servers",
praefect_metadata.TransactionMetadataKey,
praefect_metadata.PraefectMetadataKey,
}
if inMD, ok := metadata.FromIncomingContext(ctx); ok {
- // Automatically whitelist any Ruby-specific feature flag
+ // Automatically allowlist any Ruby-specific feature flag
for header := range inMD {
if strings.HasPrefix(header, rubyFeaturePrefix) {
- proxyHeaderWhitelist = append(proxyHeaderWhitelist, header)
+ proxyHeaderAllowlist = append(proxyHeaderAllowlist, header)
}
}
- for _, header := range proxyHeaderWhitelist {
+ for _, header := range proxyHeaderAllowlist {
for _, v := range inMD[header] {
md = metadata.Join(md, metadata.Pairs(header, v))
}
diff --git a/internal/gitaly/rubyserver/proxy_test.go b/internal/gitaly/rubyserver/proxy_test.go
index 7233a57d9..142ff38ba 100644
--- a/internal/gitaly/rubyserver/proxy_test.go
+++ b/internal/gitaly/rubyserver/proxy_test.go
@@ -23,10 +23,10 @@ func TestSetHeadersBlocksUnknownMetadata(t *testing.T) {
require.True(t, ok, "outgoing context should have metadata")
_, ok = outMd[otherKey]
- require.False(t, ok, "outgoing MD should not contain non-whitelisted key")
+ require.False(t, ok, "outgoing MD should not contain non-allowlisted key")
}
-func TestSetHeadersPreservesWhitelistedMetadata(t *testing.T) {
+func TestSetHeadersPreservesAllowlistedMetadata(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
@@ -40,7 +40,7 @@ func TestSetHeadersPreservesWhitelistedMetadata(t *testing.T) {
outMd, ok := metadata.FromOutgoingContext(outCtx)
require.True(t, ok, "outgoing context should have metadata")
- require.Equal(t, []string{value}, outMd[key], "outgoing MD should contain whitelisted key")
+ require.Equal(t, []string{value}, outMd[key], "outgoing MD should contain allowlisted key")
}
func TestRubyFeatureHeaders(t *testing.T) {
@@ -57,5 +57,5 @@ func TestRubyFeatureHeaders(t *testing.T) {
outMd, ok := metadata.FromOutgoingContext(outCtx)
require.True(t, ok, "outgoing context should have metadata")
- require.Equal(t, []string{value}, outMd[key], "outgoing MD should contain whitelisted feature key")
+ require.Equal(t, []string{value}, outMd[key], "outgoing MD should contain allowlisted feature key")
}
diff --git a/internal/praefect/replicator.go b/internal/praefect/replicator.go
index f31745381..440ee0ec9 100644
--- a/internal/praefect/replicator.go
+++ b/internal/praefect/replicator.go
@@ -312,8 +312,8 @@ type ReplMgr struct {
replDelayMetric prommetrics.HistogramVec
replJobTimeout time.Duration
dequeueBatchSize uint
- // whitelist contains the project names of the repos we wish to replicate
- whitelist map[string]struct{}
+ // allowlist contains the project names of the repos we wish to replicate
+ allowlist map[string]struct{}
}
// ReplMgrOpt allows a replicator to be configured with additional options
@@ -346,7 +346,7 @@ func NewReplMgr(log *logrus.Entry, virtualStorages []string, queue datastore.Rep
r := ReplMgr{
log: log.WithField("component", "replication_manager"),
queue: queue,
- whitelist: map[string]struct{}{},
+ allowlist: map[string]struct{}{},
replicator: defaultReplicator{log, rs},
virtualStorages: virtualStorages,
nodeManager: nodeMgr,
@@ -376,11 +376,11 @@ func (r ReplMgr) Collect(ch chan<- prometheus.Metric) {
r.replInFlightMetric.Collect(ch)
}
-// WithWhitelist will configure a whitelist for repos to allow replication
-func WithWhitelist(whitelistedRepos []string) ReplMgrOpt {
+// WithAllowlist will configure a allowlist for repos to allow replication
+func WithAllowlist(allowlistedRepos []string) ReplMgrOpt {
return func(r *ReplMgr) {
- for _, repo := range whitelistedRepos {
- r.whitelist[repo] = struct{}{}
+ for _, repo := range allowlistedRepos {
+ r.allowlist[repo] = struct{}{}
}
}
}