Repository navigation
Webhook diagnostics, redelivery budget fix, bounded workers, and auth failure visibility - #918
Open
mikelmonie wants to merge 4 commits into
Open
mikelmonie wants to merge 4 commits into
mikelmonie wants to merge 4 commits into
Conversation
…nd `attempts`, not Closes StellarGateLabs#883
…ry budget again (r Closes StellarGateLabs#884
…unded result sets Closes StellarGateLabs#885
… logged nor counte Closes StellarGateLabs#886
|
@mikelmonie Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Webhook diagnostics, redelivery budget fix, bounded workers, and auth failure visibility
What was solved
#883 — Webhook delivery rows record only
statusandattempts, not the receiver's response, so a failed delivery can't be diagnosedPersist webhook delivery diagnostics (receiver HTTP status, classified error reason, latency, optional truncated body) on
webhook_deliveries, populate them across all three send paths via a shared signed-send helper, expose them in the delivery JSON and OpenAPI, and includedelivery_idin delivery logs.Addressed:
db::migrate(following the existingpragma_table_infopattern) adding nullablelast_response_status INTEGER,last_error TEXT, andlast_duration_ms INTEGERcolumns towebhook_deliveries; optionally a truncated (≤1 KiB) response body column gated by a config flag.timeout,connect,tls,dns,blocked_by_ssrf_guard,http_status) with no raw internal error strings stored inlast_error.dispatch,redrive_one, andredeliver_webhook; extract a sharedsend_signed(...) -> AttemptOutcomehelper to remove duplicated request-building code.#884 — Manual redelivery consumes the automatic retry budget again (regression of #235), and has no audit log, no metrics, and can overwrite a
deliveredrecordFix
payments::redeliver_webhookso manual redelivery no longer consumes the automatic redrive budget (incrementmanual_attempts/last_attemptvia a newdb::record_manual_attemptinstead of bumpingattempts), never downgrades adeliveredrow tofailed(even with?force=true), emits anaudit = true, action = "webhook.redeliver"log line using the currently-ignoredConnectInfo/headers, records delivered/failed outcomes and latency instate.webhook_metrics, and restores the #235 regression test proving N manual redeliveries leaveattemptsunchanged and the redrive worker still picks the row up.Addressed:
manual_attemptsandlast_attempton manual redelivery; leaveattemptsuntouched solist_redrivable_deliveriesstill selects the rowdb::record_manual_attemptrather than reusingupdate_webhook_deliveryfor the manual pathdelivereddelivery tofailed, including when?force=true; preserve the delivered status and surface the failed forced attempt in the response/log#885 — Expiry sweeper and webhook redrive load unbounded result sets and process them serially, so a backlog after downtime stalls them
Bound the expiry sweeper and webhook redrive workers: add real batch-size config (EXPIRY_BATCH_SIZE, WEBHOOK_REDRIVE_BATCH_SIZE), make expire_overdue and list_redrivable_deliveries use LIMIT, loop in bounded batches with shutdown checks, expire a batch in one UPDATE ... RETURNING statement, enqueue expiry webhooks as outbox delivery rows instead of inline dispatch, and claim deliveries (in_flight + lease) before inline attempts to prevent duplicate concurrent sends.
Addressed:
#886 — Failed
X-Admin-Secretattempts are neither logged nor counted, and admin key listing gets the 5× read quota, so brute force goes unnoticedAdd warn-level logging and Prometheus counters for failed admin/metrics authentication, and route all methods under /merchants (including GET) to the strict merchants rate-limit bucket so admin-secret brute force is visible and not given 5× quota.
Addressed:
Changes
README.md(modify)src/expiry.rs(modify)Approach
statusandattempts, not the receiver's response, so a failed delivery can't be diagnosed #883 — Webhook delivery rows record onlystatusandattempts, not the receiver's response, so a failed delivery can't be diagnosed (Changed: README.md)deliveredrecord #884 — Manual redelivery consumes the automatic retry budget again (regression of Manual redelivery consumes the redrive budget and can permanently disable automatic retries #235), and has no audit log, no metrics, and can overwrite adeliveredrecord (Changed: README.md)X-Admin-Secretattempts are neither logged nor counted, and admin key listing gets the 5× read quota, so brute force goes unnoticed #886 — FailedX-Admin-Secretattempts are neither logged nor counted, and admin key listing gets the 5× read quota, so brute force goes unnoticed (Changed: README.md)Issues
Closes #883
Closes #884
Closes #885
Closes #886