identify content to redact based on location and content pattern. #1839
Some checks failed
Build and test GAM / build (false, build, 1, Build Intel Ubuntu Jammy, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (false, build, 10, Build x86_64 macOS 15, macos-15-intel) (push) Has been cancelled
Build and test GAM / build (false, build, 11, Build Arm MacOS 26, macos-26) (push) Has been cancelled
Build and test GAM / build (false, build, 12, Build Intel Windows, windows-2025) (push) Has been cancelled
Build and test GAM / build (false, build, 13, Build Arm Windows, windows-11-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 2, Build Intel Ubuntu Noble, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (false, build, 3, Build Arm Ubuntu Noble, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 4, Build Arm Ubuntu Jammy, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (false, build, 5, Build Intel StaticX Legacy, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 6, Build Arm StaticX Legacy, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (false, build, 7, Build Intel MacOS, macos-13) (push) Has been cancelled
Build and test GAM / build (false, build, 8, Build Arm MacOS 14, macos-14) (push) Has been cancelled
Build and test GAM / build (false, build, 9, Build Arm MacOS 15, macos-15) (push) Has been cancelled
Build and test GAM / build (false, test, 14, Test Python 3.10, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (false, test, 15, Test Python 3.11, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (false, test, 16, Test Python 3.12, ubuntu-24.04, 3.12) (push) Has been cancelled
Build and test GAM / build (false, test, 17, Test Python 3.15-dev, ubuntu-24.04, 3.15-dev) (push) Has been cancelled
Build and test GAM / build (true, test, 18, Test Python 3.14 freethread, ubuntu-24.04, 3.14) (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-certs (push) Has been cancelled

This commit is contained in:
Jay Lee
2025-10-16 19:15:40 +00:00
parent 906ee82417
commit 5cc68247a3

View File

@@ -376,16 +376,25 @@ YUBIKEY_MULTIPLE_CONNECTED_RC = 86
YUBIKEY_NOT_FOUND_RC = 87
def redact_sensitive_google_text(text):
patterns = [
r'ya29.[0-9A-Za-z-_]+', # Access token
r'1%2F%2F[0-9A-Za-z-_]{100}|1%2F%2F[0-9A-Za-z-_]{64}|1%2F%2F[0-9A-Za-z-_]{43}', # Refresh token
r'4/[0-9A-Za-z-_]+', # Auth code
r'GOCSPX-[0-9a-zA-Z-_]{28}', # Client secret
r'AIza[0-9A-Za-z-_]{35}', # API key
r'eyJ[a-zA-Z0-9\-_]+\.eyJ[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]*' # JWT
replace_patterns = [
# Positional patterns that redact sensitive credentials based on their location
(r'(Bearer\s+)\S+', r'\1*****'), # access tokens and JWTs in auth header
(r'([?&]refresh_token=)[^&]*', r'\1*****'), # refresh token URL parameter
(r'([?&]client_secret=)[^&]*', r'\1*****'), # client secret URL parameter
(r'([?&]key=)[^&]*', r'\1*****'), # API key URL parameter
(r'([?&]code=)[^&]*', r'\1*****'), # auth code URL parameter
# pattern match patterns that redact sensitive credentials based on known credential pattern
(r'ya29.[0-9A-Za-z-_]+', '*****'), # Access token
(r'1%2F%2F[0-9A-Za-z-_]{100}|1%2F%2F[0-9A-Za-z-_]{64}|1%2F%2F[0-9A-Za-z-_]{43}', '*****'), # Refresh token
(r'4/[0-9A-Za-z-_]+', '*****'), # Auth code
(r'GOCSPX-[0-9a-zA-Z-_]{28}', '*****'), # Client secret
(r'AIza[0-9A-Za-z-_]{35}', '*****'), # API key
(r'eyJ[a-zA-Z0-9\-_]+\.eyJ[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]*', '*****'), # JWT
]
for pattern in patterns:
text = re.sub(pattern, '****', text)
for pattern, replace in replace_patterns:
text = re.sub(pattern, replace, text)
return text
def redactable_debug_print(*args):