[Security] Fix GraphQL query to get a collaborator's permission#301
Merged
peter-evans merged 1 commit intopeter-evans:mainfrom Dec 10, 2023
Merged
[Security] Fix GraphQL query to get a collaborator's permission#301peter-evans merged 1 commit intopeter-evans:mainfrom
peter-evans merged 1 commit intopeter-evans:mainfrom
Conversation
Owner
|
Hi @0xn3va Thank you for raising this PR! Apologies for missing your attempts to contact me about this. I vaguely recall seeing something, but I get a lot of random email and messages and sometimes it's not easy to figure out what is genuine and what is spam. Thank you for your effort to get this fixed, I do appreciate it. I've released the fix as |
renovate bot
referenced
this pull request
in Hapag-Lloyd/dist-comm-vis
Dec 10, 2023
….2 (#164) [](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [peter-evans/slash-command-dispatch](https://togithub.com/peter-evans/slash-command-dispatch) | action | patch | `v3.0.1` -> `v3.0.2` | --- ### Release Notes <details> <summary>peter-evans/slash-command-dispatch (peter-evans/slash-command-dispatch)</summary> ### [`v3.0.2`](https://togithub.com/peter-evans/slash-command-dispatch/releases/tag/v3.0.2): Slash Command Dispatch v3.0.2 [Compare Source](https://togithub.com/peter-evans/slash-command-dispatch/compare/v3.0.1...v3.0.2) #### What's Changed - fix: replace use of any type by [@​peter-evans](https://togithub.com/peter-evans) in [https://github.com/peter-evans/slash-command-dispatch/pull/152](https://togithub.com/peter-evans/slash-command-dispatch/pull/152) - fixing link to `Get a pull request` by [@​Borda](https://togithub.com/Borda) in [https://github.com/peter-evans/slash-command-dispatch/pull/270](https://togithub.com/peter-evans/slash-command-dispatch/pull/270) - Update getting-started.md due to changes in Github UI by [@​martin-displayr](https://togithub.com/martin-displayr) in [https://github.com/peter-evans/slash-command-dispatch/pull/289](https://togithub.com/peter-evans/slash-command-dispatch/pull/289) - \[Security] Fix GraphQL query to get a collaborator's permission by [@​0xn3va](https://togithub.com/0xn3va) in [https://github.com/peter-evans/slash-command-dispatch/pull/301](https://togithub.com/peter-evans/slash-command-dispatch/pull/301) - 129 dependency updates by [@​dependabot](https://togithub.com/dependabot) #### New Contributors - [@​Borda](https://togithub.com/Borda) made their first contribution in [https://github.com/peter-evans/slash-command-dispatch/pull/270](https://togithub.com/peter-evans/slash-command-dispatch/pull/270) - [@​martin-displayr](https://togithub.com/martin-displayr) made their first contribution in [https://github.com/peter-evans/slash-command-dispatch/pull/289](https://togithub.com/peter-evans/slash-command-dispatch/pull/289) - [@​0xn3va](https://togithub.com/0xn3va) made their first contribution in [https://github.com/peter-evans/slash-command-dispatch/pull/301](https://togithub.com/peter-evans/slash-command-dispatch/pull/301) **Full Changelog**: peter-evans/slash-command-dispatch@v3.0.1...v3.0.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Hapag-Lloyd/dist-comm-vis). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuODcuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot
referenced
this pull request
in Hapag-Lloyd/.github
Dec 10, 2023
….2 (#9) [](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [peter-evans/slash-command-dispatch](https://togithub.com/peter-evans/slash-command-dispatch) | action | patch | `v3.0.1` -> `v3.0.2` | --- ### Release Notes <details> <summary>peter-evans/slash-command-dispatch (peter-evans/slash-command-dispatch)</summary> ### [`v3.0.2`](https://togithub.com/peter-evans/slash-command-dispatch/releases/tag/v3.0.2): Slash Command Dispatch v3.0.2 [Compare Source](https://togithub.com/peter-evans/slash-command-dispatch/compare/v3.0.1...v3.0.2) #### What's Changed - fix: replace use of any type by [@​peter-evans](https://togithub.com/peter-evans) in [https://github.com/peter-evans/slash-command-dispatch/pull/152](https://togithub.com/peter-evans/slash-command-dispatch/pull/152) - fixing link to `Get a pull request` by [@​Borda](https://togithub.com/Borda) in [https://github.com/peter-evans/slash-command-dispatch/pull/270](https://togithub.com/peter-evans/slash-command-dispatch/pull/270) - Update getting-started.md due to changes in Github UI by [@​martin-displayr](https://togithub.com/martin-displayr) in [https://github.com/peter-evans/slash-command-dispatch/pull/289](https://togithub.com/peter-evans/slash-command-dispatch/pull/289) - \[Security] Fix GraphQL query to get a collaborator's permission by [@​0xn3va](https://togithub.com/0xn3va) in [https://github.com/peter-evans/slash-command-dispatch/pull/301](https://togithub.com/peter-evans/slash-command-dispatch/pull/301) - 129 dependency updates by [@​dependabot](https://togithub.com/dependabot) #### New Contributors - [@​Borda](https://togithub.com/Borda) made their first contribution in [https://github.com/peter-evans/slash-command-dispatch/pull/270](https://togithub.com/peter-evans/slash-command-dispatch/pull/270) - [@​martin-displayr](https://togithub.com/martin-displayr) made their first contribution in [https://github.com/peter-evans/slash-command-dispatch/pull/289](https://togithub.com/peter-evans/slash-command-dispatch/pull/289) - [@​0xn3va](https://togithub.com/0xn3va) made their first contribution in [https://github.com/peter-evans/slash-command-dispatch/pull/301](https://togithub.com/peter-evans/slash-command-dispatch/pull/301) **Full Changelog**: peter-evans/slash-command-dispatch@v3.0.1...v3.0.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Hapag-Lloyd/.github). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuODcuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot
referenced
this pull request
in Hapag-Lloyd/Renovate-Global-Configuration
Dec 10, 2023
….2 (#59) [](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [peter-evans/slash-command-dispatch](https://togithub.com/peter-evans/slash-command-dispatch) | action | patch | `v3.0.1` -> `v3.0.2` | --- ### Release Notes <details> <summary>peter-evans/slash-command-dispatch (peter-evans/slash-command-dispatch)</summary> ### [`v3.0.2`](https://togithub.com/peter-evans/slash-command-dispatch/releases/tag/v3.0.2): Slash Command Dispatch v3.0.2 [Compare Source](https://togithub.com/peter-evans/slash-command-dispatch/compare/v3.0.1...v3.0.2) #### What's Changed - fix: replace use of any type by [@​peter-evans](https://togithub.com/peter-evans) in [https://github.com/peter-evans/slash-command-dispatch/pull/152](https://togithub.com/peter-evans/slash-command-dispatch/pull/152) - fixing link to `Get a pull request` by [@​Borda](https://togithub.com/Borda) in [https://github.com/peter-evans/slash-command-dispatch/pull/270](https://togithub.com/peter-evans/slash-command-dispatch/pull/270) - Update getting-started.md due to changes in Github UI by [@​martin-displayr](https://togithub.com/martin-displayr) in [https://github.com/peter-evans/slash-command-dispatch/pull/289](https://togithub.com/peter-evans/slash-command-dispatch/pull/289) - \[Security] Fix GraphQL query to get a collaborator's permission by [@​0xn3va](https://togithub.com/0xn3va) in [https://github.com/peter-evans/slash-command-dispatch/pull/301](https://togithub.com/peter-evans/slash-command-dispatch/pull/301) - 129 dependency updates by [@​dependabot](https://togithub.com/dependabot) #### New Contributors - [@​Borda](https://togithub.com/Borda) made their first contribution in [https://github.com/peter-evans/slash-command-dispatch/pull/270](https://togithub.com/peter-evans/slash-command-dispatch/pull/270) - [@​martin-displayr](https://togithub.com/martin-displayr) made their first contribution in [https://github.com/peter-evans/slash-command-dispatch/pull/289](https://togithub.com/peter-evans/slash-command-dispatch/pull/289) - [@​0xn3va](https://togithub.com/0xn3va) made their first contribution in [https://github.com/peter-evans/slash-command-dispatch/pull/301](https://togithub.com/peter-evans/slash-command-dispatch/pull/301) **Full Changelog**: peter-evans/slash-command-dispatch@v3.0.1...v3.0.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Hapag-Lloyd/Renovate-Global-Configuration). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuODcuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
|
Just as a heads-up for anyone running into this error:
Earlier versions do not expose the |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The action uses the following GraphQL query to get the permissions of a user who triggered the action:
The problem is that the
$collaboratorvariable is passed to thequeryparameter which implements the fuzzy search. In other words, you can use an outside user with a username close to a maintainer username to bypass the permissions validation.For example, the query above will return the
ADMINpermission with the following variables:owner:peter-evansname:slash-command-dispatchcollaborator:eter-evans(note there is no the first letterp)So, it means that an attacker can find users with required permissions in a target repository, create a user with a close name (like
eter-evans), and bypass the permissions validation using that user.To avoid this behaviour, the
loginparameter must be used instead ofquery.