-
Notifications
You must be signed in to change notification settings - Fork 6
add renovate #1221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
add renovate #1221
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
| "username": "trap-renovate[bot]", | ||
| "gitAuthor": "trap-renovate <138502363+trap-renovate[bot]@users.noreply.github.com>", | ||
| "repositories": ["traPtitech/NeoShowcase"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| name: Renovate | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| on: | ||
| # For manual dispatch | ||
| workflow_dispatch: | ||
| inputs: | ||
| dryRun: | ||
| description: Dry-Run | ||
| default: "false" | ||
| required: false | ||
| logLevel: | ||
| description: Log-Level | ||
| default: debug | ||
| required: false | ||
| # For auto-merge - should exclude non-renovate branch dispatches in job definitions below | ||
| workflow_run: | ||
| workflows: | ||
| - CI | ||
| types: | ||
| - completed | ||
| schedule: | ||
| # 5 a.m. in JST(+9) | ||
| - cron: "0 20 * * *" | ||
| # For auto-merge and rebasing | ||
| push: | ||
| branches: ["main"] | ||
|
|
||
| env: | ||
| LOG_LEVEL: debug | ||
| RENOVATE_DRY_RUN: false | ||
| RENOVATE_CONFIG_FILE: .github/renovate-bot.json5 | ||
|
|
||
| jobs: | ||
| renovate: | ||
| name: Renovate | ||
| runs-on: ubuntu-latest | ||
| # Exclude dispatch from non-renovate checks | ||
| if: ${{ !(github.event_name == 'workflow_run' && !startsWith(github.event.workflow_run.head_branch, 'renovate/')) }} | ||
| steps: | ||
| - name: Generate a token | ||
| id: generate-token | ||
| uses: actions/create-github-app-token@v3 | ||
| with: | ||
| app-id: ${{ secrets.RENOVATE_APP_ID }} | ||
| private-key: ${{ secrets.RENOVATE_APP_PRIVATE_KEY }} | ||
| - uses: actions/checkout@v6 | ||
| - name: Override default config from dispatch variables | ||
| shell: bash | ||
| env: | ||
| INPUT_DRY_RUN: ${{ github.event.inputs.dryRun }} | ||
| INPUT_LOG_LEVEL: ${{ github.event.inputs.logLevel }} | ||
| run: | | ||
| echo "RENOVATE_DRY_RUN=${INPUT_DRY_RUN:-$RENOVATE_DRY_RUN}" >> "${GITHUB_ENV}" | ||
| echo "LOG_LEVEL=${INPUT_LOG_LEVEL:-$LOG_LEVEL}" >> "${GITHUB_ENV}" | ||
| - name: Renovate | ||
| uses: renovatebot/github-action@v46.1.6 | ||
| with: | ||
| renovate-image: "ghcr.io/renovatebot/renovate" | ||
| renovate-version: "latest" | ||
| configurationFile: "${{ env.RENOVATE_CONFIG_FILE }}" | ||
| token: "${{ steps.generate-token.outputs.token }}" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
GitHub Actions workflow_run secrets security best practices head_repository.full_name same repository check💡 Result:
For GitHub Actions workflows triggered by the workflow_run event, which can access repository secrets even if the triggering workflow could not (e.g., from a fork), a key security best practice is to verify that the triggering workflow originated from the same repository before using secrets or performing sensitive actions. This prevents potential supply chain attacks where a malicious workflow in a forked repository triggers a privileged downstream workflow. Use a job-level or step-level if condition to check if the head repository (where the triggering workflow ran) matches the current repository: if: ${{ github.event.workflow_run.head_repository.full_name == github.repository }} Example workflow snippet: on: workflow_run: workflows: ["build"] # Specific triggering workflow(s) types: [completed] branches: [main] # Restrict to trusted branches [1][2][3] jobs: deploy: if: >- github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_repository.full_name == github.repository runs-on: ubuntu-latest permissions: contents: read # Use minimal permissions [4][5] steps: - uses: actions/checkout@v4 - name: Deploy run: echo "Using secrets safely" env: SECRET: ${{ secrets.MY_SECRET }} Additional best practices for secrets in workflow_run contexts [4][6][7][8][3]: - Set default workflow permissions to read-only contents: permissions: { contents: read } at workflow level. - Filter strictly: specify workflows, branches, and require success conclusion. - Use OIDC for cloud credentials instead of long-lived secrets [4][9]. - Pin actions to full SHA commits. - Audit and rotate secrets regularly [6][7]. - Avoid logging secrets; use::add-mask:: [4]. The github.event.workflow_run object mirrors the workflow_run webhook payload, which includes head_repository (the repo of the commit that triggered the upstream workflow) with full_name property, analogous to pull_request.head.repo.full_name used in PR security checks [10][11][12][13].
Citations:
🏁 Script executed:
Repository: traPtitech/NeoShowcase
Length of output: 100
🏁 Script executed:
Repository: traPtitech/NeoShowcase
Length of output: 2165
🏁 Script executed:
Repository: traPtitech/NeoShowcase
Length of output: 1115
workflow_runの許可条件が不十分で、シークレット利用ジョブへの権限昇格攻撃に対して脆弱です。Line 41 の条件は
head_branchの接頭辞のみで判定しており、トリガー元が同一リポジトリかを検証していません。フォークされたリポジトリからのワークフロー実行でも条件を満たし、RENOVATE_APP_IDおよびRENOVATE_APP_PRIVATE_KEYシークレットが露出する可能性があります。github.event.workflow_run.head_repository.full_name == github.repositoryを条件に追加してください。修正例
🤖 Prompt for AI Agents