Skip to content

ci: declare explicit token permissions for maintenance workflows#11377

Open
Rohan5commit wants to merge 1 commit intoappwrite:mainfrom
Rohan5commit:ci/declare-explicit-token-permissions-scheduled-workflows
Open

ci: declare explicit token permissions for maintenance workflows#11377
Rohan5commit wants to merge 1 commit intoappwrite:mainfrom
Rohan5commit:ci/declare-explicit-token-permissions-scheduled-workflows

Conversation

@Rohan5commit
Copy link

Summary

Add explicit GITHUB_TOKEN permissions to maintenance/security workflows:

  • .github/workflows/stale.yml
  • .github/workflows/cleanup-cache.yml
  • .github/workflows/nightly.yml

Permission mapping

  • stale.yml: issues: write, pull-requests: write (required by actions/stale)
  • cleanup-cache.yml: actions: write, contents: read (delete Actions cache keys + checkout)
  • nightly.yml: contents: read, security-events: write (checkout + SARIF upload)

Why

These workflows currently rely on implicit default token scopes. Declaring required permissions explicitly improves least-privilege security and makes access requirements auditable.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

📝 Walkthrough

Walkthrough

Three GitHub Actions workflow files (cleanup-cache.yml, nightly.yml, and stale.yml) have been updated to include explicit top-level permissions blocks. The cleanup-cache workflow grants actions: write and contents: read permissions. The nightly workflow grants contents: read and security-events: write permissions. The stale workflow grants write access to issues and pull-requests. No workflow logic, steps, or job configurations were modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding explicit GITHUB_TOKEN permissions to maintenance workflows, which matches the core objective of the PR.
Description check ✅ Passed The description is directly related to the changeset, providing clear context on which workflows are modified, what permissions are added, and why they are needed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
libcrypto3 3.5.4-r0 CVE-2025-15467 CRITICAL
libcrypto3 3.5.4-r0 CVE-2025-69419 HIGH
libcrypto3 3.5.4-r0 CVE-2025-69421 HIGH
libecpg 17.7-r0 CVE-2026-2004 HIGH
libecpg 17.7-r0 CVE-2026-2005 HIGH
libecpg 17.7-r0 CVE-2026-2006 HIGH
libecpg 17.7-r0 CVE-2026-2007 HIGH
libecpg-dev 17.7-r0 CVE-2026-2004 HIGH
libecpg-dev 17.7-r0 CVE-2026-2005 HIGH
libecpg-dev 17.7-r0 CVE-2026-2006 HIGH
libecpg-dev 17.7-r0 CVE-2026-2007 HIGH
libpng 1.6.51-r0 CVE-2025-66293 HIGH
libpng 1.6.51-r0 CVE-2026-22695 HIGH
libpng 1.6.51-r0 CVE-2026-22801 HIGH
libpng-dev 1.6.51-r0 CVE-2025-66293 HIGH
libpng-dev 1.6.51-r0 CVE-2026-22695 HIGH
libpng-dev 1.6.51-r0 CVE-2026-22801 HIGH
libpq 17.7-r0 CVE-2026-2004 HIGH
libpq 17.7-r0 CVE-2026-2005 HIGH
libpq 17.7-r0 CVE-2026-2006 HIGH
libpq 17.7-r0 CVE-2026-2007 HIGH
libpq-dev 17.7-r0 CVE-2026-2004 HIGH
libpq-dev 17.7-r0 CVE-2026-2005 HIGH
libpq-dev 17.7-r0 CVE-2026-2006 HIGH
libpq-dev 17.7-r0 CVE-2026-2007 HIGH
libssl3 3.5.4-r0 CVE-2025-15467 CRITICAL
libssl3 3.5.4-r0 CVE-2025-69419 HIGH
libssl3 3.5.4-r0 CVE-2025-69421 HIGH
openssl 3.5.4-r0 CVE-2025-15467 CRITICAL
openssl 3.5.4-r0 CVE-2025-69419 HIGH
openssl 3.5.4-r0 CVE-2025-69421 HIGH
openssl-dev 3.5.4-r0 CVE-2025-15467 CRITICAL
openssl-dev 3.5.4-r0 CVE-2025-69419 HIGH
openssl-dev 3.5.4-r0 CVE-2025-69421 HIGH
postgresql17-dev 17.7-r0 CVE-2026-2004 HIGH
postgresql17-dev 17.7-r0 CVE-2026-2005 HIGH
postgresql17-dev 17.7-r0 CVE-2026-2006 HIGH
postgresql17-dev 17.7-r0 CVE-2026-2007 HIGH
py3-urllib3 1.26.20-r0 CVE-2026-21441 HIGH
py3-urllib3-pyc 1.26.20-r0 CVE-2026-21441 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/nightly.yml (1)

