refactor(server): move webhook worker and polish handlers#118
Merged
Conversation
Relocate the webhook delivery worker from worker/webhook.rs to service/webhook/worker.rs, alongside the webhook emitter, and dissolve the now-empty worker module. WebhookWorker is re-exported through service, so consumers import it from nvisy_server::service. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Fix a panic / header-injection risk in file download: the user-controlled display name was interpolated into the Content-Disposition header and unwrapped. Sanitize it and fall back to a generic disposition. - Remove an unwrap-with-justification in login by binding the validated account in the match arm. - Add an Error::not_found(resource) constructor and use it to replace the repeated NotFound builder across the find_* helpers and a delete path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
A polishing pass over the server handlers, plus a small file move.
Move
worker/webhook.rs→service/webhook/worker.rs(alongside the webhook emitter); the now-emptyworker/module is dissolved.WebhookWorkeris re-exported throughservice, so consumers import it fromnvisy_server::service.Handler polish (no behavior change except the bug fix)
Content-Dispositionby interpolating the user-controlleddisplay_nameinto the header and.parse().unwrap()-ing it. A filename with control chars/quotes could panic the handler (and was a header-injection vector). Now sanitized with a generic fallback.unwrap()-with-justification in login by binding the validated account in the match arm.Error::not_found(resource)constructor and used it to replace the repeated 3-lineNotFoundbuilder across thefind_*helpers and a delete path.Notes
The handlers were already in consistent shape (module docs, canonical tracing targets/spans,
_docsbuilders, documentedroutes()). The review surfaced one genuine bug and two minor cleanups; everything else already followed the canonical pattern.Verification
Full workspace green:
cargo check,clippy -D warnings,cargo +nightly fmt --check,cargo doc -D warnings,cargo deny check all, tests.🤖 Generated with Claude Code