test: step-up token binding and replay-window#892
Merged
Conversation
Add comprehensive security tests for step-up middleware proving: - Tokens are bound to user and cannot be used by different users - Tokens are bound to action context and cannot be replayed across endpoints - Tokens are rejected immediately after expiry window (including boundary) - Tokens are single-use and cannot be replayed even within validity window Tests cover: - User binding (4 tests) - Action/context binding (5 tests) - Replay window edge cases (7 tests) - Security attack prevention (7 tests) - Middleware integration (7 tests) Enhanced AuthService to support optional action binding in tokens. Enhanced requireStepUp middleware to extract and validate action context. Fixed existing test file imports for Jest globals compatibility. Added abuseMonitor test helper function for taxonomy tests. Closes Disciplr-Org#739
- Add getTeamRollup(orgId) to src/services/team.ts with single-query CTE that joins teams, vaults, milestones, and memberships under strict org-scoped tenant isolation - Deduplicate vaults shared across teams via ROW_NUMBER partitioning - Compute per-team and org-wide vault counts, capital totals, milestone completion, and slash rates - Wire GET /:orgId/teams/rollup route in src/routes/orgAnalytics.ts with requireOrgRole(owner,admin) auth and rate limiting - Add docs/team-rollup.md documenting rollup shape and isolation guarantees - Add src/tests/team.rollup.test.ts covering zero teams, empty metrics, cross-org leakage prevention, dedup, and slash rate calculation
Remove stray backtick and misplaced closing brace that broke the handler object literal, causing TS1136/TS1005 errors on every subsequent handler entry.
Add 'sessions.cleanup', 'outbox.relay', 'embeddings.reindex' to JOB_TYPES union, JobPayloadByType, and add payload interfaces. Fix broken switch case in isPayloadForJobType (vault.reconcile missing closing paren). Import cleanupExpiredSessions, relayOutboxBatch, and runReindexBatches in handlers.ts.
|
@Lanhubs Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
nice coverage on the step-up token binding and replay window edges, merged |
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.
Add comprehensive security tests for step-up middleware proving:
Tests cover:
Enhanced AuthService to support optional action binding in tokens. Enhanced requireStepUp middleware to extract and validate action context.
Fixed existing test file imports for Jest globals compatibility. Added abuseMonitor test helper function for taxonomy tests.
Closes #739