Security: assert wrap pause and rate limit swap CTA copy and disabled state (#389) #920

Merged
PlasticDigits merged 1 commit from issue-389-wrap-pause-rate-limit-cta-tests into main 2026-06-19 01:54:34 +00:00
PlasticDigits commented 2026-06-19 01:43:56 +00:00 (Migrated from gitlab.com)

Summary

Addresses GitLab #389 (SEC-A02): wrap-mapper pause and on-chain wrap rate limit states on / now have isolated frontend tests that assert the exact submit button copy and disabled state — replacing the prior E12 regex that only checked visibility.

  • Vitest (SwapPage.test.tsx): separate cases mock queryPausedState vs checkRateLimitExceeded.
  • Playwright (wrap-swap.spec.ts): LCD route intercepts via e2e/helpers/wrap-mapper-lcd-mock.ts (no combined Rate Limit|Insufficient|Swap matcher).
  • Docs/skills: docs/frontend.md, docs/testing.md, skills/AGENTS_FRONTEND_SWAP_SAFETY_CTA.md, frontend-dapp/e2e/README.md.

Acceptance checklist

Criterion Verification Result
Asserts "Wrapping is Temporarily Paused" when wrap mapper paused bash scripts/with-node.sh --cwd frontend-dapp -- npm run test:run -- src/pages/SwapPage.test.tsx -t "wrap mapper is paused" PASS
Submit disabled in wrap pause state same Vitest case (toBeDisabled) PASS
Asserts "Rate Limit Exceeded" on rate limit bash scripts/with-node.sh --cwd frontend-dapp -- npm run test:run -- src/pages/SwapPage.test.tsx -t "rate limit is exceeded" PASS
Submit disabled in rate limit state same Vitest case (toBeDisabled) PASS
Pause and rate limit tested in isolation Separate Vitest it blocks + separate Playwright specs (E12 vs wrap-pause describe) PASS
All new tests pass in CI GitLab pipeline on this MR PENDING
Playwright SEC-A02 (LCD mocks) `bash scripts/with-node.sh --cwd frontend-dapp -- npx playwright test e2e/wrap-swap.spec.ts -g "SEC-A02 wrap mapper paused" --project=e2e-smoke(needsmake deploy-local` env)

Third-party verification

# Unit (no chain)
bash scripts/with-node.sh --cwd frontend-dapp -- npm run test:run -- src/pages/SwapPage.test.tsx -t "SEC-A02"

# E2E (after make setup-cloud-localterra or deploy-local)
bash scripts/with-node.sh --cwd frontend-dapp -- npx playwright test e2e/wrap-swap.spec.ts -g "SEC-A02|wrap mapper paused" --project=e2e-smoke

Playbook: skills/AGENTS_FRONTEND_SWAP_SAFETY_CTA.md

## Summary Addresses GitLab **#389** (SEC-A02): wrap-mapper **pause** and on-chain wrap **rate limit** states on `/` now have isolated frontend tests that assert the exact submit button copy and `disabled` state — replacing the prior E12 regex that only checked visibility. - **Vitest** (`SwapPage.test.tsx`): separate cases mock `queryPausedState` vs `checkRateLimitExceeded`. - **Playwright** (`wrap-swap.spec.ts`): LCD route intercepts via `e2e/helpers/wrap-mapper-lcd-mock.ts` (no combined `Rate Limit|Insufficient|Swap` matcher). - **Docs/skills**: `docs/frontend.md`, `docs/testing.md`, `skills/AGENTS_FRONTEND_SWAP_SAFETY_CTA.md`, `frontend-dapp/e2e/README.md`. ## Acceptance checklist | Criterion | Verification | Result | |-----------|--------------|--------| | Asserts "Wrapping is Temporarily Paused" when wrap mapper paused | `bash scripts/with-node.sh --cwd frontend-dapp -- npm run test:run -- src/pages/SwapPage.test.tsx -t "wrap mapper is paused"` | **PASS** | | Submit disabled in wrap pause state | same Vitest case (`toBeDisabled`) | **PASS** | | Asserts "Rate Limit Exceeded" on rate limit | `bash scripts/with-node.sh --cwd frontend-dapp -- npm run test:run -- src/pages/SwapPage.test.tsx -t "rate limit is exceeded"` | **PASS** | | Submit disabled in rate limit state | same Vitest case (`toBeDisabled`) | **PASS** | | Pause and rate limit tested in isolation | Separate Vitest `it` blocks + separate Playwright specs (E12 vs wrap-pause describe) | **PASS** | | All new tests pass in CI | GitLab pipeline on this MR | **PENDING** | | Playwright SEC-A02 (LCD mocks) | `bash scripts/with-node.sh --cwd frontend-dapp -- npx playwright test e2e/wrap-swap.spec.ts -g "SEC-A02|wrap mapper paused" --project=e2e-smoke` (needs `make deploy-local` env) | **SKIP** (LocalTerra not provisioned on agent VM) | ## Third-party verification ```bash # Unit (no chain) bash scripts/with-node.sh --cwd frontend-dapp -- npm run test:run -- src/pages/SwapPage.test.tsx -t "SEC-A02" # E2E (after make setup-cloud-localterra or deploy-local) bash scripts/with-node.sh --cwd frontend-dapp -- npx playwright test e2e/wrap-swap.spec.ts -g "SEC-A02|wrap mapper paused" --project=e2e-smoke ``` Playbook: `skills/AGENTS_FRONTEND_SWAP_SAFETY_CTA.md`
PlasticDigits commented 2026-06-19 01:45:44 +00:00 (Migrated from gitlab.com)

