Skip to content

fix: lock the resource when creating a log or webhook on it - #254

Merged
bfabio merged 1 commit into
fix/time-out-response-writesfrom
fix/lock-resource-on-webhook-and-log-create
Nov 20, 2026
Merged

bfabio merged 1 commit into
fix/time-out-response-writesfrom
fix/lock-resource-on-webhook-and-log-create

Conversation

@bfabio

@bfabio bfabio commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Deleting a software or publisher while a log or webhook is created on it could leave that log or webhook behind, tied to an id that no longer exists. Orphaned logs stayed in the public GET /v1/logs and orphaned webhooks, with their secret, in GET /v1/software/webhooks and GET /v1/publishers/webhooks.

The log and webhook create endpoints under /software/{id} and
/publishers/{id} looked the resource up outside their transaction and
entity_id has no foreign key, so a concurrent DELETE could remove the
resource with its logs and webhooks and let the insert follow. The log
or webhook kept the id of a resource that no longer exists and stayed
listed. Both sides now lock the resource row first, so one of them
waits for the other and sees its outcome.
@bfabio
bfabio added this pull request to stack #272 November 20, 2026 10:49
@bfabio
bfabio merged commit b8e4a18 into main Nov 20, 2026
9 checks passed
@bfabio
bfabio deleted the fix/lock-resource-on-webhook-and-log-create branch November 20, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant