Skip to content

Add least-privilege permissions to GitHub Actions workflows - #1742

Merged
aleksandar-apostolov merged 55 commits into
developfrom
ci/workflow-least-privilege-permissions
Jul 9, 2026
Merged

Add least-privilege permissions to GitHub Actions workflows#1742
aleksandar-apostolov merged 55 commits into
developfrom
ci/workflow-least-privilege-permissions

Conversation

@peter-matkovski

@peter-matkovski peter-matkovski commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Goal

Add least-privilege permissions blocks to GitHub Actions workflows to resolve CodeQL actions/missing-workflow-permissions alerts (APPSEC-164).

Implementation

  • Add explicit workflow-level permissions blocks across GitHub Actions workflows.
  • Default to read-only scopes (contents: read, pull-requests: read).
  • Grant write scopes only where jobs need them (artifacts, Danger, release git push).

Testing

  • CI green on this PR
  • Code scanning alerts close after merge

Add explicit workflow-level permissions blocks to resolve CodeQL
actions/missing-workflow-permissions alerts. Scopes are derived from
workflow operations (git push, artifact upload, Danger, release lanes).

Refs: APPSEC-164
Add explicit workflow-level permissions blocks to resolve CodeQL
actions/missing-workflow-permissions alerts. Scopes are derived from
workflow operations (git push, artifact upload, Danger, release lanes).

Refs: APPSEC-164
Add explicit workflow-level permissions blocks to resolve CodeQL
actions/missing-workflow-permissions alerts. Scopes are derived from
workflow operations (git push, artifact upload, Danger, release lanes).

Refs: APPSEC-164
Add explicit workflow-level permissions blocks to resolve CodeQL
actions/missing-workflow-permissions alerts. Scopes are derived from
workflow operations (git push, artifact upload, Danger, release lanes).

Refs: APPSEC-164
Add explicit workflow-level permissions blocks to resolve CodeQL
actions/missing-workflow-permissions alerts. Scopes are derived from
workflow operations (git push, artifact upload, Danger, release lanes).

Refs: APPSEC-164
Add explicit workflow-level permissions blocks to resolve CodeQL
actions/missing-workflow-permissions alerts. Scopes are derived from
workflow operations (git push, artifact upload, Danger, release lanes).

Refs: APPSEC-164
Add explicit workflow-level permissions blocks to resolve CodeQL
actions/missing-workflow-permissions alerts. Scopes are derived from
workflow operations (git push, artifact upload, Danger, release lanes).

Refs: APPSEC-164
Add explicit workflow-level permissions blocks to resolve CodeQL
actions/missing-workflow-permissions alerts. Scopes are derived from
workflow operations (git push, artifact upload, Danger, release lanes).

Refs: APPSEC-164
Add explicit workflow-level permissions blocks to resolve CodeQL
actions/missing-workflow-permissions alerts. Scopes are derived from
workflow operations (git push, artifact upload, Danger, release lanes).

Refs: APPSEC-164
@peter-matkovski
peter-matkovski requested a review from a team as a code owner July 8, 2026 11:26
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Nine GitHub Actions workflow files gain explicit permissions blocks scoping the GITHUB_TOKEN to specific read/write permissions for contents, actions, issues, and pull-requests. No job logic, triggers, or build/test steps were modified.

Changes

Workflow Permissions Hardening

Layer / File(s) Summary
CI/build/test workflow permissions
.github/workflows/android.yml, .github/workflows/app-distribute.yml, .github/workflows/e2e-build.yml, .github/workflows/e2e-test-cron.yml, .github/workflows/e2e-test.yml, .github/workflows/internal-app-distribute.yml
Adds top-level permissions blocks granting scoped combinations of contents: read, actions: write, and pull-requests: read.
Misc automation workflow permissions
.github/workflows/no-response.yml, .github/workflows/publish-new-version.yml, .github/workflows/sdk-size-updates.yml
Adds permissions blocks granting contents: read, issues: write, and pull-requests: read as applicable.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

