Repository navigation
Conversation
/assign resolved a ticket from the display id the invoker typed and reassigned it without checking who was asking or whether the ticket was reachable from the invoking guild. Display ids are public — they are pasted into community threads — so the id alone is not evidence of belonging. Only team members may reassign now, via the isTeamMember helper that already existed for exactly this check. A ticket named by id must also be a Discord ticket whose thread lives in this guild; anything else gets the same reply as a bad id, so the answer never reveals that the ticket exists elsewhere. Co-Authored-By: Claude Code <noreply@anthropic.com>
…sign isTeamMember now only counts TeamMember rows with status ACTIVE — a DISABLED or INVITED member keeps their Discord link and email but must not be able to reassign tickets. The ticket-reachability check also stops swallowing every channels.fetch failure: only Discord's 'unknown channel'/'unknown guild' codes mean the ticket is unreachable, so a rate limit or API outage now surfaces as an error instead of a false 'no ticket found'. Co-Authored-By: Claude Code <noreply@anthropic.com>
This branch has not been deployed
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.
Closes #275.
/assignresolved a ticket from the display id the invoker typed and reassigned it, with no check on who was asking or whether the ticket belonged to the invoking context. Display ids are public by design — they are pasted into community threads — and the web routes and the email reply path both check the session or the sender before touching a ticket; this command did not.Two gates, using the shape the codebase already has:
isTeamMember()inapps/discord-bot/src/lib/tickets.ts— a helper that existed for exactly this check and had no callers until now. It counts onlyTeamMemberrows withstatus === 'ACTIVE': a DISABLED member keeps their Discord link and email, and an INVITED one has not accepted yet, so neither may act.ticketid must resolve to a Discord ticket whose thread lives in the invoking guild (client.channels.fetch(sourceId)→guildId). Tickets from other sources, threads in another guild, deleted threads and null fetch results all get the same "No ticket found" reply as a bad id, so the answer never reveals that the ticket exists elsewhere. Only Discord's unknown-channel/unknown-guild codes (10003/10004) map to "unreachable" — a rate limit or API outage surfaces as an error rather than a false "no ticket found".The thread-context path (no
ticketoption) is unchanged apart from the team-member gate —findTicketByThreadIdalready scopes it to the current thread./close,/escalateand/priorityhave the same missing invoker check but are scoped to the current thread's ticket; this PR stays on the issue's/assignscope. Worth a follow-up if the team wants the same gate everywhere.Tests:
apps/discord-botsuite — 76/76 passed. New tests cover the non-team-member rejection, non-Discord and cross-guild tickets, a deleted thread, a null fetch result, a transient API failure rethrowing, and DISABLED/INVITED membership rejection; they fail on the previous implementation.tscbuild, ESLint (0 errors), Prettier,git diff --checkpassed🤖 Generated with Claude Code