Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/python-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
build:
name: build docs
runs-on: ubuntu-latest
outputs:
pages-enabled: ${{ steps.pages-check.outputs.enabled }}

steps:
- name: Checkout
Expand All @@ -45,9 +47,26 @@ jobs:
with:
path: docs/generated

- name: Check GitHub Pages status
id: pages-check
env:
GH_TOKEN: ${{ github.token }}
run: |
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/pages")
if [ "${STATUS}" = "200" ]; then
echo "enabled=true" >> "${GITHUB_OUTPUT}"
else
echo "enabled=false" >> "${GITHUB_OUTPUT}"
echo "::notice::GitHub Pages is not configured for this repository. Skipping deployment."
fi
Comment on lines +55 to +64
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The STATUS variable extracted from curl output is written to GITHUB_OUTPUT without validation. According to the repository's security practices (see .github/workflows/python-release.yml:66 and .github/workflows/monorepo-release.yml:44), extracted values should be validated with regex patterns before writing to GITHUB_OUTPUT to prevent newline injection attacks.

The HTTP status code should be validated to ensure it contains only digits before being used in the conditional. While the current code writes "enabled=true" or "enabled=false" (which are safe), the STATUS variable itself should still be validated as a defense-in-depth measure.

Suggested validation:

  • Add a check like: if [[ ! "$STATUS" =~ ^[0-9]+$ ]]; then echo "::error::Invalid HTTP status received"; exit 1; fi

Copilot uses AI. Check for mistakes.

deploy:
name: deploy to GitHub Pages
needs: build
if: needs.build.outputs.pages-enabled == 'true'
runs-on: ubuntu-latest

environment:
Expand Down
Loading