Skip to content

test: step-up token binding and replay-window#892

Merged
1nonlypiece merged 4 commits into
Disciplr-Org:mainfrom
Lanhubs:main
Jun 28, 2026
Merged

test: step-up token binding and replay-window#892
1nonlypiece merged 4 commits into
Disciplr-Org:mainfrom
Lanhubs:main

Conversation

@Lanhubs

@Lanhubs Lanhubs commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

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 #739

Lanhubs added 4 commits June 27, 2026 17:51
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.
@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@1nonlypiece 1nonlypiece merged commit 09ebe28 into Disciplr-Org:main Jun 28, 2026
@1nonlypiece

Copy link
Copy Markdown
Contributor

nice coverage on the step-up token binding and replay window edges, merged

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.

Add stepUp middleware token-binding and replay-window tests in src/tests/stepUp.binding.test.ts

2 participants