Skip to content

Comments

fix: use numeric status code for 403 detection in Conway client#206

Open
haosenwang1018 wants to merge 1 commit intoConway-Research:mainfrom
haosenwang1018:fix/conway-403-detection
Open

fix: use numeric status code for 403 detection in Conway client#206
haosenwang1018 wants to merge 1 commit intoConway-Research:mainfrom
haosenwang1018:fix/conway-403-detection

Conversation

@haosenwang1018
Copy link
Contributor

Summary

  • exec(), writeFile(), and readFile() in src/conway/client.ts detect 403 auth failures by matching err?.message?.includes("403") against the error message string
  • This is fragile: any error whose message coincidentally contains "403" (e.g., port 4030 in a URL, or a response body mentioning HTTP 403) would be misclassified as an authentication failure, throwing a misleading auth error instead of the real error
  • Since request() already sets err.status to the numeric HTTP status code (line 69), the fix uses err?.status === 403 for reliable detection

Test plan

  • npx tsc --noEmit passes
  • Verify 403 responses still trigger the auth-failure error path
  • Verify non-403 errors with "403" in message text are not misclassified

🤖 Generated with Claude Code

The 403 auth-failure guards in exec(), writeFile(), and readFile()
matched err?.message?.includes("403") against the error message
string. This is fragile: any error whose message coincidentally
contains "403" (e.g., port 4030, or a response body mentioning 403)
would be misclassified as an authentication failure.

Since request() already sets err.status to the numeric HTTP status
code (line 69), use err?.status === 403 for reliable detection.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant