mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-12-03 07:55:25 +00:00
ci: scope GITHUB_TOKEN permissions in workflows and fix ReDoS in compat updater (#10739)
Add a top-level `permissions: contents: read` to the 15 workflows that had no default, so every job runs with a least-privilege token instead of the repository's read/write default. Jobs that need more grant it explicitly: `publish-github-release` (creates the release), the `update-compat-versions` caller (a caller's permissions are the ceiling for the reusable workflow), `apidoc` (deploys gh-pages), and nightly-ci `notification` (opens an issue). Also rewrite the two array-capturing regexes in `.github/scripts/update-compat-versions.py` from `(?:[^\]]|\n)*?` to `[^\]]*?`; the alternation was redundant and backtracked exponentially on newline-heavy input. Resolves CodeQL `actions/missing-workflow-permissions` (79 alerts) and `py/redos` (2 alerts). Signed-off-by: Ning Sun <sunning@greptime.com> Co-authored-by: dennis zhuang <killme2008@gmail.com>
This commit is contained in:
co-authored by
dennis zhuang
parent
64943b35b6
commit
768834c465
@@ -40,11 +40,11 @@ from typing import Iterable
|
||||
|
||||
VERSION_RE = re.compile(r"^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$")
|
||||
FROM_VERSIONS_RE = re.compile(
|
||||
r"(?ms)^(?P<indent>[ \t]*)from_versions[ \t]*=[ \t]*(?P<array>\[(?:[^\]]|\n)*?\])"
|
||||
r"(?ms)^(?P<indent>[ \t]*)from_versions[ \t]*=[ \t]*(?P<array>\[[^\]]*?\])"
|
||||
)
|
||||
FROM_VERSIONS_ASSIGNMENT_RE = re.compile(r"(?m)^[ \t]*from_versions[ \t]*=")
|
||||
FROM_RANGE_RE = re.compile(
|
||||
r"(?ms)^[ \t]*from_range[ \t]*=[ \t]*(?P<array>\[(?:[^\]]|\n)*?\])"
|
||||
r"(?ms)^[ \t]*from_range[ \t]*=[ \t]*(?P<array>\[[^\]]*?\])"
|
||||
)
|
||||
FROM_RANGE_ASSIGNMENT_RE = re.compile(r"(?m)^[ \t]*from_range[ \t]*=")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user