Skip to content

fix: tenant s3 credentials fixes and refactor #668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 28, 2025

Conversation

itslenny
Copy link
Contributor

@itslenny itslenny commented Apr 10, 2025

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Cache does not invalidate on database update/delete and s3 credential count always returns 0

What is the new behavior?

Cache is invalidated on database update/delete, credential count returns correct value, credentials limited to 50, cleaner architecture, improved test coverage

Changes

  • migration to use correct cache key in pg_notify cache invalidation
  • fix s3 credentials count, was always returning 0 (and allowing creation of > 50 credentials)
  • check for valid uuid on delete credential endpoint (used to throw 500 on insert)
  • refactor s3 credentials into manager pattern similar to jwks
  • add test coverage
  • updated add jwk endpoint to use 201 to match existing s3 credentials
  • some easy eslint fixes that caught my attention

@itslenny itslenny requested a review from fenos April 10, 2025 23:07
@coveralls
Copy link

coveralls commented Apr 10, 2025

Pull Request Test Coverage Report for Build 14712560337

Details

  • 218 of 223 (97.76%) changed or added relevant lines in 15 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.7%) to 78.261%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/http/plugins/jwt.ts 2 3 66.67%
src/http/plugins/signature-v4.ts 1 2 50.0%
src/internal/database/tenant.ts 11 12 91.67%
src/internal/streams/monitor.ts 0 1 0.0%
src/storage/events/webhook.ts 0 1 0.0%
Totals Coverage Status
Change from base Build 14620910983: 0.7%
Covered Lines: 16656
Relevant Lines: 21106

💛 - Coveralls

@itslenny itslenny force-pushed the fix/s3-credential-cache-notify-fix branch from 35e8d8e to c6f2e5e Compare April 11, 2025 13:30
@@ -0,0 +1,126 @@
import crypto from 'node:crypto'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this to storage/protocols/s3/credentials-manager.ts

- migration to use correct cache key in pg_notify cache invalidation
- fix s3 credentials count, was always returning 0 (and allowing creation of > 50 credentials)
- check for valid uuid on delete credential endpoint (used to throw 500 on insert)
- add test coverage
- refactor s3 credentials into manager pattern similar to jwks
@itslenny itslenny force-pushed the fix/s3-credential-cache-notify-fix branch from c6f2e5e to 3f9cc09 Compare April 28, 2025 16:09
@itslenny itslenny merged commit c82505b into master Apr 28, 2025
2 checks passed
@itslenny itslenny deleted the fix/s3-credential-cache-notify-fix branch April 28, 2025 16:20
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