Skip to content

Conversation

@itslenny
Copy link
Contributor

What kind of change does this PR introduce?

Feature

What is the current behavior?

Rows can be accidentally deleted from the storage schema tables which can cause problems. Most commonly users remove rows from the storage.objects table resulting in orphan objects that cannot be removed.

What is the new behavior?

Use statement level trigger to reject any DELETE operation that does not include storage.can_delete=true in the current settings. This allows the storage API to still remove rows while preventing deletes via direct SQL queries.

This can still be bypassed by directly setting the can_delete config, but this should prevent accidental deletes and eliminate the most common cause of orphan objects

@coveralls
Copy link

coveralls commented Dec 23, 2025

Pull Request Test Coverage Report for Build 20951436421

Details

  • 19 of 22 (86.36%) changed or added relevant lines in 3 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.006%) to 76.052%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/test/utils/storage.ts 16 19 84.21%
Files with Coverage Reduction New Missed Lines %
src/internal/database/tenant.ts 2 83.65%
Totals Coverage Status
Change from base Build 20830462876: -0.006%
Covered Lines: 25499
Relevant Lines: 33246

💛 - Coveralls

@itslenny itslenny force-pushed the feat/prevent-direct-sql-deletes-in-storage-schema branch from 2659960 to 7cc6dd4 Compare January 13, 2026 09:23
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.

3 participants