From 65938a8d8432b4284a726f94e0062c4f984eee40 Mon Sep 17 00:00:00 2001 From: CriptoGus <128640021+criptogus@users.noreply.github.com> Date: Wed, 28 Oct 2026 08:19:42 -0300 Subject: [PATCH] Add nonce CSP, framing protection, and security.txt --- package.json | 1 + public/.well-known/security.txt | 5 ++ src/components/site/JsonLd.tsx | 4 + src/lib/csp-context.server.ts | 5 ++ src/lib/error-page.ts | 2 +- src/lib/response-security.server.ts | 38 ++++++++++ src/routeTree.gen.ts | 22 ++++++ src/router.tsx | 11 ++- src/routes/[.]well-known.security[.]txt.ts | 18 +++++ src/server.ts | 13 +++- tests/response-security.test.ts | 87 ++++++++++++++++++++++ 11 files changed, 203 insertions(+), 3 deletions(-) create mode 100644 public/.well-known/security.txt create mode 100644 src/lib/csp-context.server.ts create mode 100644 src/lib/response-security.server.ts create mode 100644 src/routes/[.]well-known.security[.]txt.ts create mode 100644 tests/response-security.test.ts diff --git a/package.json b/package.json index 0c3f342b..31b8fc94 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "trust:verify": "node --experimental-strip-types scripts/verify-trust-attestation.ts", "package:verify": "node --experimental-strip-types scripts/verify-package-signature.ts", "test": "npm run test:plain && npm run test:ts", + "test:security-headers": "node --experimental-strip-types --test tests/response-security.test.ts", "test:plain": "node --experimental-strip-types --test tests/adversarial-harness.test.ts tests/trust.test.ts tests/release-signing.test.ts tests/cli-install.test.ts tests/trust-attestation.test.ts", "test:ts": "node --experimental-strip-types --test tests/site-stats.test.ts tests/certify.test.ts tests/prompt-injection-guard.test.ts tests/audit-skills.test.ts tests/runtime.test.ts tests/integrations.test.ts tests/growth-revenue-split.test.ts tests/trust-badge.test.ts tests/bounties.test.ts tests/trust-scoring.test.ts tests/adversarial-holdout.test.ts tests/adversarial-judge.test.ts tests/paired-benchmark.test.ts tests/format-rubric.test.ts tests/lang-detect.test.ts tests/university.test.ts tests/package-signature.test.ts", "test:all": "node --experimental-strip-types --test tests/*.test.ts", diff --git a/public/.well-known/security.txt b/public/.well-known/security.txt new file mode 100644 index 00000000..1257081b --- /dev/null +++ b/public/.well-known/security.txt @@ -0,0 +1,5 @@ +Contact: mailto:contact@zeroagency.ai +Expires: 2027-04-28T00:00:00Z +Canonical: https://superagentskill.com/.well-known/security.txt +Preferred-Languages: en, pt-BR +Policy: https://github.com/criptogus/agent-evolve-network/blob/main/SECURITY.md diff --git a/src/components/site/JsonLd.tsx b/src/components/site/JsonLd.tsx index 1c00f876..82217d01 100644 --- a/src/components/site/JsonLd.tsx +++ b/src/components/site/JsonLd.tsx @@ -1,11 +1,15 @@ +import { useRouter } from "@tanstack/react-router"; + interface JsonLdProps { data: Record | Array>; } /** Renders a JSON-LD