Security review — MR !920

Commit reviewed: 8e0561c433bf115954659cf341e9451c80cb029e

Scope: SEC-A02 wrap pause / wrap rate-limit swap CTA tests and docs — frontend-dapp/e2e/helpers/wrap-mapper-lcd-mock.ts, frontend-dapp/e2e/wrap-swap.spec.ts, frontend-dapp/src/pages/SwapPage.test.tsx, plus docs/frontend.md, docs/testing.md, skills/AGENTS_FRONTEND_SWAP_SAFETY_CTA.md, frontend-dapp/e2e/README.md.

Method: Full MR diff review; traced attacker-controlled inputs in added code to sinks; checked unchanged SwapPage.tsx / wrapMapper.ts CTA gating only where needed to confirm no new exploit path. No prior security-review threads on this MR.

Outcome: FINDINGS: 0 medium+

Security review: no medium+ findings on this diff.

Added code is test/documentation only (Vitest mocks, Playwright LCD route interceptors, agent playbook). No production swap, wrap-mapper, or auth logic changed. The E2E helper (decodeSmartQuery, page.route) runs only in Playwright CI/dev — not shipped to users; no injection, SSRF, secret leakage, or auth bypass introduced. On-chain pause/rate-limit enforcement remains unchanged and is the real control; this MR strengthens regression coverage for UI copy + disabled state.

Inline threads: none

## Security review — MR !920 **Commit reviewed:** `8e0561c433bf115954659cf341e9451c80cb029e` **Scope:** SEC-A02 wrap pause / wrap rate-limit swap CTA tests and docs — `frontend-dapp/e2e/helpers/wrap-mapper-lcd-mock.ts`, `frontend-dapp/e2e/wrap-swap.spec.ts`, `frontend-dapp/src/pages/SwapPage.test.tsx`, plus `docs/frontend.md`, `docs/testing.md`, `skills/AGENTS_FRONTEND_SWAP_SAFETY_CTA.md`, `frontend-dapp/e2e/README.md`. **Method:** Full MR diff review; traced attacker-controlled inputs in added code to sinks; checked unchanged `SwapPage.tsx` / `wrapMapper.ts` CTA gating only where needed to confirm no new exploit path. No prior security-review threads on this MR. **Outcome:** `FINDINGS: 0` medium+ Security review: no medium+ findings on this diff. Added code is test/documentation only (Vitest mocks, Playwright LCD route interceptors, agent playbook). No production swap, wrap-mapper, or auth logic changed. The E2E helper (`decodeSmartQuery`, `page.route`) runs only in Playwright CI/dev — not shipped to users; no injection, SSRF, secret leakage, or auth bypass introduced. On-chain pause/rate-limit enforcement remains unchanged and is the real control; this MR strengthens regression coverage for UI copy + `disabled` state. **Inline threads:** none
PlasticDigits (Migrated from gitlab.com) merged commit 7d8b4d1b41 into main 2026-06-19 01:54:34 +00:00
PlasticDigits commented 2026-06-19 01:54:35 +00:00 (Migrated from gitlab.com)

mentioned in commit 7d8b4d1b41

mentioned in commit 7d8b4d1b411beae4d598ebd810d6d3eb2ae51ec9
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!920
No description provided.