Skip to content

Add backend abuse and concurrency guards#20

Merged
sidhujag merged 3 commits intomainfrom
hardening/abuse-concurrency-guards
Apr 25, 2026
Merged

Add backend abuse and concurrency guards#20
sidhujag merged 3 commits intomainfrom
hardening/abuse-concurrency-guards

Conversation

@sidhujag
Copy link
Copy Markdown
Member

Summary

  • Add a per-user rate limiter to POST /gov/receipts/reconcile so stale/forced reconcile sweeps cannot flood gobject_getcurrentvotes.
  • Require explicit If-Match: * on the first vault write, matching the frontend's existing first-save behavior and making the vault CAS contract strict from creation onward.
  • Pre-check vote relay entries against the current masternode collateral outpoint cache and return mn_not_found without calling voteraw for unknown outpoints.

Test plan

  • npm test -- --runInBand lib/vaults.test.js tests/vault.routes.test.js middleware/rateLimit.test.js tests/gov.routes.test.js
  • npm test -- --runInBand
  • npm run audit:prod

Made with Cursor

Rate-limit receipt reconciliation, require explicit first-write vault preconditions, and reject unknown masternode collateral outpoints before calling voteraw.

Made-with: Cursor
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b0a8ca6e43

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread routes/gov.js Outdated
Keep collateral outpoint prechecks active when the masternode cache is populated, but fail open to Core while the cache is empty so tracker lag cannot block valid votes.

Made-with: Cursor
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c9a09f70ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread routes/gov.js
Track masternode snapshot freshness and only hard-reject unknown collateral outpoints when the cache is fresh, falling back to Core during stale tracker windows.

Made-with: Cursor
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sidhujag sidhujag merged commit 006ac1f into main Apr 25, 2026
8 checks passed
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