Skip to content

Commit c6b262e

Browse files
authored
Merge branch 'main' into feat/89-mobile-ux-polish
2 parents 49feab5 + 32c9c51 commit c6b262e

60 files changed

Lines changed: 3963 additions & 169 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ jobs:
3939
- name: Record wasm SHA-256
4040
run: sha256sum target/wasm32-unknown-unknown/release/niffyinsure.wasm | tee niffyinsure.wasm.sha256
4141

42+
- name: Simulate wasm drift (staging acceptance test)
43+
run: |
44+
ACTUAL=$(cat niffyinsure.wasm.sha256 | awk '{print $1}')
45+
EXPECTED=$(jq -r '.contracts[0].expectedWasmHash' contracts/deployment-registry.json)
46+
# In CI the registry holds a placeholder; drift is detected when they differ.
47+
# In staging, set NIFFYINSURE_EXPECTED_WASM_HASH to a known-wrong value to
48+
# verify the alert path fires. Exit 0 here — alerting is runtime, not build-time.
49+
if [ "$EXPECTED" = "\${NIFFYINSURE_EXPECTED_WASM_HASH}" ]; then
50+
echo "Registry uses env placeholder — skipping drift comparison in CI"
51+
elif [ "$ACTUAL" != "$EXPECTED" ]; then
52+
echo "::warning::Wasm drift detected: expected=$EXPECTED actual=$ACTUAL"
53+
else
54+
echo "Wasm hash matches registry: $ACTUAL"
55+
fi
56+
4257
- uses: actions/upload-artifact@v4
4358
with:
4459
name: niffyinsure-wasm-${{ github.sha }}
@@ -84,6 +99,57 @@ jobs:
8499
- run: npm run build
85100
- run: npm test
86101

102+
# ── Dependency audit / supply-chain ─────────────────────────────────────
103+
# Policy: CRITICAL CVEs fail the build. HIGH CVEs produce a warning and
104+
# must be triaged within 7 days. Accepted risks require a signed-off entry
105+
# in docs/ops/audit-exceptions.md before the override label is applied.
106+
# Override process:
107+
# 1. Engineer opens a PR adding the CVE to audit-exceptions.md with
108+
# justification, mitigations, and a review-by date.
109+
# 2. A second engineer approves the PR.
110+
# 3. Add the GitHub label `audit-exception-approved` to the failing PR.
111+
# 4. Re-run this job — it will pass once the exception is documented.
112+
dependency-audit:
113+
name: Dependency Audit (npm / SBOM)
114+
runs-on: ubuntu-latest
115+
steps:
116+
- uses: actions/checkout@v4
117+
118+
- uses: actions/setup-node@v4
119+
with:
120+
node-version: 22
121+
122+
- name: Audit backend dependencies
123+
working-directory: backend
124+
run: |
125+
npm install --ignore-scripts
126+
# Fail on critical; warn on high (exit 0 so we can capture output)
127+
npm audit --audit-level=critical
128+
npm audit --audit-level=high || echo "::warning::High-severity advisories found — triage within 7 days per audit policy"
129+
130+
- name: Audit frontend dependencies
131+
working-directory: frontend
132+
run: |
133+
npm ci --ignore-scripts
134+
npm audit --audit-level=critical
135+
npm audit --audit-level=high || echo "::warning::High-severity advisories found — triage within 7 days per audit policy"
136+
137+
- name: Generate SBOM (backend)
138+
working-directory: backend
139+
run: npx --yes @cyclonedx/cyclonedx-npm --output-format JSON --output-file ../sbom-backend.json
140+
141+
- name: Generate SBOM (frontend)
142+
working-directory: frontend
143+
run: npx --yes @cyclonedx/cyclonedx-npm --output-format JSON --output-file ../sbom-frontend.json
144+
145+
- uses: actions/upload-artifact@v4
146+
with:
147+
name: sbom-${{ github.sha }}
148+
path: |
149+
sbom-backend.json
150+
sbom-frontend.json
151+
retention-days: 90
152+
87153
# ── Frontend ──────────────────────────────────────────────────────────────
88154
frontend:
89155
name: Frontend (Next.js / TypeScript)

