Skip to content

fix(core): never send a Mergify user token to GitHub - #1808

Draft
sileht wants to merge 1 commit into
devs/sileht/mrgfy-8703-cli-auth-commands/use-stored-credential-deprecate-github-token--ca890065from
devs/sileht/mrgfy-8703-cli-auth-commands/never-send-mergify-user-token-github--f3c422ba
Draft

fix(core): never send a Mergify user token to GitHub#1808
sileht wants to merge 1 commit into
devs/sileht/mrgfy-8703-cli-auth-commands/use-stored-credential-deprecate-github-token--ca890065from
devs/sileht/mrgfy-8703-cli-auth-commands/never-send-mergify-user-token-github--f3c422ba

Conversation

@sileht

@sileht sileht commented Sep 4, 2026

Copy link
Copy Markdown
Member

MERGIFY_TOKEN is the natural place to put the credential
mergify auth login mints, and stack reads that same variable for its
GitHub calls. A user who exports one would get 401 Bad credentials from
api.github.com, which says nothing about why.

Skip it there. The cost is nothing: mut_ is Mergify's prefix,
registered with GitHub's own secret scanning, so a value carrying it was
never going to authenticate against GitHub. stack falls through to
GITHUB_TOKEN or gh auth token as it would have if the variable were
unset.

The failure says so. Telling someone to set MERGIFY_TOKEN when they
have set it, and it was skipped for a reason visible only at -vv, is
the worst version of this message.

An explicit --token is not second-guessed. The user aimed it at this
command, and quietly using a different credential instead would be the
more surprising failure of the two.

This is a failure mode the rest of this stack creates -- there was no
reason to hold a mut_ token before it -- which is why it lands here
rather than as a separate ticket.

Fixes MRGFY-8703

Depends-On: #1807

@sileht

sileht commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 refactor(core): split Mergify and GitHub token resolution #1802
2 feat(core): store the Mergify credential in the OS keychain #1803
3 feat(core): let a caller read an endpoint's rejection body #1804
4 feat(auth): the device authorization grant, client side #1805
5 feat(cli): mergify auth login, logout and status #1806
6 feat(core): use the stored credential, deprecate GITHUB_TOKEN #1807
7 fix(core): never send a Mergify user token to GitHub #1808 👈

@mergify

mergify Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 4 of 7 protections blocking · waiting on 👀 reviews, 🤖 CI and ⛓️ dependency

Protection Waiting on
🔴 ⛓️ Depends-On Requirements ⛓️ dependency
🔴 🤖 Continuous Integration 🤖 CI
🔴 👀 Review Requirements 👀 reviews
🔴 🔎 Reviews 👀 reviews
🟢 Enforce conventional commit
🟢 📕 PR description
🟢 🚦 Auto-queue

🔴 ⛓️ Depends-On Requirements

Waiting for

This rule is failing.

Requirement based on the presence of Depends-On in the body of the pull request

🔴 🤖 Continuous Integration

Waiting for

  • check-success=ci-gate
This rule is failing.
  • all of:
    • check-success=ci-gate

🔴 👀 Review Requirements

Waiting for

  • #approved-reviews-by>=2
This rule is failing.
  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🔴 🔎 Reviews

Waiting for

  • #review-requested = 0
This rule is failing.
  • #review-requested = 0
  • #changes-requested-reviews-by = 0
  • #review-threads-unresolved = 0

Show 3 satisfied protections

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|internal|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?!?:

🟢 📕 PR description

  • body ~= (?ms:.{48,})

🟢 🚦 Auto-queue

When all merge protections are satisfied, this pull request will be queued automatically.

@mergify
mergify Bot requested a review from a team September 4, 2026 23:26
`MERGIFY_TOKEN` is the natural place to put the credential
`mergify auth login` mints, and `stack` reads that same variable for its
GitHub calls. A user who exports one would get `401 Bad credentials` from
api.github.com, which says nothing about why.

Skip it there. The cost is nothing: `mut_` is Mergify's prefix,
registered with GitHub's own secret scanning, so a value carrying it was
never going to authenticate against GitHub. `stack` falls through to
`GITHUB_TOKEN` or `gh auth token` as it would have if the variable were
unset.

The failure says so. Telling someone to set `MERGIFY_TOKEN` when they
have set it, and it was skipped for a reason visible only at `-vv`, is
the worst version of this message.

An explicit `--token` is not second-guessed. The user aimed it at this
command, and quietly using a different credential instead would be the
more surprising failure of the two.

This is a failure mode the rest of this stack creates -- there was no
reason to hold a `mut_` token before it -- which is why it lands here
rather than as a separate ticket.

Fixes MRGFY-8703

Change-Id: If3c422baf7dde5e912971015b991046ccbc886eb
@sileht
sileht force-pushed the devs/sileht/mrgfy-8703-cli-auth-commands/never-send-mergify-user-token-github--f3c422ba branch from 56c3bb4 to e5c6417 Compare September 4, 2026 23:40
@sileht
sileht force-pushed the devs/sileht/mrgfy-8703-cli-auth-commands/use-stored-credential-deprecate-github-token--ca890065 branch from b78ede8 to 320f6ae Compare September 4, 2026 23:40
@sileht

sileht commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

Revision history

# Type Changes Reason Date
1 initial 56c3bb4 2026-09-04 23:40 UTC
2 rebase 56c3bb4 → e5c6417 (rebase only) 2026-09-04 23:40 UTC

@mergify
mergify Bot had a problem deploying to Mergify Merge Protections September 4, 2026 23:41 Failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant