Commit Graph

51 Commits

Author SHA1 Message Date
65c57a2246 feat(auth): JWT jti + per-track TTLs (Track 4 <=1h) + revocation + refresh endpoint
Closes the 'JWT hygiene' gap identified by the review:

  - 24h TTL was used for every track, including Track 4 operator sessions
    carrying operator.write.* permissions.
  - Tokens had no server-side revocation path; rotating JWT_SECRET was
    the only way to invalidate a session, which would punt every user.
  - Tokens carried no jti, so individual revocation was impossible even
    with a revocations table.

Changes:

Migration 0016_jwt_revocations (up + down):
  - CREATE TABLE jwt_revocations (jti PK, address, track,
    token_expires_at, revoked_at, reason) plus indexes on address and
    token_expires_at. Append-only; idempotent on duplicate jti.

backend/auth/wallet_auth.go:
  - tokenTTLs map: track 1 = 12h, 2 = 8h, 3 = 4h, 4 = 60m. tokenTTLFor
    returns the ceiling; default is 12h for unknown tracks.
  - generateJWT now embeds a 128-bit random jti (hex-encoded) and uses
    the per-track TTL instead of a hardcoded 24h.
  - parseJWT: shared signature-verification + claim-extraction helper
    used by ValidateJWT and RefreshJWT. Returns address, track, jti, exp.
  - jtiFromToken: parses jti from an already-trusted token without a
    second crypto roundtrip.
  - isJTIRevoked: EXISTS query against jwt_revocations, returning
    ErrJWTRevocationStorageMissing when the table is absent (migration
    not run yet) so callers can surface a 503 rather than silently
    treating every token as valid.
  - RevokeJWT(ctx, token, reason): records the jti; idempotent via
    ON CONFLICT (jti) DO NOTHING. Refuses legacy tokens without jti.
  - RefreshJWT(ctx, token): validates, revokes the old token (reason
    'refresh'), and mints a new token with fresh jti + fresh TTL. Same
    (address, track) as the inbound token, same permissions set.
  - ValidateJWT now consults jwt_revocations when a DB is configured;
    returns ErrJWTRevoked for revoked tokens.

backend/api/rest/auth_refresh.go (new):
  - POST /api/v1/auth/refresh handler: expects 'Authorization: Bearer
    <jwt>'; returns WalletAuthResponse with the new token. Maps
    ErrJWTRevoked to 401 token_revoked and ErrWalletAuthStorageNotInitialized
    to 503.
  - POST /api/v1/auth/logout handler: same header contract, idempotent,
    returns {status: ok}. Returns 503 when the revocations table
    isn't present so ops know migration 0016 hasn't run.
  - Both handlers reuse the existing extractBearerToken helper from
    auth.go so parsing is consistent with the rest of the access layer.

backend/api/rest/routes.go:
  - Registered /api/v1/auth/refresh and /api/v1/auth/logout.

Tests:
  - TestTokenTTLForTrack4IsShort: track 4 TTL <= 1h.
  - TestTokenTTLForTrack1Track2Track3AreReasonable: bounded at 12h.
  - TestGeneratedJWTCarriesJTIClaim: jti is present, 128 bits / 32 hex.
  - TestGeneratedJWTExpIsTrackAppropriate: exp matches tokenTTLFor per
    track within a couple-second tolerance.
  - TestRevokeJWTWithoutDBReturnsError: a WalletAuth with nil db must
    refuse to revoke rather than silently pretending it worked.
  - All pre-existing wallet_auth tests still pass.

Also fixes a small SA4006/SA4017 regression in mission_control.go that
PR #5 introduced by shadowing the outer err with json.Unmarshal's err
return. Reworked to uerr so the outer err and the RPC fallback still
function as intended.

Verification:
  go build ./...         clean
  go vet ./...           clean
  go test ./auth/...     PASS (including new tests)
  go test ./api/rest/... PASS
  staticcheck ./auth/... ./api/rest/...  clean on SA4006/SA4017/SA1029

Advances completion criterion 3 (JWT hygiene): 'Track 4 sessions TTL
<= 1h; server-side revocation list (keyed on jti) enforced on every
token validation; refresh endpoint rotates the token in place so the
short TTL is usable in practice; logout endpoint revokes immediately.'
2026-04-18 19:20:57 +00:00
defiQUG
7a603e1f96 Refine homepage freshness layout 2026-04-16 11:12:17 -07:00
defiQUG
02996c6b1a Improve explorer subsystem posture and wallet visibility 2026-04-13 21:35:36 -07:00
defiQUG
0c869f7930 feat(freshness): enhance diagnostics and update snapshot structure
- Introduced a new Diagnostics struct to capture transaction visibility state and activity state.
- Updated BuildSnapshot function to return diagnostics alongside snapshot, completeness, and sampling.
- Enhanced test cases to validate the new diagnostics data.
- Updated frontend components to utilize the new diagnostics information for improved user feedback on freshness context.

This change improves the observability of transaction activity and enhances the user experience by providing clearer insights into the freshness of data.
2026-04-12 18:22:08 -07:00
defiQUG
26b0f1bf48 feat(bridge-monitoring): show inventory shortfall for queued releases
Surface mission-control bridge_inventory scope, wei shortfall fields, and
relay card formatting for WETH display.

Made-with: Cursor
2026-04-12 06:44:20 -07:00
defiQUG
ee71f098ab Freshness diagnostics API, UI trust notes, mission control/stats updates, and deploy scripts.
Made-with: Cursor
2026-04-12 06:33:54 -07:00
defiQUG
f46bd213ba refactor: rename SolaceScanScout to Solace and update related configurations
- Updated branding from "SolaceScanScout" to "Solace" across various files including deployment scripts, API responses, and documentation.
- Changed default base URL for Playwright tests and updated security headers to reflect the new branding.
- Enhanced README and API documentation to include new authentication endpoints and product access details.

This refactor aligns the project branding and improves clarity in the API documentation.
2026-04-10 12:52:17 -07:00
defiQUG
bdae5a9f6e feat: explorer API, wallet, CCIP scripts, and config refresh
- Backend REST/gateway/track routes, analytics, Blockscout proxy paths.
- Frontend wallet and liquidity surfaces; MetaMask token list alignment.
- Deployment docs, verification scripts, address inventory updates.

Check: go build ./... under backend/ (pass).
Made-with: Cursor
2026-04-07 23:22:12 -07:00
defiQUG
4044fb07e1 fix(wallet): MetaMask Open Snap allowlist messaging + resolveExplorerApiBase
- Clarify stable MetaMask install allowlist vs open Snap permissions on /wallet
- Surface Flask / allowlist-application hint when install errors mention allowlist
- Add shared resolveExplorerApiBase helper for catalog URLs

Made-with: Cursor
2026-04-05 01:23:25 -07:00
defiQUG
3bca5394fc Update public RPC capability metadata 2026-03-28 19:18:20 -07:00
defiQUG
630021c043 Publish Chain 138 RPC capability metadata 2026-03-28 15:56:42 -07:00
defiQUG
ff8d94383c Centralize explorer bridge destination selectors 2026-03-28 15:18:49 -07:00
defiQUG
e5f038c9db Prune explorer dead ends and harden route smoke 2026-03-28 15:15:23 -07:00
defiQUG
bf83ff7776 Add dedicated explorer routes page 2026-03-28 15:04:42 -07:00
defiQUG
f309c303ff Promote explorer content links to real anchors 2026-03-28 14:09:23 -07:00
defiQUG
6d0e250f84 Fix explorer SPA detail navigation fallback 2026-03-28 13:59:00 -07:00
defiQUG
0ea1c3b176 Fix explorer address list regression and live link checks 2026-03-28 13:44:47 -07:00
defiQUG
a2555b4149 Harden explorer MetaMask data and navigation coverage 2026-03-28 13:40:32 -07:00
defiQUG
1e3a3f00ef Polish explorer frontend validation and utility pages 2026-03-28 13:26:42 -07:00
defiQUG
59eee21a3f Fix explorer routing, links, and frontend API loading 2026-03-28 00:21:18 -07:00
defiQUG
e229c82fdf chore(scripts): align CCIP health/setup scripts with inventory loaders
Made-with: Cursor
2026-03-27 22:21:15 -07:00
defiQUG
3bd95e1932 chore(scripts): use inventory + CCIP matrix in status/verify reports
Made-with: Cursor
2026-03-27 22:18:41 -07:00
defiQUG
0463dbf889 feat(scripts): CCIP destination matrix + ccip-destinations helper
- Add config/ccip-destination-matrix.json (selectors, bridges, public RPCs)
- Drive configure-all-*-destinations scripts from matrix via jq
- Extend config/README; wire check-bridge-config and pre-flight-check

