// Copyright (c) 2023 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package scrubber56import "regexp"78var (9// RedactedFieldNames are the names of fields we'll redact10RedactedFieldNames = []string{11"auth_",12"password",13"token",14"ssh",15"private",16"jwt",17"secret",18"email",19}2021// HashedFieldNames name fields whose values we'll hash22HashedFieldNames = []string{23"metaID",24"workspaceID",25"username",26}2728// HashedURLPathsFieldNames name fields with URLS whose paths we'll hash29HashedURLPathsFieldNames = []string{30"contextURL",31}3233// HashedValues are regular expressions which - when matched - cause the entire value to be hashed34HashedValues = map[string]*regexp.Regexp{35"url": regexp.MustCompile(`https?://[^\s]+\.git\b`),36}3738// RedactedValues are regular expressions which - when matched - cause the entire value to be redacted39RedactedValues = map[string]*regexp.Regexp{40// https://html.spec.whatwg.org/multipage/input.html#email-state-(type=email)41"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])?)*`),42}43)444546