Repository navigation
feat(auth): add auth login --device-name to override the hostname - #1887
Conversation
`mergify auth login` sends the machine's hostname as `device_name` so the approval page can default the token name to this machine. Hostnames often carry a person's name, and `POST /v1/oauth/device/code` is unauthenticated: the value sits on the pending grant server-side before anyone approves, so editing the field on the page does not un-send it. It is also a poor label for someone with several machines on one account. `--device-name NAME` replaces the detected hostname and is sent as typed; the server caps and sanitizes it. A blank value (`--device-name=`, which also survives Windows PowerShell 5.1 dropping a `""` argument) sends no name at all, the same request a machine that cannot name itself already makes, and the server keeps its own default label. Without the flag nothing changes. Fixes MRGFY-9268 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Change-Id: If4f977008ded4d2acd0cb1ce5492c60c3f4df4e3
Merge Protections🟢 All 6 merge protections satisfied — ready to merge. Show 6 satisfied protections🟢 🤖 Continuous Integration
🟢 👀 Review Requirements
🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 Reviews
🟢 📕 PR description
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused change preserves default behavior, covers override and opt-out cases, and has no identified blocking issues.
Review effort: Balanced
Findings: None
What changed in this PR
Adds auth login --device-name so users can replace the hostname sent during device authorization or omit it for privacy.
Changes:
- Wires the option through CLI dispatch and login, preserving hostname detection when omitted.
- Adds override and blank-value tests, updates help snapshots, and documents usage.
| File | Description |
|---|---|
| README.md | Documents custom names and hostname opt-out. |
| crates/mergify-cli/src/snapshots/mergify__tests__cli_schema_golden.snap | Records the new option’s CLI schema. |
| crates/mergify-cli/src/main.rs | Parses, dispatches, and tests the option. |
| crates/mergify-auth/src/login.rs | Applies the override or omission and tests request bodies. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Merge Queue Status
This pull request spent 8 minutes 25 seconds in the queue, including 8 minutes 6 seconds running CI. Required conditions to merge
|
mergify auth loginsends the machine's hostname asdevice_nameso theapproval page can default the token name to this machine. Hostnames often
carry a person's name, and
POST /v1/oauth/device/codeis unauthenticated:the value sits on the pending grant server-side before anyone approves, so
editing the field on the page does not un-send it. It is also a poor label
for someone with several machines on one account.
--device-name NAMEreplaces the detected hostname and is sent as typed;the server caps and sanitizes it. A blank value (
--device-name=, whichalso survives Windows PowerShell 5.1 dropping a
""argument) sends noname at all, the same request a machine that cannot name itself already
makes, and the server keeps its own default label. Without the flag
nothing changes.
Fixes MRGFY-9268
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com