Made-with: Cursor
2026-03-27 22:17:12 -07:00
defiQUG
d0f6044b9b chore(scripts): comment fixes for inventory persistence paths
Made-with: Cursor
2026-03-27 22:11:50 -07:00
defiQUG
a2beda3db4 chore(scripts): use load_explorer_runtime_env + address-inventory helper
Align remaining shell scripts with shared env loading (no direct .env source).

Made-with: Cursor
2026-03-27 22:10:38 -07:00
defiQUG
7a7ce770c2 feat(scripts): resolve CCIP/LINK addresses via config inventory
- Add scripts/lib/address-inventory.sh (jq + JSON inventory fallback)
- Wire deployment helper scripts to load_explorer_runtime_env + resolve_address_value
- Persist new LINK to address-inventory.json via persist_inventory_value
- Document config/*.json in config/README.md

Made-with: Cursor
2026-03-27 22:09:32 -07:00
defiQUG
3158c5cd36 chore: add address inventory and runtime-env JSON refs (dotenv cleanup)
Non-secret reference copies of former .env address surface for docs/scripts.

Made-with: Cursor
2026-03-27 19:19:25 -07:00
defiQUG
d4bd4a2f0f fix(frontend): explorer SPA bundle updates
Made-with: Cursor
2026-03-27 18:52:03 -07:00
defiQUG
06e2c7a29e Move explorer AI key loading to secure secrets 2026-03-27 17:11:16 -07:00
defiQUG
c1fe6ec6e3 Switch explorer AI provider to Grok 2026-03-27 16:51:04 -07:00
defiQUG
d0964904d6 Add Chain 138 mirror tokens and gold unit metadata 2026-03-27 15:45:06 -07:00
defiQUG
0ca14deb4c Normalize token list JSON formatting 2026-03-27 15:44:37 -07:00
defiQUG
86d0e0e27b Add global footer to frontend layout 2026-03-27 15:27:09 -07:00
defiQUG
ff259deff9 Reconcile explorer service and nginx ownership 2026-03-27 15:21:56 -07:00
defiQUG
a18918ce91 Harden explorer AI runtime and API ownership 2026-03-27 14:12:14 -07:00
defiQUG
f6f25aa457 Add explorer AI chat and context endpoints 2026-03-27 13:37:53 -07:00
defiQUG
0f4630f443 Upgrade explorer more menu into grouped tools hub 2026-03-27 12:11:18 -07:00
defiQUG
2491336b8e Add explorer liquidity access and live route proxies 2026-03-27 12:02:36 -07:00
defiQUG
d02ee71cf6 Update CCIP Router and Bridge Addresses for ChainID 138
- Changed CCIP Router address from `0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e` to `0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817` across multiple documentation files.
- Updated WETH9 Bridge address from `0x89dd12025bfCD38A168455A44B400e913ED33BE2` to `0xcacfd227A040002e49e2e01626363071324f820a`.
- Ensured all references to the new addresses are consistent throughout the documentation.

This update reflects the latest deployment configurations and ensures accurate contract references for ChainID 138.
2026-03-24 22:49:29 -07:00
defiQUG
ed86d01e1d feat(frontend): explorer SPA and index updates; env verification report
- Expand explorer-spa.js and index.html for Chain 138 explorer UX
- Refresh ENV_VERIFICATION_REPORT.md

Made-with: Cursor
2026-03-24 18:11:08 -07:00
defiQUG
04bea35e89 feat: update token list and Nginx configuration for Chain 138
- Added new compliant tokens including Tether EUR, Pound Sterling, and others to the DUAL_CHAIN_TOKEN_LIST.
- Updated version in the token list configuration to 1.2.
- Enhanced Nginx configuration to support token-aggregation API and serve token list and network configurations from specified paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-03-04 02:00:15 -08:00
defiQUG
041fae1574 chore: sync submodule state (parent ref update)
Made-with: Cursor
2026-03-02 12:14:13 -08:00
defiQUG
43a7b88e2a Explorer: add-to-wallet icon, WETH symbol/decimals fixes
- Add wallet icon (add to MetaMask) on WETH page, Tokens list, token detail
- addTokenToWallet() via EIP-747 wallet_watchAsset; toasts for success/error
- Known-token overrides: WETH9/WETH10 display name and symbol WETH; decimals 18
- Token list: show Wrapped Ether (WETH) for WETH9/WETH10 when API missing
- Token detail: force 18 decimals and name/symbol for WETH9/WETH10
- CSS for .btn-add-token-wallet

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-22 15:35:45 -08:00
defiQUG
a53c15507f fix: API JSON error responses + navbar with dropdowns
- Add backend/libs/go-http-errors for consistent JSON errors
- REST API: use writeMethodNotAllowed, writeNotFound, writeInternalError
- middleware, gateway, search: use httperrors.WriteJSON
- SPA: navbar with Explore/Tools/More dropdowns, initNavDropdowns()
- Next.js: Navbar component with dropdowns + mobile menu

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-16 03:09:53 -08:00
defiQUG
01e126a868 Explorer + Snap: nginx /snap 200, runbook, apply-nginx script, verify docs
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 12:44:05 -08:00
defiQUG
b1415f15fc Docs: update all documentation and add overview
- README: add Frontend section, deploy script, docs links, status
- docs/README.md: new documentation overview (entry points, frontend, deployment)
- docs/EXPLORER_API_ACCESS.md: reference deploy-frontend-to-vmid5000.sh for frontend-only deploy
- docs/INDEX.md: add Frontend & Explorer section, fix Quick Start, Last Updated
- README_DEPLOYMENT: add docs/README, EXPLORER_API_ACCESS, deploy script, deployment guide
- frontend/FRONTEND_REVIEW.md: add post-review update (C1–L4 implemented)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 19:02:19 -08:00
defiQUG
2b956a5a83 Frontend: complete task list (C1–L4), security, a11y, L1 block card helper
- React: response.ok checks (address, transaction, search); block number validation; stable Table keys; API modules (addresses, transactions, blocks normalizer)
- SPA: escapeHtml/safe URLs/onclick; getRpcUrl in rpcCall; cancel blocks rAF on view change; named constants; hash route decode
- SPA: createBlockCardHtml + normalizeBlockDisplay (L1); DEBUG console gating; aria-live for errors; token/block/tx detail escaping
- Docs: FRONTEND_REVIEW.md, FRONTEND_TASKS_AND_REVIEW.md; favicons; .gitignore *.tsbuildinfo

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 18:43:37 -08:00
defiQUG
1c8ca4172a Remove virtual-banker: now a separate repo under projects directory, no reference
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 16:34:07 -08:00
defiQUG
8380a36c67 Move virtual-banker to own repo: replace with submodule d-bis/virtual-banker
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 11:35:45 -08:00
defiQUG
903c03c65b Add full monorepo: virtual-banker, backend, frontend, docs, scripts, deployment
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 11:32:49 -08:00