Skip to content

chore(ci): Cleanup permission settings#27689

Open
czentgr wants to merge 1 commit intoprestodb:masterfrom
czentgr:cz_remove_gh_workflow_permissions
Open

chore(ci): Cleanup permission settings#27689
czentgr wants to merge 1 commit intoprestodb:masterfrom
czentgr:cz_remove_gh_workflow_permissions

Conversation

@czentgr
Copy link
Copy Markdown
Contributor

@czentgr czentgr commented Apr 30, 2026

The reocmmendation is to set permissions at job level and not globally at the workflow level.
The content: read permission is needed for the
github checkout action.

Description

Motivation and Context

Impact

Test Plan

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
* ... 
* ... 

Hive Connector Changes
* ... 
* ... 

If release note is NOT required, use:

== NO RELEASE NOTE ==

Summary by Sourcery

Scope GitHub Actions permissions to individual jobs instead of the entire workflow for arrow flight and OWASP dependency check workflows.

CI:

  • Move contents: read permission from workflow-level to job-level in arrow flight tests workflow.
  • Set contents: read permission on specific jobs in the OWASP dependency check workflow.

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Apr 30, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 30, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Scopes GitHub Actions workflow permissions from workflow-level to specific jobs that need contents: read access in the arrow-flight-tests and OWASP dependency check workflows, aligning with GitHub’s principle of least privilege.

File-Level Changes

Change Details Files
Scope contents: read permission to specific jobs in the arrow-flight-tests workflow instead of at the workflow level.
  • Remove global permissions block defining contents: read at the top of the workflow.
  • Add job-level permissions with contents: read to the arrowflight-java-tests job.
  • Augment existing permissions of the prestocpp-linux-build-for-test job to include contents: read alongside actions: write.
  • Add job-level permissions with contents: read to the arrowflight-native-e2e-tests job.
.github/workflows/arrow-flight-tests.yml
Scope contents: read permission to the OWASP dependency-check job instead of at the workflow level.
  • Remove workflow-level permissions block defining contents: read.
  • Add job-level permissions with contents: read to the dependency-check job.
.github/workflows/owasp-dependency-check.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

The reocmmendation is to set permissions at job level
and not globally at the workflow level.
The content: read permission is needed for the
github checkout action.
@czentgr czentgr force-pushed the cz_remove_gh_workflow_permissions branch from be4fd4a to 3425ffe Compare May 4, 2026 19:29
@czentgr czentgr marked this pull request as ready for review May 5, 2026 20:10
@czentgr czentgr requested review from a team and unidevel as code owners May 5, 2026 20:10
@prestodb-ci prestodb-ci requested review from a team, Dilli-Babu-Godari and Joe-Abraham and removed request for a team May 5, 2026 20:10
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/owasp-dependency-check.yml" line_range="3-5" />
<code_context>

 on: pull_request

-permissions:
-  contents: read
-
 env:
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Consider keeping a top-level `permissions: {}` to avoid implicit default permissions for other jobs.

By dropping the workflow-level `permissions`, other jobs fall back to GitHub’s broader default token permissions. Keeping a minimal top-level `permissions: {}` and granting `contents: read` only where needed preserves least-privilege across the whole workflow while still scoping this job correctly.

```suggestion
on:
  pull_request: {}
  workflow_dispatch:

permissions: {}

  dependency-check:
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 3 to 5
on:
pull_request: {}
workflow_dispatch:
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.

🚨 suggestion (security): Consider keeping a top-level permissions: {} to avoid implicit default permissions for other jobs.

By dropping the workflow-level permissions, other jobs fall back to GitHub’s broader default token permissions. Keeping a minimal top-level permissions: {} and granting contents: read only where needed preserves least-privilege across the whole workflow while still scoping this job correctly.

Suggested change
on:
pull_request: {}
workflow_dispatch:
on:
pull_request: {}
workflow_dispatch:
permissions: {}
dependency-check:

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

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants