fix(connect): report token mismatch, not org switching, for org-owned endpoint auth failures - #162
Merged
Conversation
… endpoint auth failures
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.
Source: Discord ask-support thread
Source: Discord ask-support thread — the exact thread this report came from. Kanban card:
t_e7369f61.Problem
On an org-owned endpoint (
coconutsmptcp, orghwstudio), a user lost hours to a misleading error. The plugin printed:That tells the user to fix their organization selection. The control plane returns
CONNECT_AUTH_ENDPOINT_ORG_OWNEDfor any non-matching token when the endpoint name has an organization parent — inmoxy/connect/endpointauth/watchauth.goValidOrAcquire, the org-owned branch is taken on token mismatch (en.ParentID.String != ""), and the stale-name takeover path is reachable only for org-less names. So the actual conditions are:token.json/CONNECT_TOKEN), not inconfig.yml(which only holds the endpoint name),The user did exactly what the message implied — reset/re-generated the token — and stayed broken, because the token never reached the file the plugin reads.
Change
WatchAuthFailureMessagenow states the actual condition for both auth codes: the presented token does not match the token currently stored for this endpoint name, plus the fix steps (put the new token byte-for-byte into the connector token file —token.jsonin the data directory, or theCONNECT_TOKENenvironment variable — notconfig.yml, then restart the connector). The organization ownership is now the secondary clause: only a token created for this endpoint name inside that organization is accepted, and a different token cannot take the name over.No auth semantics changed; this is presentation only.
TDD evidence (RED → GREEN)
RED — test file only, against the unmodified
WatchAuthFailureMessageonmain(486d2b01):GREEN —
./gradlew :core:test :api:test:Tests added/extended: exact wording for both codes, a guard that the org-owned text contains no org-switching instruction, and a contract test that both messages name
token.json,CONNECT_TOKEN, theconfig.ymlsplit, and the connector restart.Release note
User-visible wording change (drives a patch release): the
CONNECT_AUTH_ENDPOINT_ORG_OWNEDmessage now describes the token mismatch and the token-file fix, and theCONNECT_AUTH_TOKEN_ENDPOINT_MISMATCHmessage additionally states that a dashboard reset invalidates the previous token and that the token must be copied byte-for-byte into the connector token file, notconfig.yml.