[E2E-SEC-001]: feat(e2e)/SKY-108 Security E2E: 403s, rate-limit 429s, injection attempts, cross-tenant isolation, token-reuse revocation - #144
Open
Conversation
…isolation, token reuse)
…y directly for reuse replay - apiSignIn matches the BFF login route's underscore statuses (mfa_setup/mfa_challenge) instead of dotted ones. - token-reuse attacker replays the rotated token straight at identity (/api/v1/auth/refresh) instead of through the BFF: the BFF memoizes in-process refresh rotations, so a replayed token would return the cached rotated pair and never arm identity's reuse detector. - compose security override raises the login limit to 5 so the admin's own budget (setup + worker fixture + self-login = 3) isn't consumed.
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.
feat(SKY-108): Security E2E suite — 403s, rate limits, injection, tenant isolation, token-reuse revocation
Implements
[E2E-SEC-001]: a comprehensive security E2E suite executing the fullstack through the BFF against a hardened compose bootstrap, running in a
dedicated CI phase.
Coverage
Denial / RBAC —
e2e/security/denial-403.spec.ts200)403(not401, no data leak)401Rate limiting —
e2e/security/rate-limit.spec.ts429on the 5th attempt with aRetry-Afterheader429withRetry-Afterat 2 req/minInjection —
e2e/security/injection.spec.tsTenant isolation —
e2e/security/tenant-isolation.spec.tsRefresh-token reuse —
e2e/security/token-reuse.spec.ts401and revokes the session familyBackend changes
Retry-After(seconds) is now emitted on rate-limit429s and relayed throughthe stack to the client:
libs/skyrict-commonRateLimitExceededErrorcarriesretry_after_secondsservices/identityRetry-Afteron rate-limit 429services/ai-agentRetry-Afteron rate-limit 429services/coreRetry-Afterthrough the AI proxyapps/webRetry-Afterto the clientTest infra
IDENTITY_RATE_LIMIT_LOGIN=5,IDENTITY_REFRESH_REUSE_GRACE_SECONDS=0down -v→ merged-compose boot → re-seed →--project=security --workers=1 --retries=0security.tshelper aligned to the BFF's underscore mfa statuses(
mfa_setup/mfa_challenge)Design note
The token-reuse attacker replays the rotated token directly against identity
(
/api/v1/auth/refresh), not through the BFF. The BFF single-flights refreshrotations in-process (
rotateRefreshTokenmemo keyed by tenant+token), so asame-process replay returns the cached rotated pair and never arms identity's
reuse detector. Hitting identity directly is the true replay boundary and
validates the
401+ family-kill behavior.Verification
ruff check+tsc --noEmit+eslintclean