Skip to content

Fix security, race and N+1 findings - #17

Merged
imanimanyara merged 2 commits into
mainfrom
fix/security-and-performance-audit
Nov 11, 2026
Merged

imanimanyara merged 2 commits into
mainfrom
fix/security-and-performance-audit

Conversation

@imanimanyara

Copy link
Copy Markdown
Member

Summary

Post-release security, race and N+1 audit. Every fix carries a regression test that fails without it. The fixes are folded into the [0.1.0] CHANGELOG section, because v0.1.0 is re-pointed to this merge on the owner's instruction.

Security

  • A value stored encrypted stays sensitive when its definition is redefined or deleted; reading it needs view_sensitive.
  • The REST API refuses the system actor (401).
  • An API token counts as its user in approvals, so it cannot be used to self-approve or double-count.
  • Idempotency-Key replays are keyed by tenant as well as actor and host.

Races

  • Concurrent requests with the same Idempotency-Key take a lock; the second gets 409 or the replay.
  • JSON layer writes take an exclusive file lock and apply the same version check as the database layer.
  • sync-definitions runs one at a time; a second run reports busy.

Performance

  • A write reads one row instead of its whole scope, twice.
  • sync-definitions syncs in bulk (20 definitions: 62 → 24 queries; re-sync 42 → 4).
  • Exports stream in chunks of 500.
  • Change requests are filtered to the actor's own in the query.

Verification (local)

  • Pest: 696 passed; coverage 97.1 %.
  • PHPStan, Rector, Pint and composer audit: clean.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 16:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@imanimanyara
imanimanyara merged commit 588b6b8 into main Nov 11, 2026
11 checks passed
@imanimanyara
imanimanyara deleted the fix/security-and-performance-audit branch November 11, 2026 17:52
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.

2 participants