Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

closed-by-commit: Broaden validation of Github secret tokens.

Alex Vandiver8c97cf9cd044
diff --git a/tools/closed-by-commits b/tools/closed-by-commits
index b97dd71bf24..a128f135c78 100755
--- a/tools/closed-by-commits
+++ b/tools/closed-by-commits
@@ -369,9 +369,12 @@ class CommitRangeAnalyzer:
def validate_github_token(value: str) -> str:
- if not value.startswith("github_"):
- raise typer.BadParameter("Github access tokens start with `github_`")
- return value
+ # https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-authentication-to-github#githubs-token-formats
+ if value.startswith("github_"):
+ return value
+ if re.match(r"gh[pousr]_", value):
+ return value
+ raise typer.BadParameter("Github access tokens start with `github_`, or `gh`")
from enum import Enum