-
Notifications
You must be signed in to change notification settings - Fork 0
fix(ai-engineer): distinguish REST 5xx from invalid gh credentials #2438
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 |
|---|---|---|
|
|
@@ -57,14 +57,29 @@ card. | |
| If only the host-level saved-login check succeeds, run every subsequent `gh` command through that | ||
| approved host-level execution path. | ||
| Clearing the injected tokens does not make a sandboxed macOS Keychain readable. | ||
| Only an explicit credential rejection from that host-level check proves the saved login invalid. | ||
| If the host-level check instead authenticates a different account, hard-block as `wrong GitHub identity` | ||
| without describing the credential as invalid. | ||
| If the host-level check cannot run or fails | ||
| for a transport reason, hard-block as `authentication verification unavailable` instead of instructing | ||
| the maintainer to replace a credential that was never tested. Keep the injected-token result, saved-login | ||
| result, and `git fetch` result as separate gates, because repository reachability cannot prove GitHub API | ||
| identity (and vice versa); record only these gate classifications in durable memory, never credential output. | ||
| **Distinguish authentication rejection from GitHub service degradation** (monorepo#2206): a REST | ||
| `/user` (or `gh auth status`) probe that returns HTTP 5xx, HTML, other non-JSON service noise, **or | ||
| a rate-limited 403/429** (GitHub may return either status when the limit is exceeded — check | ||
| `x-ratelimit-*` headers or a rate-limit message body) is **not** proof the credential is bad — | ||
| classify that outcome as `GitHub service degraded` and run a bounded authenticated GraphQL | ||
| fallback against the **same host and credential context** as the failing probe: | ||
| `gh api graphql --hostname github.com -f query='{viewer{login}}'`. Prefix with | ||
| `env -u GH_TOKEN -u GITHUB_TOKEN` **only when the failing probe itself was the cleared-env | ||
| saved-login check**; otherwise keep the injected `GH_TOKEN`/`GITHUB_TOKEN` so a transient REST | ||
| failure cannot be misread as a bad keychain login. Always pass `--hostname github.com` so | ||
| `GH_HOST` cannot redirect the fallback to an unrelated enterprise host. Accept the identity when | ||
| GraphQL returns `devantler`. | ||
| Only an explicit credential rejection proves the login invalid — meaning HTTP **401**, a **non-rate-limit** | ||
| 403 that is clearly a credential/permission rejection (never a rate-limit 403), or `gh` reporting | ||
| the token rejected / not logged in — and **only then** recommend `gh auth login`. A REST 5xx (or | ||
| rate-limit) with a successful GraphQL `viewer.login` must never be reported as an invalid saved | ||
|
Comment on lines
+60
to
+75
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. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Apply authentication-status precedence before service-noise handling. Line [61] classifies any HTML or non-JSON response as 🧰 Tools🪛 SkillSpector (2.4.4)[error] 40: [PE3] Credential Access: Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts. Remediation: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths. (Privilege Escalation (PE3)) [error] 49: [PE3] Credential Access: Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts. Remediation: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths. (Privilege Escalation (PE3)) [error] 59: [PE3] Credential Access: Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts. Remediation: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths. (Privilege Escalation (PE3)) [error] 69: [PE3] Credential Access: Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts. Remediation: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths. (Privilege Escalation (PE3)) 🤖 Prompt for AI Agents |
||
| login. If the host-level check instead authenticates a different account, hard-block as | ||
| `wrong GitHub identity` without describing the credential as invalid. | ||
| If the host-level check cannot run or fails for a transport reason (and the GraphQL fallback is | ||
| likewise unreachable), hard-block as `authentication verification unavailable` instead of | ||
| instructing the maintainer to replace a credential that was never tested. Keep the injected-token | ||
|
Comment on lines
+70
to
+80
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. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Make the GraphQL identity contract deployment-aware and test it. The skill defines deployment-specific identities but hardcodes
🧰 Tools🪛 SkillSpector (2.4.4)[error] 40: [PE3] Credential Access: Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts. Remediation: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths. (Privilege Escalation (PE3)) [error] 49: [PE3] Credential Access: Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts. Remediation: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths. (Privilege Escalation (PE3)) [error] 59: [PE3] Credential Access: Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts. Remediation: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths. (Privilege Escalation (PE3)) [error] 69: [PE3] Credential Access: Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts. Remediation: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths. (Privilege Escalation (PE3)) 📍 Affects 2 files
🤖 Prompt for AI Agents |
||
| result, saved-login result, and `git fetch` result as separate gates, because repository | ||
| reachability cannot prove GitHub API identity (and vice versa); record only these gate classifications in durable memory, never credential output. | ||
| 3. **Check the boot memory surface fits in one read — BEFORE you read it.** A boot-loaded file past the Read cap is | ||
| **truncated silently**: the run continues on a partial cursor with no signal that carry-forwards, | ||
| stand-down notes, or `HANDS-OFF` records beyond the cut are missing (the 2026-06-05 blinding; | ||
|
|
||
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.
🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
Add a contract assertion for the deployment-scoped fallback identity.
The test checks the GraphQL command and credential context, but it does not check which
viewer.loginvalue is accepted. It can pass while the skill rejects the documented cloud identityapp/cursor. Assert the deployment-scoped identity rule and thewrong GitHub identityclassification.🧰 Tools
🪛 Shellcheck (0.11.0)
[info] 65-65: Note that A && B || C is not if-then-else. C may run when A is true.
(SC2015)
🤖 Prompt for AI Agents