Repository navigation
feat(captcha): add GeeTest and Corptcha channels with per-scene switches #6882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
0b895b1
9fd8ca7
824bf95
c94b9cf
bab9ecf
dc1bf77
9eb5655
cf5425a
ebdb23f
43478a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| name: Publish Docker image to GHCR | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Version tag to build (e.g. v0.10.8-alpha.3). Leave empty to build sha tag.' | ||
| required: false | ||
| type: string | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| # GHCR 镜像名必须全小写,仓库所有者的用户名需要小写(Wu-jiyan -> wu-jiyan)。 | ||
| IMAGE_NAME: ghcr.io/wu-jiyan/new-api | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build & push multi-arch image | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Check out | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
|
|
||
| - name: Resolve version & write VERSION | ||
| id: version | ||
| run: | | ||
| if [ -n "${{ github.event.inputs.tag }}" ]; then | ||
| VERSION="${{ github.event.inputs.tag }}" | ||
| elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then | ||
| VERSION="${GITHUB_REF#refs/tags/}" | ||
| else | ||
| VERSION="sha-${GITHUB_SHA::7}" | ||
| fi | ||
| echo "${VERSION}" > VERSION | ||
| echo "VERSION=${VERSION}" >> "$GITHUB_ENV" | ||
| echo "Building version: ${VERSION}" | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Resolve the commit behind the current v3 tag, then pin this SHA after review.
git ls-remote https://github.com/docker/setup-qemu-action.git \
'refs/tags/v3^{}' 'refs/tags/v3'Repository: QuantumNous/new-api Length of output: 211 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- workflow references ---'
sed -n '40,52p' .github/workflows/docker-image-ghcr.yml
rg -n '^[[:space:]]+uses:' .github/workflows/docker-image-ghcr.yml
printf '%s\n' '--- tag and commit resolution ---'
git ls-remote https://github.com/docker/setup-qemu-action.git \
'refs/tags/v3' 'refs/tags/v3^{}'
sha="$(git ls-remote https://github.com/docker/setup-qemu-action.git 'refs/tags/v3' | awk '{print $1}')"
curl -fsSL "https://api.github.com/repos/docker/setup-qemu-action/commits/$sha" \
| jq -r '[.sha, .commit.message] | `@tsv`'Repository: QuantumNous/new-api Length of output: 1235 🌐 Web query:
💡 Result: The commit hash c7c53464625b32c7a7e944ae62b3e17d2b600130 refers to a specific point in the development history of the docker/setup-qemu-action GitHub repository [1]. This repository provides a GitHub Action used to install QEMU static binaries, enabling the execution of containers built for different architectures on GitHub-hosted runners [2][3]. While this commit is part of the v3 release series of the action, it is not a formal release tag itself [4][5]. As of August 2026, the project has progressed significantly beyond this commit, with stable releases reaching v4.x [2][3][5]. The v3 series was initiated in September 2023 with version v3.0.0 [6]. Users looking to use this action in their workflows are encouraged to use the latest stable version (e.g., v4.x) by referencing it in their workflow files [2][7]: - uses: docker/setup-qemu-action@v4 This action is commonly used alongside docker/setup-buildx-action to support cross-platform container builds [2][3][7]. It works by registering QEMU emulators with binfmt_misc, allowing the host runner to interpret foreign architecture binaries [2][3]. Citations:
Pin
🤖 Prompt for AI Agents |
||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | ||
|
|
||
| - name: Log in to GHCR | ||
| uses: docker/login-action@c99871dec2022cc055c062a10cc1a1310835ceb4 # v4.3.0 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Extract metadata (labels/tags) | ||
| id: meta | ||
| uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 | ||
| with: | ||
| images: ${{ env.IMAGE_NAME }} | ||
| tags: | | ||
| type=ref,event=tag | ||
| type=sha,prefix=sha- | ||
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }} | ||
| type=raw,value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' }} | ||
|
|
||
| - name: Build & push multi-arch image | ||
| id: build | ||
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| provenance: mode=max | ||
| sbom: true | ||
|
|
||
| - name: Image summary | ||
| run: | | ||
| echo "### GHCR Image (${{ env.VERSION }})" >> $GITHUB_STEP_SUMMARY | ||
| echo '```' >> $GITHUB_STEP_SUMMARY | ||
| echo "${{ env.IMAGE_NAME }}:${{ env.VERSION }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "${{ steps.build.outputs.digest }}" >> $GITHUB_STEP_SUMMARY | ||
| echo '```' >> $GITHUB_STEP_SUMMARY | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Sanitize the workflow-dispatch tag before use.
Line 35 and Line 36 insert
github.event.inputs.tagdirectly into the shell program. A crafted dispatch value can execute commands with this job'spackages: writetoken. The same unvalidated value reaches metadata parsing on Line 68 and later expression expansion.Pass the input through a step environment variable. Validate it as a Docker tag. Export only the validated value through
$GITHUB_OUTPUT.Proposed fix
- name: Resolve version & write VERSION id: version + env: + REQUESTED_TAG: ${{ github.event.inputs.tag }} run: | - if [ -n "${{ github.event.inputs.tag }}" ]; then - VERSION="${{ github.event.inputs.tag }}" + if [ -n "$REQUESTED_TAG" ]; then + VERSION="$REQUESTED_TAG" elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then VERSION="${GITHUB_REF#refs/tags/}" else VERSION="sha-${GITHUB_SHA::7}" fi + if ! [[ "$VERSION" =~ ^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$ ]]; then + echo "Invalid Docker image tag: $VERSION" >&2 + exit 1 + fi echo "${VERSION}" > VERSION - echo "VERSION=${VERSION}" >> "$GITHUB_ENV" + printf 'VERSION=%s\n' "$VERSION" >> "$GITHUB_ENV" + printf 'version=%s\n' "$VERSION" >> "$GITHUB_OUTPUT" echo "Building version: ${VERSION}" @@ - type=raw,value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' }} + type=raw,value=${{ steps.version.outputs.version }},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' }}Also applies to: 42-43, 67-68, 86-88
🧰 Tools
🪛 zizmor (1.29.0)
[error] 35-35: code injection via template expansion (template-injection): may expand into attacker-controllable code
(template-injection)
[error] 36-36: code injection via template expansion (template-injection): may expand into attacker-controllable code
(template-injection)
🤖 Prompt for AI Agents
Source: Linters/SAST tools