BRANDING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# NiffyInsur Brand Guidelines
2+
3+
This document outlines the visual identity and styling standards for NiffyInsur.
4+
5+
## Color Palette
6+
7+
### Primary (Azure Blue)
8+
- **HSL**: `217 91% 60%`
9+
- **Hex**: `#3b82f6`
10+
- **Usage**: Buttons, links, primary brand elements.
11+
12+
### Secondary (Slate)
13+
- **HSL**: `222 47% 11%` (Foreground) / `0 0% 100%` (Background)
14+
- **Usage**: Typography, borders, subtle UI elements.
15+
16+
### Status Colors
17+
- **Success**: `142 71% 45%` (Green)
18+
- **Warning**: `48 96% 53%` (Yellow)
19+
- **Destructive**: `0 84% 60%` (Red)
20+
21+
## Typography
22+
23+
### Headings & Body
24+
- **Font**: [Inter](https://rsms.me/inter/)
25+
- **Weight**: 400 (Regular), 500 (Medium), 600 (Semi-Bold), 700 (Bold)
26+
27+
### Technical & Data
28+
- **Font**: [IBM Plex Mono](https://github.com/IBM/plex)
29+
- **Usage**: Addresses, transaction hashes, smart contract code, numbers.
30+
31+
## UI Principles
32+
33+
1. **Glassmorphism**: Use the `.glass` utility for cards and overlays to create depth.
34+
- Example: `<div className="glass rounded-lg p-6">...</div>`
35+
2. **Interactive States**:
36+
- **Hover**: Subtle scaling or opacity shift.
37+
- **Focus**: Clear Azure Blue ring (`focus-ring` utility).
38+
3. **Dark Mode**: Automatically respects system preferences, manual override available via `ThemeToggle`.
39+
40+
## Assets
41+
- **Logo Mark**: [icon.svg](/frontend/public/icon.svg)
42+
- **Manifest**: [site.webmanifest](/frontend/public/site.webmanifest)

backend/.env.example

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,14 @@ JWT_EXPIRES_IN=7d
4141
ADMIN_TOKEN=admin-token-for-cli
4242

4343
# CORS
44-
# Comma-separated list of allowed origins for the public API
45-
CORS_ORIGINS=http://localhost:3001
46-
# Comma-separated list of allowed origins for the admin UI (separate from public)
44+
# Comma-separated list of approved public frontend origins.
45+
# Local dev: use your Next.js dev server origin (e.g. http://localhost:3001).
46+
# Multiple origins: FRONTEND_ORIGINS=https://app.example.com,https://www.example.com
47+
# Production: all entries MUST start with https:// — http:// and wildcard * are rejected at startup.
48+
# Mobile app origins: add them here as additional comma-separated entries when needed.
49+
FRONTEND_ORIGINS=http://localhost:3001
50+
# Comma-separated list of allowed origins for the admin UI (optional, separate from public).
51+
# Leave empty if there is no separate admin UI.
4752
ADMIN_CORS_ORIGINS=http://localhost:3002
4853

4954
# Staff Auth (required in non-production)

backend/docs/feature-flags.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Backend Feature Flags Runbook
2+
3+
## Purpose
4+
Feature flags gate experimental backend routes at the API edge so unfinished modules are fully unreachable when disabled.
5+
6+
Safe default: any missing flag is treated as `false`.
7+
8+
## Configuration
9+
Set `FEATURE_FLAGS_JSON` as a JSON object at process start:
10+
11+
```bash
12+
FEATURE_FLAGS_JSON='{"experimental.oracleHooks":false,"experimental.betaCalculators":false}'
13+
```
14+
15+
Optional response strategy for disabled routes:
16+
17+
- `FEATURE_FLAGS_DISABLED_STATUS=404` (default, hides route existence)
18+
- `FEATURE_FLAGS_DISABLED_STATUS=403` (explicitly forbidden)
19+
20+
## Current Flags
21+
| Flag name | Default | Owner | Meaning |
22+
|---|---|---|---|
23+
| `experimental.oracleHooks` | `false` | Backend Platform Team | Enables `/experimental/oracle-hooks/*` ingestion hooks for oracle event experiments. |
24+
| `experimental.betaCalculators` | `false` | Underwriting Engine Team | Enables `/experimental/beta-calculators/*` premium preview APIs under validation. |
25+
26+
## Lifecycle
27+
1. Creation: add a single-purpose flag and owner in this document before merging code.
28+
2. Enablement: turn on only in non-production first, monitor error rate and access logs.
29+
3. Promotion: after stable metrics and review, enable for production rollout with change ticket.
30+
4. Removal: once fully adopted, delete guard/decorator usage and remove the flag from env + docs.
31+
32+
## Operational Guardrails
33+
- Feature flags do not replace authentication or authorization controls.
34+
- Keep total flag count low to avoid long-lived configuration sprawl.
35+
- Disabled-access attempts are logged (`FeatureFlagsGuard`) for metrics pipelines.

0 commit comments

Comments
 (0)