Repository navigation
fix: address security issues #105, #106, and #125 - #188
Open
dripscodes wants to merge 1 commit into
Open
dripscodes wants to merge 1 commit into
dripscodes wants to merge 1 commit into
Conversation
…nan#125 terngunan#125 (P2 – backend): strip unsubscribeToken from /waitlist/join response - Add WaitlistEntryResponseDto that omits unsubscribeToken - Update WaitlistService.join() to return the sanitised DTO - Add controller spec assertion: response must not contain unsubscribeToken terngunan#105 (merchant_registry): reject empty business name in register_merchant - Mirror the same guard already present in update_merchant - Add test: test_register_merchant_empty_name_panics terngunan#106 (merchant_registry): cap unbounded page_size in merchants() - Add MAX_PAGE_SIZE = 100 constant - Compute effective_page_size = page_size.min(MAX_PAGE_SIZE) before use - Add tests: test_merchants_page_size_capped_at_max and test_merchants_page_size_capped_returns_correct_slice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Patches three security issues across the backend waitlist API and the
merchant_registrySoroban contract.closes #125 · P2 · waitlist/join exposes
unsubscribeTokenin HTTP response (backend)Problem:
WaitlistService.join()returned the rawWaitlistEntryTypeORM entity, which included theunsubscribeTokensecret in every HTTP response. Because the endpoint is public (no auth required), any client application logging response bodies could inadvertently capture this GDPR-deletion token.Fix:
WaitlistEntryResponseDto(omitsunsubscribeToken).WaitlistService.join()now destructs the saved entity, drops the token, and returns the sanitised DTO.unsubscribeToken.#105 · merchant_registry:
register_merchantallows empty business name (contract)Problem:
update_merchantalready guards againstname.len() == 0, butregister_merchanthad no equivalent check, so an admin could store a merchant record with an empty name string.Fix:
if name.len() == 0 { panic!("Merchant name cannot be empty") }at the top ofregister_merchant, mirroring the existing guard inupdate_merchant.test_register_merchant_empty_name_panics.#106 · merchant_registry: unbounded
page_sizeinmerchants()risks gas exhaustion (contract)Problem:
merchants()accepted anypage_sizevalue, allowing a caller to trigger an arbitrarily large number of persistent-storage reads in a single transaction, potentially exhausting the Soroban gas budget.Fix:
MAX_PAGE_SIZE = 100constant.merchants()now computeseffective_page_size = page_size.min(MAX_PAGE_SIZE)and uses it throughout the loop.test_merchants_page_size_capped_at_maxandtest_merchants_page_size_capped_returns_correct_slice.Files changed
backend/src/waitlist/dto/waitlist-entry-response.dto.tsbackend/src/waitlist/waitlist.service.tsWaitlistEntryResponseDtofromjoin()backend/src/waitlist/waitlist.controller.spec.tsunsubscribeTokenabsent in join responsesettliq_contracts/contracts/merchant_registry/src/lib.rssettliq_contracts/contracts/merchant_registry/src/test.rsTesting
jest waitlist.controller.spec.ts— existing + new assertion pass.cargo test -p merchant_registry— all existing tests pass; new empty-name and page_size-cap tests pass.Closes #105, #106, #125