AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 40 Bitcoin

Add race condition safe InvoiceRepository.UpdateMetadata (#7475)

Public commit record

What the developer wrote

Authored by Nicolas Dorier

58/100 · Thin
Add race condition safe InvoiceRepository.UpdateMetadata (#7475)
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Links an issue, advisory, or supporting reference! No meaningful explanatory body
The short version

What changed, and why it matters

This commit changes how BTCPay Server stores invoice comments and metadata. Previously, comments were saved in a separate field and could be updated with a method that was not safe when multiple requests happened at the same time. The patch moves comments into the invoice metadata and uses database-level JSON operations to update only the requested field, reducing the chance that simultaneous updates overwrite each other. It also removes the dedicated 'comment' field from the public API, so comments can only be updated through the UI or via metadata. The commit title explicitly calls this a race-condition safety fix.

Recommended action

Treat this as a security-hardening patch and include it in the next release. Review any plugins or integrations that relied on the top-level InvoiceData.Comment or UpdateInvoiceRequest.Comment API fields, because those have been removed. Consider whether the new UpdateInvoiceMetadataCore should also update text-search indexes for orderId changes, since the old code updated InvoiceSearches when orderId changed and the new SQL path does not appear to do so.

Security signals we found

01

Commit title explicitly describes a race condition fix

02

Replaced read-modify-write metadata update with atomic PostgreSQL jsonb_set operation

03

Removed dedicated API 'comment' field, narrowing update surface

04

Added ArgumentNullException guards on new repository methods

05

Marked old full-replacement metadata method as Obsolete due to race condition risk

Risk score

Why this scored 40/100

Our methodology →
Potential impact 8/30
Exploitability 7/25
Stealth signal 6/15
Affected reach 8/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.