Nine little workflows, locked up tight,
Tokens now scoped just right.
No more roaming wild and free,
Just read and write where it should be.
🐇 Hop, hop, ship it—CI's secure tonight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding least-privilege permissions to GitHub Actions workflows.
Description check ✅ Passed The description includes the goal, implementation, and testing, which covers the main template requirements despite missing optional sections.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/workflow-least-privilege-permissions

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/e2e-test-cron.yml (1)

21-24: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Scope actions: write to the artifact-uploading jobs
Keep contents: read at the workflow level, but move actions: write onto both build-compose-apks and run-compose-tests-nightly; slack doesn’t need it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/e2e-test-cron.yml around lines 21 - 24, The workflow
currently grants actions: write at the top level, but this permission should be
scoped only to the artifact-uploading jobs. Keep contents: read at the workflow
level, and move actions: write onto the build-compose-apks and
run-compose-tests-nightly jobs only; leave slack without that permission.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/e2e-build.yml:
- Around line 12-14: The workflow permissions are broader than needed because
the e2e-build job grants actions: write even though the referenced actions only
require read access. Update the permissions block in the e2e-build workflow to
remove the actions scope and keep only contents: read, so the job runs with
least privilege.

---

Nitpick comments:
In @.github/workflows/e2e-test-cron.yml:
- Around line 21-24: The workflow currently grants actions: write at the top
level, but this permission should be scoped only to the artifact-uploading jobs.
Keep contents: read at the workflow level, and move actions: write onto the
build-compose-apks and run-compose-tests-nightly jobs only; leave slack without
that permission.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f5ed9698-6507-40eb-b5c1-31c763a16829

📥 Commits

Reviewing files that changed from the base of the PR and between 374d8c1 and 0ad2db7.

📒 Files selected for processing (9)
  • .github/workflows/android.yml
  • .github/workflows/app-distribute.yml
  • .github/workflows/e2e-build.yml
  • .github/workflows/e2e-test-cron.yml
  • .github/workflows/e2e-test.yml
  • .github/workflows/internal-app-distribute.yml
  • .github/workflows/no-response.yml
  • .github/workflows/publish-new-version.yml
  • .github/workflows/sdk-size-updates.yml

Comment thread .github/workflows/e2e-build.yml Outdated
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.27 MB 12.27 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.68 MB 5.68 MB 0.00 MB 🟢
stream-video-android-ui-compose 6.20 MB 6.20 MB 0.00 MB 🟢

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@peter-matkovski peter-matkovski added the pr:ci CI / GitHub Actions / workflow updates label Jul 8, 2026
Comment thread .github/workflows/android.yml Fixed
Comment thread .github/workflows/app-distribute.yml Fixed
Comment thread .github/workflows/e2e-test-cron.yml Fixed
Comment thread .github/workflows/internal-app-distribute.yml Fixed
Comment thread .github/workflows/android.yml Fixed
Comment thread .github/workflows/internal-app-distribute.yml Fixed
Comment thread .github/workflows/internal-app-distribute.yml Fixed
Comment thread .github/workflows/internal-app-distribute.yml Fixed
Comment thread .github/workflows/internal-app-distribute.yml Fixed
Comment thread .github/workflows/internal-app-distribute.yml Fixed
Comment thread .github/workflows/e2e-build.yml Fixed
@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@aleksandar-apostolov aleksandar-apostolov added pr:ignore-for-release Exclude from changelog generation and removed pr:ignore-for-release Exclude from changelog generation labels Jul 9, 2026
@aleksandar-apostolov
aleksandar-apostolov merged commit 5e3547d into develop Jul 9, 2026
16 of 19 checks passed
@aleksandar-apostolov
aleksandar-apostolov deleted the ci/workflow-least-privilege-permissions branch July 9, 2026 08:27
@aleksandar-apostolov aleksandar-apostolov changed the title CI: add least-privilege permissions to GitHub Actions workflows Add least-privilege permissions to GitHub Actions workflows Jul 9, 2026
@stream-public-bot stream-public-bot added the released Included in a release label Jul 14, 2026
@stream-public-bot

Copy link
Copy Markdown
Collaborator

🚀 Available in v1.29.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:ci CI / GitHub Actions / workflow updates released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants