Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/nightly-security-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Nightly Security & Mutation Audit

on:
schedule:
# Triggers every single night at 02:00 UTC
- cron: '0 2 * * *'
workflow_dispatch: # Allows manual trigger for verification

permissions:
contents: write

jobs:
audit:
name: Run Security and Mutation Suite
runs-on: ubuntu-latest

steps:
- name: Checkout Code Repository
uses: actions/checkout@v4

- name: Install Rust Toolchain (Nightly)
uses: dtolnay/rust-toolchain@nightly

- name: Cache Cargo Dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-nightly-${{ hashFiles('**/Cargo.lock') }}

- name: Install Utility Tooling Engines
run: |
cargo install cargo-deny --locked || true
cargo install cargo-audit --locked || true
cargo install cargo-mutants --locked || true

- name: Initialize or Clear Audit Log File
run: |
echo "# 🛡️ Automated Security & Mutation Audit Log" > AUDIT_LOG.md
echo "Generated on: $(date -u)" >> AUDIT_LOG.md
echo "---" >> AUDIT_LOG.md

- name: Execute Cargo Deny Checks
run: |
echo "## 📦 Dependency License & Advisory Checks (cargo-deny)" >> AUDIT_LOG.md
echo "\`\`\`text" >> AUDIT_LOG.md
cargo deny check licenses bans sources 2>&1 >> AUDIT_LOG.md || echo "cargo-deny failed or flagged warnings" >> AUDIT_LOG.md
echo "\`\`\`" >> AUDIT_LOG.md
echo "---" >> AUDIT_LOG.md

- name: Execute Cargo Audit Sweeps
run: |
echo "## 🔍 Vulnerability Advisory Scans (cargo-audit)" >> AUDIT_LOG.md
echo "\`\`\`text" >> AUDIT_LOG.md
cargo audit 2>&1 >> AUDIT_LOG.md || echo "cargo-audit detected critical vulnerability markers" >> AUDIT_LOG.md
echo "\`\`\`" >> AUDIT_LOG.md
echo "---" >> AUDIT_LOG.md

- name: Execute Cargo Mutants Quality Runs
run: |
echo "## 🧬 Mutation Testing Resilience Analytics (cargo-mutants)" >> AUDIT_LOG.md
echo "\`\`\`text" >> AUDIT_LOG.md
cargo mutants --all-features 2>&1 >> AUDIT_LOG.md || echo "cargo-mutants flagged missed mutant structures" >> AUDIT_LOG.md
echo "\`\`\`" >> AUDIT_LOG.md

- name: Commit and Push Security Results to Repo
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add AUDIT_LOG.md
git diff-index --quiet HEAD || git commit -m "chore(ci): update nightly AUDIT_LOG.md validation tracking profiles [skip ci]"
git push origin HEAD:${{ github.ref }}
46 changes: 46 additions & 0 deletions .github/workflows/smoke-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Smoke CI Gate

on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]

permissions:
contents: read

jobs:
smoke-test:
name: Code Quality & Testing Suite
runs-on: ubuntu-latest

steps:
- name: Checkout Code Repository
uses: actions/checkout@v4

- name: Install Stable Rust Toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache Cargo Build Artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-smoke-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-smoke-

- name: Check Code Formatting Style (fmt)
run: cargo fmt --check

- name: Execute Static Analysis Compiler Lints (clippy)
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Run Core Verification Tests (test)
run: cargo test --all-features --workspace
1 change: 1 addition & 0 deletions cv-project
Submodule cv-project added at a3e7ec
14 changes: 14 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,17 @@ unknown-git = "warn"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
allow-git = []

[licenses]
unlicensed = "deny"
allow = [
"MIT",
"Apache-2.0",
"BSD-3-Clause",
]

[bans]
multiple-versions = "warn"

[sources]
unknown-registry = "deny"
unknown-git = "deny"
1 change: 1 addition & 0 deletions project_modern_ui_ux_gpt3
Submodule project_modern_ui_ux_gpt3 added at a201ed
84 changes: 64 additions & 20 deletions propchain-dashboard/src/InsuranceAnalyticsDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Percent,
ShieldCheck,
TrendingUp,
Users,
} from 'lucide-react';
import {
Area,
Expand Down Expand Up @@ -42,7 +43,6 @@ const getClaimRatio = (claimsPaid, premiumsCollected) => {
if (!premiumsCollected) {
return 0;
}

return (claimsPaid / premiumsCollected) * 100;
};

Expand All @@ -57,23 +57,41 @@ const MetricCard = ({ icon: Icon, label, value, detail, tone }) => (
</div>
);

const InsuranceAnalyticsDashboard = () => {
const InsuranceAnalyticsDashboard = ({ connectedAccounts = [] }) => {
// State to manage the active multi-account context selector
const [selectedAccount, setSelectedAccount] = useState(connectedAccounts[0] || '');
const [analytics, setAnalytics] = useState(null);
const [lastUpdated, setLastUpdated] = useState(null);
const [loading, setLoading] = useState(false);

useEffect(() => {
// Fallback or update selection if the passed parent array drops or mutates
if (connectedAccounts.length > 0 && !connectedAccounts.includes(selectedAccount)) {
setSelectedAccount(connectedAccounts[0]);
}
}, [connectedAccounts, selectedAccount]);

useEffect(() => {
const loadAnalytics = () => {
fetchInsuranceAnalytics().then((result) => {
setAnalytics(result);
setLastUpdated(new Date());
});
setLoading(true);
// Pass the explicitly selected account string to slice contextual metrics
fetchInsuranceAnalytics(selectedAccount)
.then((result) => {
setAnalytics(result);
setLastUpdated(new Date());
setLoading(false);
})
.catch((err) => {
console.error("Failed to load insurance analytics metrics profile:", err);
setLoading(false);
});
};

loadAnalytics();
const interval = setInterval(loadAnalytics, 30000);

return () => clearInterval(interval);
}, []);
}, [selectedAccount]); // Re-execute every time the active account context is flipped

const summary = useMemo(() => {
if (!analytics) {
Expand All @@ -98,30 +116,54 @@ const InsuranceAnalyticsDashboard = () => {
};
}, [analytics]);

if (!analytics || !summary) {
if (!analytics || !summary || loading) {
return (
<section className="rounded-lg border border-slate-700 bg-slate-900 p-6">
<p className="text-sm text-slate-400">Loading insurance analytics...</p>
<section className="rounded-lg border border-slate-700 bg-slate-900 p-6 flex items-center justify-between">
<p className="text-sm text-slate-400 animate-pulse">
Syncing regional risk pools and account ledger mappings...
</p>
</section>
);
}

return (
<section className="space-y-6" aria-labelledby="insurance-analytics-title">
<div className="flex flex-col gap-2 border-b border-slate-700 pb-4 md:flex-row md:items-end md:justify-between">
<div className="flex flex-col gap-4 border-b border-slate-700 pb-4 md:flex-row md:items-end md:justify-between">
<div>
<p className="text-sm font-medium text-sky-300">Insurance</p>
<p className="text-sm font-medium text-sky-300">Insurance Stack Analytics</p>
<h2 id="insurance-analytics-title" className="text-2xl font-bold text-white">
Insurance Analytics Dashboard
Risk & Portfolio Matrix Dashboard
</h2>
</div>
{lastUpdated && (
<p className="text-xs text-slate-500">
Last updated: {lastUpdated.toLocaleTimeString()}
</p>
)}

{/* Multi-Account Wallet Context Switcher Menu Control */}
<div className="flex flex-col gap-2 sm:flex-row sm:items-center">
{lastUpdated && (
<p className="text-xs text-slate-500 sm:text-right pr-2">
Last synced: {lastUpdated.toLocaleTimeString()}
</p>
)}
{connectedAccounts.length > 0 && (
<div className="flex items-center gap-2 rounded-md bg-slate-950 border border-slate-800 px-3 py-1.5">
<Users className="h-4 w-4 text-indigo-400" aria-hidden="true" />
<select
id="insurance-account-view-selector"
className="bg-transparent text-xs font-mono text-indigo-300 focus:outline-none cursor-pointer"
value={selectedAccount}
onChange={(e) => setSelectedAccount(e.target.value)}
>
{connectedAccounts.map((account) => (
<option key={account} value={account} className="bg-slate-950 text-white">
{account.slice(0, 6)}...{account.slice(-4)}
</option>
))}
</select>
</div>
)}
</div>
</div>

{/* Metrics Breakdown Grid */}
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4">
<MetricCard
icon={ShieldCheck}
Expand Down Expand Up @@ -153,12 +195,13 @@ const InsuranceAnalyticsDashboard = () => {
/>
</div>

{/* Charts Grid Block */}
<div className="grid grid-cols-1 gap-6 xl:grid-cols-3">
<div className="rounded-lg border border-slate-700 bg-slate-900/80 p-5 xl:col-span-2">
<div className="mb-5 flex items-center justify-between gap-3">
<div>
<h3 className="text-base font-semibold text-white">Premiums vs Claims</h3>
<p className="text-sm text-slate-400">Monthly loss-ratio trend</p>
<p className="text-sm text-slate-400">Monthly loss-ratio trend context</p>
</div>
<TrendingUp className="h-5 w-5 text-emerald-300" aria-hidden="true" />
</div>
Expand Down Expand Up @@ -239,6 +282,7 @@ const InsuranceAnalyticsDashboard = () => {
</div>
</div>

{/* Utilization and Exposure Details */}
<div className="grid grid-cols-1 gap-6 xl:grid-cols-3">
<div className="rounded-lg border border-slate-700 bg-slate-900/80 p-5 xl:col-span-2">
<div className="mb-5">
Expand Down Expand Up @@ -303,4 +347,4 @@ const InsuranceAnalyticsDashboard = () => {
);
};

export default InsuranceAnalyticsDashboard;
export default InsuranceAnalyticsDashboard;
Loading
Loading