Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/gitpod-protocol/src/util/scrubbing-config.ts
2500 views
1
/**
2
* Copyright (c) 2023 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
// redactedFields are the names of fields we'll redact when matched
8
export const redactedFields = ["auth_", "password", "token", "key", "jwt", "secret", "email"];
9
// hashedFields are the names of fields we'll hash if matched
10
export const hashedFields = ["contextURL", "workspaceID", "username"];
11
12
// hashedValues are regular expressions which when matched cause the entire value to be hashed
13
export const hashedValues = new Map<string, RegExp>([["url", /https?:\/\/[^\s]+\.git\b/g]]);
14
// redactedValues are regular expressions which when matched cause the entire value to be redacted
15
export const redactedValues = new Map<string, RegExp>([
16
// https://html.spec.whatwg.org/multipage/input.html#email-state-(type=email)
17
[
18
"email",
19
new RegExp(
20
/[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])?)*/,
21
"g",
22
),
23
],
24
]);
25
26