-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Actions: improve improper access control query #20904
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| category: minorAnalysis | ||
| --- | ||
| * The `actions/improper-access-control` query has been improved to correctly detect cases where either the check | ||
| triggers or the checkout reference are unsafe, rather than only when both applied as was done previously. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,5 +16,5 @@ jobs: | |
| uses: actions/checkout@v3 | ||
| if: contains(github.event.pull_request.labels.*.name, 'safe to test') | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| ref: ${{ github.event.pull_request.head.ref }} # BAD (mutable ref) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically head.ref without a repo name isn’t exploitable (as it will just check out the branch from the base repo a fail if not present).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess it still could be a privesc in very narrow scenarios where the repo enforces strict feature/main branch boundaries and a higher privilege group needs to approve the run (even though both have write access to the repo). |
||
| - run: ./cmd | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Pull request feedback | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [ labeled ] | ||
|
|
||
| permissions: {} | ||
| jobs: | ||
| test: | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repo for OWNER TEST | ||
| uses: actions/checkout@v3 | ||
| if: contains(github.event.pull_request.labels.*.name, 'safe to test') | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} # GOOD (labeled event + immutable ref) | ||
| - run: ./cmd |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| | .github/workflows/test1.yml:15:7:20:4 | Uses Step | The checked-out code can be modified after the authorization check $@. | .github/workflows/test1.yml:17:11:17:75 | contain ... test') | contain ... test') | | ||
| | .github/workflows/bad_checkout.yml:15:7:20:4 | Uses Step | The checked-out code can be modified after the authorization check $@. | .github/workflows/bad_checkout.yml:17:11:17:75 | contain ... test') | contain ... test') | | ||
| | .github/workflows/bad_triggers.yml:15:7:20:4 | Uses Step | The checked-out code can be modified after the authorization check $@. | .github/workflows/bad_triggers.yml:17:11:17:75 | contain ... test') | contain ... test') | |
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.
Grammar issue: "when both applied" should be "when both apply" or "when both were applied".