31-31: ⚠️ Potential issue | 🟡 Minor

github/codeql-action/upload-sarif@v2 is deprecated and discontinued.

CodeQL Action v2 was retired on January 10, 2025 and is no longer supported—all occurrences must be updated to v3 or v4. The current recommended version is v4. Both jobs in this workflow use the deprecated version; the scans may fail or silently produce no results.

⬆️ Proposed fix
-        uses: github/codeql-action/upload-sarif@v2
+        uses: github/codeql-action/upload-sarif@v4

Apply to both Line 31 and Line 49.

Also applies to: 49-49

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/nightly.yml at line 31, Replace the deprecated CodeQL
upload action usage string "uses: github/codeql-action/upload-sarif@v2" with the
supported version (preferably "@v4") in both occurrences in the workflow; locate
the two lines that currently contain the exact symbol
"github/codeql-action/upload-sarif@v2" and update them to
"github/codeql-action/upload-sarif@v4" so the workflow uses the current CodeQL
upload action.
🧹 Nitpick comments (1)
.github/workflows/nightly.yml (1)

23-23: aquasecurity/trivy-action@0.20.0 is significantly outdated — upgrade to at least 0.34.0.

The current release of trivy-action is 0.34.0, which bundles a much newer Trivy version. Using 0.20.0 in a security scanning workflow risks missed CVEs due to the stale vulnerability DB bundled in that version.

⬆️ Proposed fix
-        uses: aquasecurity/trivy-action@0.20.0
+        uses: aquasecurity/trivy-action@0.34.0

Apply to both Line 23 and Line 42.

Also applies to: 42-42

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/nightly.yml at line 23, The workflow uses an outdated
Trivy action reference ("uses: aquasecurity/trivy-action@0.20.0") which should
be upgraded to at least "aquasecurity/trivy-action@0.34.0"; update every
occurrence of the string "aquasecurity/trivy-action@0.20.0" in the workflow
(both occurrences) to "aquasecurity/trivy-action@0.34.0" so the job uses the
newer Trivy release and vulnerability DB.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.github/workflows/nightly.yml:
- Line 31: Replace the deprecated CodeQL upload action usage string "uses:
github/codeql-action/upload-sarif@v2" with the supported version (preferably
"@v4") in both occurrences in the workflow; locate the two lines that currently
contain the exact symbol "github/codeql-action/upload-sarif@v2" and update them
to "github/codeql-action/upload-sarif@v4" so the workflow uses the current
CodeQL upload action.

---

Nitpick comments:
In @.github/workflows/nightly.yml:
- Line 23: The workflow uses an outdated Trivy action reference ("uses:
aquasecurity/trivy-action@0.20.0") which should be upgraded to at least
"aquasecurity/trivy-action@0.34.0"; update every occurrence of the string
"aquasecurity/trivy-action@0.20.0" in the workflow (both occurrences) to
"aquasecurity/trivy-action@0.34.0" so the job uses the newer Trivy release and
vulnerability DB.

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