Files
greptimedb/.github/workflows/dependency-check.yml
T
Ning Sunanddennis zhuang 768834c465 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>
2026-12-01 07:29:14 +00:00

44 lines
1.1 KiB
YAML

name: Check Dependencies
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
# Least-privilege default for every job; jobs that need more grant it explicitly.
permissions:
contents: read
jobs:
check-dependencies:
if: ${{ github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
- name: Run cargo tree
run: cargo tree --prefix none > dependencies.txt
- name: Extract dependency names
run: awk '{print $1}' dependencies.txt > dependency_names.txt
- name: Check for blacklisted crates
run: |
while read -r dep; do
if grep -qFx "$dep" dependency_names.txt; then
echo "Blacklisted crate '$dep' found in dependencies."
exit 1
fi
done < .github/cargo-blacklist.txt
echo "No blacklisted crates found."