Fix daily report#122
Conversation
Summary by CodeRabbit
WalkthroughA GitHub Actions workflow file was updated to authenticate using a GitHub App token instead of a default approach, replaced manual git commit/push operations with an automated PR creation action, and bumped dependencies to newer major versions. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/open-prs.yaml (1)
17-20: Setpersist-credentialstofalseto reduce token exposure.At Line 19,
persist-credentials: truepersists the checkout token to the runner's temporary storage, making it available to subsequent steps in the same job. Since the workflow explicitly uses a GitHub App token for later operations, there is no need to keep the checkout token in memory; set this tofalseto reduce the attack surface.♻️ Proposed change
- name: Checkout repository uses: actions/checkout@v6 with: - persist-credentials: true + persist-credentials: false fetch-depth: 1🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/open-prs.yaml around lines 17 - 20, Change the actions/checkout@v6 step to set persist-credentials: false to avoid leaving the checkout token available to later steps; locate the checkout step that currently has persist-credentials: true and replace it with persist-credentials: false so subsequent steps use the explicit GitHub App token instead of the persisted runner token.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/open-prs.yaml:
- Around line 33-37: The workflow step that configures the GitHub App auth uses
owner without scoping repositories (the fields client-id and private-key), which
grants the token access to all installation repos; update that step to include
an explicit repositories list (e.g., repositories: [ "org/repo-name" ] or the
specific repo variables) and tighten permissions to only what the job needs,
leaving client-id, private-key and owner as-is but adding repositories and
minimal permissions to limit scope.
---
Nitpick comments:
In @.github/workflows/open-prs.yaml:
- Around line 17-20: Change the actions/checkout@v6 step to set
persist-credentials: false to avoid leaving the checkout token available to
later steps; locate the checkout step that currently has persist-credentials:
true and replace it with persist-credentials: false so subsequent steps use the
explicit GitHub App token instead of the persisted runner token.
🪄 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: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 4b5f75c1-2dd4-4ef1-8ce3-1ea69bfd8598
📒 Files selected for processing (1)
.github/workflows/open-prs.yaml
| with: | ||
| client-id: ${{ secrets.OBSINT_PROCESSING_APP_CLIENT_ID }} | ||
| private-key: ${{ secrets.OBSINT_PROCESSING_APP_PRIVATE_KEY }} | ||
| owner: RedHatInsights | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
For actions/create-github-app-token@v3, when owner is set but repositories is omitted, is token access scoped to all repositories in that installation?
💡 Result:
Yes, when the owner input is set but repositories is omitted in actions/create-github-app-token@v3, the token access is scoped to all repositories accessible to that GitHub App installation on the specified owner (user or organization account).
Citations:
- 1: https://github.com/actions/create-github-app-token?tab=readme-ov-file
- 2: https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app
- 3: https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-an-installation-access-token-for-a-github-app
Scope the GitHub App token to the minimum repositories and permissions.
At line 36, setting owner without repositories grants the token access to all repositories in the installation, which is broader than needed for this job.
🔒 Proposed hardening
- id: app_token
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.OBSINT_PROCESSING_APP_CLIENT_ID }}
private-key: ${{ secrets.OBSINT_PROCESSING_APP_PRIVATE_KEY }}
owner: RedHatInsights
+ repositories: |
+ processing-tools
+ # add only repos queried by open_mr_pr/github/list_repos_prs.py
+ permission-contents: write
+ permission-pull-requests: write
+ permission-metadata: read
+ permission-checks: read
+ permission-statuses: read📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| with: | |
| client-id: ${{ secrets.OBSINT_PROCESSING_APP_CLIENT_ID }} | |
| private-key: ${{ secrets.OBSINT_PROCESSING_APP_PRIVATE_KEY }} | |
| owner: RedHatInsights | |
| with: | |
| client-id: ${{ secrets.OBSINT_PROCESSING_APP_CLIENT_ID }} | |
| private-key: ${{ secrets.OBSINT_PROCESSING_APP_PRIVATE_KEY }} | |
| owner: RedHatInsights | |
| repositories: | | |
| processing-tools | |
| # add only repos queried by open_mr_pr/github/list_repos_prs.py | |
| permission-contents: write | |
| permission-pull-requests: write | |
| permission-metadata: read | |
| permission-checks: read | |
| permission-statuses: read |
🧰 Tools
🪛 actionlint (1.7.12)
[error] 34-34: input "client-id" is not defined in action "actions/create-github-app-token@v3". available inputs are "app-id", "github-api-url", "owner", "permission-actions", "permission-administration", "permission-checks", "permission-codespaces", "permission-contents", "permission-custom-properties-for-organizations", "permission-dependabot-secrets", "permission-deployments", "permission-email-addresses", "permission-enterprise-custom-properties-for-organizations", "permission-environments", "permission-followers", "permission-git-ssh-keys", "permission-gpg-keys", "permission-interaction-limits", "permission-issues", "permission-members", "permission-metadata", "permission-organization-administration", "permission-organization-announcement-banners", "permission-organization-copilot-seat-management", "permission-organization-custom-org-roles", "permission-organization-custom-properties", "permission-organization-custom-roles", "permission-organization-events", "permission-organization-hooks", "permission-organization-packages", "permission-organization-personal-access-token-requests", "permission-organization-personal-access-tokens", "permission-organization-plan", "permission-organization-projects", "permission-organization-secrets", "permission-organization-self-hosted-runners", "permission-organization-user-blocking", "permission-packages", "permission-pages", "permission-profile", "permission-pull-requests", "permission-repository-custom-properties", "permission-repository-hooks", "permission-repository-projects", "permission-secret-scanning-alerts", "permission-secrets", "permission-security-events", "permission-single-file", "permission-starring", "permission-statuses", "permission-team-discussions", "permission-vulnerability-alerts", "permission-workflows", "private-key", "repositories", "skip-token-revoke"
(action)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/open-prs.yaml around lines 33 - 37, The workflow step that
configures the GitHub App auth uses owner without scoping repositories (the
fields client-id and private-key), which grants the token access to all
installation repos; update that step to include an explicit repositories list
(e.g., repositories: [ "org/repo-name" ] or the specific repo variables) and
tighten permissions to only what the job needs, leaving client-id, private-key
and owner as-is but adding repositories and minimal permissions to limit scope.
Description
The "Daily Open PRs report" was failing due to security restrictions imposed in the latest weeks.
The job will use obsint-processing-app bot credentials in order to create a PR in the repository, which will be automerged due to the security rules and other workflows acting on each PR
Fixes #CCXDEV-16345
Type of change
Please delete options that are not relevant.
Testing steps
Tested with success running the job manually