Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/scrubber/config.go
2492 views
1
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package scrubber
6
7
import "regexp"
8
9
var (
10
// RedactedFieldNames are the names of fields we'll redact
11
RedactedFieldNames = []string{
12
"auth_",
13
"password",
14
"token",
15
"ssh",
16
"private",
17
"jwt",
18
"secret",
19
"email",
20
}
21
22
// HashedFieldNames name fields whose values we'll hash
23
HashedFieldNames = []string{
24
"metaID",
25
"workspaceID",
26
"username",
27
}
28
29
// HashedURLPathsFieldNames name fields with URLS whose paths we'll hash
30
HashedURLPathsFieldNames = []string{
31
"contextURL",
32
}
33
34
// HashedValues are regular expressions which - when matched - cause the entire value to be hashed
35
HashedValues = map[string]*regexp.Regexp{
36
"url": regexp.MustCompile(`https?://[^\s]+\.git\b`),
37
}
38
39
// RedactedValues are regular expressions which - when matched - cause the entire value to be redacted
40
RedactedValues = map[string]*regexp.Regexp{
41
// https://html.spec.whatwg.org/multipage/input.html#email-state-(type=email)
42
"email": regexp.MustCompile(`[a-zA-Z0-9.!#$%&'*+\/=?^_` + "`" + `{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*`),
43
}
44
)
45
46