fix: handle 401 responses for domain operations (SWG-20526) - #668
Draft
ewaostrowska wants to merge 1 commit into
Draft
fix: handle 401 responses for domain operations (SWG-20526)#668ewaostrowska wants to merge 1 commit into
ewaostrowska wants to merge 1 commit into
Conversation
…anges (SWG-20526) Registry PR #2958 (SWG-20526) updated domain operations (saveDomainDefinition, deleteDomain, deleteDomainVersion) to return 401 for invalid tokens instead of the previous undocumented behavior, and to return 400/415 instead of 500 for malformed/unsupported requests. - Add 401 to filterResponseMessaging as defense-in-depth: if 401 ever reaches this function via resolveStatus it is rejected rather than silently passed to onResolve - Add 401 tests for domain:create, domain:delete, and domain:update - Add 415 tests for domain:create and domain:update (saveDomainDefinition now returns 415 for unsupported content types instead of 500) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016stuqDZQnQDtZD5XTqj635
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.
Summary
Follows registry PR #2958 (SWG-20526), which made these spec-correctness fixes to domain operations:
saveDomainDefinitionnow returns 400 (blank body) and 415 (unsupported content type) instead of 500deleteDomain,deleteDomainVersion,renameDomain,forkDomain,cloneDomainnow return 401 for invalid tokens instead of the undocumented 403Changes
src/support/command/handle-response.jsfilterResponseMessagingpreviously only rejected 403 responses. Added 401 to the condition as defense-in-depth: if a 401 response ever reaches this function (e.g. via a futureresolveStatus: [401]), it is rejected and surfaced as an error rather than silently passed toonResolve. In the current call sites 401 is already caught earlier bycheckForErrors, so this is a safeguard for future code.Tests
Added tests that verify the CLI correctly surfaces errors for the new response codes from the registry:
test/commands/domain/create.test.jstest/commands/domain/delete.test.jstest/commands/domain/update.test.jsAll 435 existing tests continue to pass.
Generated by Claude Code