Skip to content

fix: audit fixes — cert upload safety, currency propagation, search rename#32

Merged
tkahng merged 2 commits into
mainfrom
fix/audit-fixes
May 29, 2026
Merged

fix: audit fixes — cert upload safety, currency propagation, search rename#32
tkahng merged 2 commits into
mainfrom
fix/audit-fixes

Conversation

@tkahng

@tkahng tkahng commented May 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • S3 orphan prevention: delete old tax certificate object before storing the replacement
  • File validation: reject uploads that aren't PDF/JPEG/PNG or exceed the configured size limit
  • Auth middleware: uploadTaxCertificateAdmin now uses requireOwnerOrManager guard for buyer-side; admin path validates existence first
  • Search rename: findByVariantSkuExactfindByVariantSkuContaining to accurately reflect the ILIKE pattern match semantics; update SearchService callsite and remove fully-qualified ArrayList references
  • Currency on spending summary: CompanySpendingSummaryResponse gains a currency field populated from the active price list (falls back to USD)
  • Test fixes: update CartResponse, CompanyResponse, and PaymentService constructor calls in existing tests broken by earlier record-field additions

Test plan

  • CompanyServiceIT — cert upload validation (type, size, old-key deletion, role guard)
  • PriceListServiceITgetActiveCurrency returns USD default, active list currency, 404 for unknown company
  • SearchServiceIT — search returns results via findByVariantSkuContaining
  • CompanyControllerTest, CartControllerTest, PaymentServiceTest — compile and pass

tkahng added 2 commits May 28, 2026 13:01
…ename

- Delete old S3 object before replacing tax certificate to avoid orphaned blobs
- Validate file type (PDF/JPEG/PNG) and size before S3 upload
- Use refresh-aware authenticatedFetch in admin cert upload instead of raw fetch
- Expose accessToken via auth context; remove localStorage parsing in cart-api
- Rename findByVariantSkuExact → findByVariantSkuContaining to match ILIKE semantics
- Remove fully-qualified ArrayList references in SearchService
- Add currency field to CompanySpendingSummaryResponse; populate from active price list
- Add requireOwnerOrManager guard to buyer-side cert upload
- Fix test constructor calls broken by earlier record field additions (CartResponse, CompanyResponse, PaymentService)
- Add integration tests for cert validation, currency retrieval, and active price list lookup
…erload

OrderService.createFromCart grew a currency parameter in a previous commit;
all Mockito stubs and verifications were still matching the 8-arg overload,
causing PotentialStubbingProblem failures in CI.
@tkahng tkahng force-pushed the fix/audit-fixes branch from f10ce27 to 1f8416b Compare May 28, 2026 20:01
@tkahng tkahng merged commit f102544 into main May 29, 2026
3 checks passed
@tkahng tkahng deleted the fix/audit-fixes branch May 29, 2026 20:46
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