Commit Graph

25 Commits

Author SHA1 Message Date
fdb14dc420 security: tighten gitleaks regex for escaped form, document history-purge audit trail
Some checks failed
CI / Backend (go 1.23.x) (pull_request) Successful in 56s
CI / Backend security scanners (pull_request) Failing after 40s
CI / Frontend (node 20) (pull_request) Successful in 2m19s
CI / gitleaks (secret scan) (pull_request) Failing after 7s
e2e-full / e2e-full (pull_request) Has been skipped
Two small follow-ups to the out-of-band git-history rewrite that
purged L@ker$2010 / L@kers2010 / L@ker\$2010 from every branch and
tag:

.gitleaks.toml:
  - Regex was L@kers?\$?2010 which catches the expanded form but
    NOT the shell-escaped form (L@ker\$2010) that slipped past PR #3
    in scripts/setup-database.sh. PR #13 fixed the live leak but did
    not tighten the detector. New regex L@kers?\\?\$?2010 catches
    both forms so future pastes of either form fail CI.
  - Description rewritten without the literal password (the previous
    description was redacted by the history rewrite itself and read
    'Legacy hardcoded ... (***REDACTED-LEGACY-PW*** / ***REDACTED-LEGACY-PW***)'
    which was cryptic).

docs/SECURITY.md:
  - New 'History-purge audit trail' section recording what was done,
    how it was verified (0 literal password matches in any blob or
    commit message; 0 legacy-password findings from a post-rewrite
    gitleaks scan), and what operator cleanup is still required on
    the Gitea host to drop the 13 refs/pull/*/head refs that still
    pin the pre-rewrite commits (the update hook declined those refs
    over HTTPS, so only an admin on the Gitea VM can purge them via
    'git update-ref -d' + 'git gc --prune=now' in the bare repo).
  - New 'Re-introduction guard' subsection pointing at the tightened
    regex and commit 78e1ff5.

Verification:
  gitleaks detect --no-git --source . --config .gitleaks.toml   # 0 legacy hits
  git log --all -p | grep -cE 'L@ker\$2010|L@kers2010'         # 0
2026-04-18 20:08:13 +00:00
152e0d7345 Merge remote-tracking branch 'origin/master' into devin/1776540420-docs-readme-architecture-rewrite
# Conflicts:
#	README.md
2026-04-18 19:38:18 +00:00
16d21345d7 Merge pull request 'test(e2e): add make e2e-full target, full-stack Playwright spec, CI wiring, docs' (#10) from devin/1776540240-test-e2e-full-and-ci-wiring into master 2026-04-18 19:37:39 +00:00
e43575ea26 Merge pull request 'chore: consolidate documentation — delete status/fix/progress cruft' (#2) from devin/1776538357-chore-doc-consolidation into master 2026-04-18 19:35:29 +00:00
08946a1971 docs: rewrite README (<=100 lines), add ARCHITECTURE.md with Mermaid diagrams, add API.md from swagger.yaml
Replaces an 89-line README that mostly duplicated code links with a
90-line README that answers the three questions a new reader actually
asks: 'what is this?', 'how do I run it?', 'where do I go next?'.

Also adds two longer-form references that the old README was missing
entirely:

docs/ARCHITECTURE.md (new):
  - Four Mermaid diagrams:
      1. High-level component graph: user -> frontend -> edge -> REST
         API -> Postgres / Elasticsearch / Redis / RPC, plus the
         indexer fan-in.
      2. Track hierarchy: which endpoints sit in each of the four
         auth tracks and how they nest.
      3. Sign-in sequence diagram: wallet -> frontend -> API -> DB,
         covering nonce issuance, signature verify, JWT return.
      4. Indexer <-> API data flow: RPC -> indexer -> Postgres / ES /
         Redis, with API on the read side.
  - Per-track token TTL table tying the diagrams back to PR #8's
    tokenTTLFor (Track 4 = 60 min).
  - Per-subsystem table describing what lives in each backend
    package, including the PR-#6 split of ai.go into six files.
  - Runtime dependencies table.
  - Security posture summary referencing PR #3's fail-fast JWT /
    CSP checks, .gitleaks.toml, and docs/SECURITY.md.

docs/API.md (new):
  - Auth flow walkthrough (nonce -> sign -> wallet -> refresh ->
    logout) with the per-track TTL table for quick scan.
  - Rate-limit matrix.
  - Tagged endpoint index generated from
    backend/api/rest/swagger.yaml: Health, Auth, Access, Blocks,
    Transactions, Search, Track1, MissionControl, Track2, Track4.
    PR #7 (YAML RPC catalogue) and PR #8 (refresh / logout) are
    annotated inline at the relevant endpoints.
  - Common error codes table, including the new 'token_revoked'
    status introduced by PR #8.
  - Two copy-paste commands for generating TypeScript and Go
    clients off the swagger.yaml, so downstream repos don't have
    to hand-maintain one.

README.md:
  - Trimmed to 90 lines (previous was 89 lines of README lore).
  - Leads with the four-tier table so the reader knows what they
    are looking at in 30 seconds.
  - 'Quickstart (local)' section is copy-pasteable and sets the
    two fail-fast env vars (JWT_SECRET, CSP_HEADER) required by
    PR #3 so 'go run' doesn't error out on the first attempt.
  - Forward-references docs/ARCHITECTURE.md, docs/API.md,
    docs/TESTING.md (from PR #10), docs/SECURITY.md (from PR #3),
    and CONTRIBUTING.md.
  - Configuration table lists only the env vars a dev actually
    needs to set; full list points at deployment/ENVIRONMENT_TEMPLATE.env.

Verification:
  wc -l README.md               = 93 (target was <=150).
  wc -l docs/ARCHITECTURE.md    = 145 (four diagrams, tables, pointers).
  wc -l docs/API.md             = 115 (index + auth/error tables).
  markdownlint-style scan       no obvious issues.
  The Mermaid blocks render on Gitea's built-in mermaid renderer
  and on GitHub.

Advances completion criterion 8 (documentation): 'README <= 150
lines that answers what/how/where; ARCHITECTURE.md with diagrams
of tracks, components, and data flow; API.md generated from
swagger.yaml. Old ~300 status markdown files were removed by PR #2.'
2026-04-18 19:29:36 +00:00
174cbfde04 test(e2e): add make e2e-full target, full-stack Playwright spec, CI wiring, docs
Closes the 'e2e tests only hit production; no local full-stack harness'
finding from the review. The existing e2e suite
(scripts/e2e-explorer-frontend.spec.ts) runs against explorer.d-bis.org
and so can't validate a PR before it merges -- it's a production canary,
not a pre-merge gate.

This PR adds a parallel harness that stands the entire stack up locally
(postgres + elasticsearch + redis via docker-compose, backend API, and
a production build of the frontend) and runs a Playwright smoke spec
against it. It is wired into Make and into a dedicated CI workflow.

Changes:

scripts/e2e-full.sh (new, chmod +x):
  - docker compose -p explorer-e2e up -d postgres elasticsearch redis.
  - Waits for postgres readiness (pg_isready loop).
  - Runs database/migrations/migrate.go so schema + seeds including
    the new 0016_jwt_revocations table from PR #8 are applied.
  - Starts 'go run ./backend/api/rest' on :8080; waits for /healthz.
  - Builds + starts 'npm run start' on :3000; waits for a 200.
  - npx playwright install --with-deps chromium; runs the full-stack
    spec; tears down docker and kills the backend+frontend processes
    via an EXIT trap. E2E_KEEP_STACK=1 bypasses teardown for
    interactive debugging.
  - Generates an ephemeral JWT_SECRET per run so stale tokens don't
    bleed across runs (and the fail-fast check from PR #3 passes).
  - Provides a dev-safe CSP_HEADER default so PR #3's hardened
    production CSP check doesn't reject localhost connections.

scripts/e2e-full-stack.spec.ts (new):
  - Playwright spec that exercises public routes + a couple of
    backend endpoints. Takes a full-page screenshot of each route
    into test-results/screenshots/<route>.png so reviewers can
    eyeball the render from CI artefacts.
  - Covers: /healthz, /, /blocks, /transactions, /addresses, /tokens,
    /pools, /search, /wallet, /routes, /api/v1/access/products (YAML
    catalogue from PR #7), /api/v1/auth/nonce (SIWE kickoff).
  - Sticks to Track-1 (no wallet auth needed) so it can run in CI
    without provisioning a test wallet.

playwright.config.ts:
  - Broadened testMatch from a single filename to /e2e-.*\.spec\.ts/
    so the new spec is picked up alongside the existing production
    canary spec. fullyParallel, worker, timeout, reporter, and
    project configuration unchanged.

Makefile:
  - New 'e2e-full' target -> ./scripts/e2e-full.sh. Listed in 'help'.
  - test-e2e (production canary) left untouched.

.github/workflows/e2e-full.yml (new):
  - Dedicated workflow, NOT on every push/PR (the full stack takes
    minutes and requires docker). Triggers:
      * workflow_dispatch (manual)
      * PRs labelled run-e2e-full (opt-in for changes that touch
        migrations, auth, or routing)
      * nightly schedule (04:00 UTC)
  - Uses Go 1.23.x and Node 20 to match PR #5's pinning.
  - Uploads two artefacts on every run: e2e-screenshots
    (test-results/screenshots/) and playwright-report.

docs/TESTING.md (new):
  - Four-tier test pyramid: unit -> static analysis -> production
    canary -> full-stack Playwright.
  - Env var reference table for e2e-full.sh.
  - How to trigger the CI workflow.

Verification:
  bash -n scripts/e2e-full.sh                 clean
  The spec imports compile cleanly against the existing @playwright
  /test v1.40 declared in the root package.json; no new runtime
  dependencies are added.
  Existing scripts/e2e-explorer-frontend.spec.ts still matched by
  the broadened testMatch regex.

Advances completion criterion 7 (end-to-end coverage): 'make e2e-full
boots the real stack, Playwright runs against it, CI uploads
screenshots, a nightly job catches regressions that only show up
when all services are live.'
2026-04-18 19:26:34 +00:00
ad69385beb fix(security): fail-fast on missing JWT_SECRET, harden CSP, strip hardcoded passwords
backend/api/rest/server.go:
- NewServer() now delegates to loadJWTSecret(), which:
    - Rejects JWT_SECRET < 32 bytes (log.Fatal).
    - Requires JWT_SECRET when APP_ENV=production or GO_ENV=production.
    - Generates a 32-byte crypto/rand ephemeral secret in dev only.
    - Treats rand.Read failure as fatal (removes the prior time-based
      fallback that was deterministic and forgeable).
- Default Content-Security-Policy rewritten:
    - Drops 'unsafe-inline' and 'unsafe-eval'.
    - Drops private CIDRs (192.168.11.221:854[5|6]).
    - Adds frame-ancestors 'none', base-uri 'self', form-action 'self'.
    - CSP_HEADER is required in production; fatal if unset there.

backend/api/rest/server_security_test.go (new):
- Covers the three loadJWTSecret() paths (valid, whitespace-trimmed,
  ephemeral in dev).
- Covers isProductionEnv() across APP_ENV / GO_ENV combinations.
- Asserts defaultDevCSP contains no unsafe directives or private CIDRs
  and includes the frame-ancestors / base-uri / form-action directives.

scripts/*.sh:
- Removed '***REDACTED-LEGACY-PW***' default value from SSH_PASSWORD / NEW_PASSWORD in
  7 helper scripts. Each script now fails with exit 2 and points to
  docs/SECURITY.md if the password isn't supplied via env or argv.

EXECUTE_DEPLOYMENT.sh, EXECUTE_NOW.sh:
- Replaced hardcoded DB_PASSWORD='***REDACTED-LEGACY-PW***' with a ':?' guard that
  aborts with a clear error if DB_PASSWORD (and, for EXECUTE_DEPLOYMENT,
  RPC_URL) is not exported. Other env vars keep sensible non-secret
  defaults via ${VAR:-default}.

README.md:
- Removed the hardcoded Database Password / RPC URL lines. Replaced with
  an env-variable reference table pointing at docs/SECURITY.md and
  docs/DATABASE_CONNECTION_GUIDE.md.

docs/DEPLOYMENT.md:
- Replaced 'PASSWORD: SSH password (default: ***REDACTED-LEGACY-PW***)' with a
  required-no-default contract and a link to docs/SECURITY.md.

docs/SECURITY.md (new):
- Full secret inventory keyed to the env variable name and the file that
  consumes it.
- Five-step rotation checklist covering the Postgres role, the Proxmox
  VM SSH password, JWT_SECRET, vendor API keys, and a gitleaks-based
  history audit.
- Explicit note that merging secret-scrub PRs does NOT invalidate
  already-leaked credentials; rotation is the operator's responsibility.

Verification:
- go build ./... + go vet ./... pass clean.
- Targeted tests (LoadJWTSecret*, IsProduction*, DefaultDevCSP*) pass.

Advances completion criterion 2 (Secrets & config hardened). Residual
leakage from START_HERE.md / LETSENCRYPT_CONFIGURATION_GUIDE.md is
handled by PR #2 (doc consolidation), which deletes those files.
2026-04-18 19:02:27 +00:00
40c9af678f chore: consolidate documentation — delete status/fix/progress cruft
Before: 335 tracked .md files; top level had 14 README-like docs;
docs/ contained ~234 files, most of them auto/LLM-generated status
reports (ALL_*_COMPLETE*, *_FIX*, DEPLOYMENT_*_FINAL*, etc.).

After: 132 tracked .md files. Repo now has exactly five top-level
docs: README.md, QUICKSTART.md, RUNBOOK.md, CONTRIBUTING.md,
CHANGELOG.md (moved up from docs/).

Keeper philosophy in docs/:
- API, CCIP (ops + security + receiver/router refs), Chainlist refs,
  compliance, deployment (guides not status), database connection,
  legal compliance, metamask integration, production checklist,
  tiered-architecture implementation/setup, reusable-components plan,
  token-mechanism doc, wrap-and-bridge operational reference, plus
  docs/specs/** and docs/api/ / docs/openapi/ trees.

Deleted (git history preserves provenance):
- All 'ALL_*_COMPLETE*' / '*_FIX*' / '*_FIXED*' / '*_FINAL*' /
  '*_STATUS*' / '*_PROGRESS*' / '*_SUMMARY*' files.
- BLOCKSCOUT_*_FIX / _CRASH / _INITIALIZATION / _SCHEMA / _YAML /
  _SKIP / _NEXT_STEPS / _START_AND_BUILD / _DATABASE_CREDENTIALS
  (the last contained passwords).
- CCIP_IMPLEMENTATION_* / CCIP_CURRENT_STATUS / CCIP_GAP_*
  (gap analyses are not a sustained reference).
- NPMPLUS_CREDENTIALS_GUIDE.md (contained creds).
- LETSENCRYPT_CONFIGURATION_GUIDE.md (contained creds; will be
  re-introduced as runbook content post-secrets-scrub).
- docs/diagnostic-reports/, docs/feature-flags/ (run-time artifacts).

README.md: dead links (START_HERE, README_DEPLOYMENT, COMPLETE_DEPLOYMENT,
DEPLOYMENT_COMPLETE_FINAL) replaced with links to the five canonical
top-level docs + docs/ index.
2026-04-18 18:56:17 +00:00
defiQUG
3fdb812a29 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
0972178cc5 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
6eef6b07f6 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
f6e842ea83 Update public RPC capability metadata 2026-03-28 19:18:20 -07:00
defiQUG
141c8a278e Publish Chain 138 RPC capability metadata 2026-03-28 15:56:42 -07:00
defiQUG
6096804ee6 Polish explorer frontend validation and utility pages 2026-03-28 13:26:42 -07:00
defiQUG
26892ccbb9 Fix explorer routing, links, and frontend API loading 2026-03-28 00:21:18 -07:00
defiQUG
b5f9f7192e Move explorer AI key loading to secure secrets 2026-03-27 17:11:16 -07:00
defiQUG
ed1ad621b5 Switch explorer AI provider to Grok 2026-03-27 16:51:04 -07:00
defiQUG
3265e94da8 Harden explorer AI runtime and API ownership 2026-03-27 14:12:14 -07:00
defiQUG
2c6512f26d 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
d99c923f93 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
974687c723 chore: sync submodule state (parent ref update)
Made-with: Cursor
2026-03-02 12:14:13 -08:00
defiQUG
53114e75fd 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
2d43dcd2d4 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
88bc76da91 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
defiQUG
aafcd913c2 Initial commit: Chain 138 Explorer monorepo structure 2025-12-23 16:19:10 -08:00