Skip to content

Backport/master to 2.x#261

Merged
hfudev merged 3 commits intorelease/v2.xfrom
backport/master-to-2.x
Mar 19, 2026
Merged

Backport/master to 2.x#261
hfudev merged 3 commits intorelease/v2.xfrom
backport/master-to-2.x

Conversation

@hfudev
Copy link
Copy Markdown
Member

@hfudev hfudev commented Mar 19, 2026

No description provided.

hfudev and others added 3 commits March 19, 2026 11:25
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v7...v8)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.15.1 → v0.15.6](astral-sh/ruff-pre-commit@v0.15.1...v0.15.6)
@hfudev hfudev self-assigned this Mar 19, 2026
Comment on lines +27 to +33
run: |
if [ -f pr_number.txt ]; then
echo "PR_NUMBER=$(cat pr_number.txt)" >> $GITHUB_ENV
else
echo "pr_number.txt not found, skipping comment."
exit 0
fi

Check failure

Code scanning / CodeQL

Environment variable built from user-controlled sources Critical

Potential environment variable injection in
if [ -f pr_number.txt ]; thenecho "PR_NUMBER=$(cat pr_number.txt)" >> $GITHUB_ENVelseecho "pr_number.txt not found, skipping comment."exit 0fi
, which may be controlled by an external user (
workflow_run
).

Copilot Autofix

AI 28 days ago

In general, to fix this class of issues you must ensure that data written to $GITHUB_ENV cannot contain untrusted newlines or here‑doc delimiters. For single-line variables, strip or reject newline characters from the source before writing; for multi-line variables, use a unique, hard‑to‑guess delimiter. Here, we only need a single-line numeric PR number, so the safest approach is to read pr_number.txt, strip any newlines, and optionally validate that it’s a simple integer, then write that sanitized value into $GITHUB_ENV.

Concretely, in .github/workflows/pr-test-summary.yml, modify the Read PR number step so that instead of echo "PR_NUMBER=$(cat pr_number.txt)" >> $GITHUB_ENV, we (1) read the file into a shell variable, (2) delete all newline characters and non‑digits (or reject if invalid), and (3) append a single, sanitized PR_NUMBER=... line to $GITHUB_ENV. For example:

PR_NUMBER_RAW=$(cat pr_number.txt)
PR_NUMBER_SANITIZED=$(printf '%s' "$PR_NUMBER_RAW" | tr -d '\n\r' | tr -cd '0-9')
if [ -z "$PR_NUMBER_SANITIZED" ]; then
  echo "Invalid PR number in pr_number.txt, skipping comment."
  exit 0
fi
echo "PR_NUMBER=$PR_NUMBER_SANITIZED" >> "$GITHUB_ENV"

This keeps functionality (using the PR number from the artifact) while preventing injection via newlines or unexpected characters. No new imports or external dependencies are required; only standard POSIX utilities (cat, printf, tr, basic test) are used.

Suggested changeset 1
.github/workflows/pr-test-summary.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/pr-test-summary.yml b/.github/workflows/pr-test-summary.yml
--- a/.github/workflows/pr-test-summary.yml
+++ b/.github/workflows/pr-test-summary.yml
@@ -26,7 +26,13 @@
       - name: Read PR number
         run: |
           if [ -f pr_number.txt ]; then
-            echo "PR_NUMBER=$(cat pr_number.txt)" >> $GITHUB_ENV
+            PR_NUMBER_RAW=$(cat pr_number.txt)
+            PR_NUMBER_SANITIZED=$(printf '%s' "$PR_NUMBER_RAW" | tr -d '\n\r' | tr -cd '0-9')
+            if [ -z "$PR_NUMBER_SANITIZED" ]; then
+              echo "Invalid PR number in pr_number.txt, skipping comment."
+              exit 0
+            fi
+            echo "PR_NUMBER=$PR_NUMBER_SANITIZED" >> "$GITHUB_ENV"
           else
             echo "pr_number.txt not found, skipping comment."
             exit 0
EOF
@@ -26,7 +26,13 @@
- name: Read PR number
run: |
if [ -f pr_number.txt ]; then
echo "PR_NUMBER=$(cat pr_number.txt)" >> $GITHUB_ENV
PR_NUMBER_RAW=$(cat pr_number.txt)
PR_NUMBER_SANITIZED=$(printf '%s' "$PR_NUMBER_RAW" | tr -d '\n\r' | tr -cd '0-9')
if [ -z "$PR_NUMBER_SANITIZED" ]; then
echo "Invalid PR number in pr_number.txt, skipping comment."
exit 0
fi
echo "PR_NUMBER=$PR_NUMBER_SANITIZED" >> "$GITHUB_ENV"
else
echo "pr_number.txt not found, skipping comment."
exit 0
Copilot is powered by AI and may make mistakes. Always verify output.
@github-actions
Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
idf_build_apps
   __main__.py330%4–9
   app.py5508285%197, 242, 251–253, 285, 297, 353–354, 356, 365–366, 377–378, 438, 453, 491, 547–555, 565–566, 576, 594–595, 597, 613–622, 640–644, 659–662, 677–678, 696–697, 701–702, 713–715, 721, 734–736, 881–889, 899–929, 933–943, 1038–1044, 1047, 1069, 1089–1093
   args.py3763192%124, 188, 410–415, 425–430, 632, 635–636, 677, 700, 707–708, 720–722, 756–757, 885, 958, 960, 1020, 1049–1059, 1078
   autocompletions.py292417%16–23, 31–54
   finder.py89496%154, 171–173
   log.py661183%33, 37, 48, 58–67, 112
   main.py2216869%72, 77–81, 128, 133–137, 176, 200–202, 206–207, 213–226, 240–243, 254–279, 369–376, 385–386, 413–420, 423, 429–430, 436–438, 511–526
   session_args.py53787%46–50, 56, 70
   utils.py1882388%26, 35, 113, 130–131, 155, 203, 246, 273–279, 292–295, 309–315, 397
idf_build_apps/junit
   report.py93990%82, 92, 109–111, 137, 144–145, 170
   utils.py291066%18, 26–35
idf_build_apps/manifest
   manifest.py2841395%121, 139, 147, 154, 159, 250, 307–312, 419, 449–450, 469, 521
   soc_header.py220%4–6
idf_build_apps/vendors
   pydantic_sources.py68593%52, 75, 78–81
TOTAL215829286% 

Tests Skipped Failures Errors Time
164 0 💤 0 ❌ 0 🔥 10m 24s ⏱️

@hfudev hfudev merged commit 6951b6c into release/v2.x Mar 19, 2026
7 of 8 checks passed
@hfudev hfudev deleted the backport/master-to-2.x branch March 19, 2026 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants