test: Add grants explorer test suite and auth security fix#500
Draft
minimalsm wants to merge 3 commits intofeature/private-grants-explorerfrom
Draft
test: Add grants explorer test suite and auth security fix#500minimalsm wants to merge 3 commits intofeature/private-grants-explorerfrom
minimalsm wants to merge 3 commits intofeature/private-grants-explorerfrom
Conversation
- Add fiscalYear utility tests (22 tests) - deriveFiscalQuarter for all quarters - getFiscalYearStart with date mocking - extractFiscalYear string parsing - Add grants mapping tests (17 tests) - mapSFRecordToGrant field mapping - mapSFRecordToPrivateGrant with private fields - Null/undefined field handling - Type compliance verification - Export mapping functions for testability
BREAKING: Requires INTERNAL_AUTH_SECRET environment variable Security improvements: - Replace base64 cookies with HMAC-SHA256 signed tokens - Forged cookies are now rejected (signature verification) - Add isAuthorizedEmail() for strict @ethereum.org validation - Double-check email domain in getServerSideProps Tests (TDD): - 19 auth security tests covering: - Token signing and verification - Forged token rejection - Tampered token detection - Email domain validation - Timing-safe signature comparison New environment variable required: - INTERNAL_AUTH_SECRET (min 32 chars)
Add tests specific to public grants explorer (#497): - Verify GrantRecord type doesn't expose private fields - Test PUBLIC_RECORD_TYPES whitelist configuration - Ensure sensitive record types excluded from public view - Verify EXCLUDED_STAGES for in-progress grants - Test query security (no private fields in public query) - Compare public vs private grant field structures
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
Test Coverage
fiscalYear.test.tsgrants.test.tsinternal-auth.test.tsgrants-public.test.tsSecurity Fix
isAuthorizedEmail()domain validationINTERNAL_AUTH_SECRETDependencies
Merge after: