NAME
kekkai — Static site boundary & disclosure check. Headers, CSP, leaks — one file, zero dependencies.
SYNOPSIS
- version
- 1.9.0 ·
- status
- stable
- platform
- Node 18+ · CLI
- license
- GPL-3.0-or-later
- source
- github.com/kappa-yashi/kekkai
DESCRIPTION

Static site boundary & disclosure check.
In Japanese tradition, a kekkai (結界) is a protective barrier that defines a boundary and keeps unwanted elements out. This tool acts as a perimeter check for your static build: it scans a live URL or a build folder before deployment to verify strict security headers, a CSP that matches the actual HTML, zero stack disclosure in the output, and nothing served that should not be.
One file, zero dependencies, Node 18+. Reference stack: Astro, built to static files, on Cloudflare Pages (or any host that applies a _headers file at the edge: Netlify, etc.). The checks are framework-agnostic.
What it checks
Live URL (read-only GETs)
- http → https 301, apex → www 301 — www must be the primary host; apex as primary or both hosts answering is a warning (status codes, not bodies)
- HSTS (age, includeSubDomains, preload flagged as a decision)
- Content-Security-Policy: present, single (not two policies on one path),
script-srcwithout'unsafe-inline'/'unsafe-eval'/ wildcards / public CDNs,object-src 'none',base-uri,form-action,default-src,frame-ancestors - X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, COOP, CORP
Access-Control-Allow-Origin: *on documents and assets- Server / X-Powered-By version disclosure,
<meta name="generator"> - inline
<script>vs the CSP: every hash recomputed, blocked scripts reported;style=""vsstyle-src - JSON-LD parses; email addresses inside JSON-LD or text files (where email obfuscation cannot reach)
- third-party script origins; Subresource Integrity on every cross-origin script / stylesheet (
integrity=+crossorigin=) - inline event handlers (
onclick=,onload=…) vs the CSP - inline
<svg>carrying<script>/<style>/ external references; SVG files referenced by the page checked for scripts, handlers,<foreignObject> - source maps that are actually served
- canonical absolute and on the same host
- robots.txt advertising private paths, managed blocks prepended by the host
- sitemap listing private-looking or foreign-host URLs
- well-known leak paths (
.git/HEAD,.env,package.json, config files,wp-login.php,admin/…) with soft-404 detection - a sample of inner pages: CSP + HSTS present on every route, inline code consistent with each page’s own policy
/version.txtbuild fingerprint and whether it isno-store
Build folder (dist/ with its _headers)
- parses
_headers(Cloudflare/Netlify syntax, additive rules,!removals) and computes the effective headers of every HTML file - every HTML file covered by a CSP rule; no CSP under
/*colliding with a path CSP; apublic/_headersnext to a generated one - all header checks above, per header profile
- inline scripts hashed against the policy; inline styles vs
style-src - source maps and
sourceMappingURLcomments; lockfiles,.env, config,.git,README - local filesystem paths (
/home/x/,/Users/x/,C:\Users\x\) --forbid a,b,c: strings that must not appear (codenames, staging hosts)--admin <folder>: the CMS folder name must appear nowhere outside itself- repository links (listed, not judged: public release repos are content)
- email addresses in text files and inside
<script> - SRI, inline handlers and inline-SVG checks per header profile; every
.svgfile in the output scanned for<script>, handlers,<foreignObject>, external references _redirectsparsed: open redirects (https://:splat), staging / preview hosts, proxy rules to another origin, hostname rules that Pages cannot match
Repository (a git working copy; detected by .git, or --repo)
- tracked files that must never be tracked:
.env*,.dev.vars, keys and certificates,credentials.json, editor and agent settings with secrets .gitignorecoverage for.env*,.dev.vars,node_modules,dist, local settings- credential-shaped strings in every tracked text file and across the whole git history; env files ever committed
- docs that describe the security setup (access policies, login method, token scopes, OAuth apps), name staging hosts, or contain account email addresses
- code comments that describe a credential’s shape (“token (prefix …)”)
- AI footprint (every mode, as a warning): agent config files tracked or served, AI co-author commit trailers, “built with …” attribution — not a vulnerability, a targeting signal
Disclosure (live and build folder)
- known key prefixes, private key blocks, JWTs and secret assignments in the HTML, its JS/CSS and the usual
/version//changelogroutes - staging and preview hosts (
*.pages.dev,*.workers.dev,*.netlify.app…) in public output - vocabulary that describes the security setup; developer comments left in the HTML
Known incidents (every mode, via pwn.watch)
- repo: every
name@versionfrompackage-lock.json/pnpm-lock.yaml/yarn.lockmatched against the incident feed — patch-now advisories, breaches, supply-chain compromises. A version inside an affected range is a failure; an incident that names the package with a range the tool cannot parse is a warning to verify by hand - build folder and live: products visible in the output (generator meta,
Server/X-Powered-By,/_astro/,/_next/,wp-includes/…?ver=, versioned library paths, the CMS bundle, site builders) matched against open incidents, with the fixed version in the finding kekkai check <name>[@version] …— the decision gate: beforenpm installor before choosing a CMS / builder / platform, what pwn.watch has recorded for that name, open and closed, with fixed versions. A clean answer is “no news”, not “safe”- the feed is downloaded once per run with an ETag cache; nothing about the scanned site is sent anywhere. Unreachable → cached copy, or the check is skipped with an info line
Platform profile: Medusa (auto-detected, --platform medusa forces it)
A static storefront often sits on a Medusa backend — or on a custom commerce backend built on it, which inherits every Medusa issue and fix. The profile adds: in repo mode, medusa-config.* with fallback or literal jwtSecret / cookieSecret, catch-all CORS, literal databaseUrl, rejectUnauthorized: false, admin dashboard on the API host, mixed @medusajs/* versions, custom route groups without middleware, templates with real-looking values; on a live backend, publishable-key enforcement, /admin/* closed, dashboard at /app, CORS reflection of an unknown origin, API headers, config / env / upload-directory probes, stack traces; in a storefront (live or build folder), an sk_ secret key in client code and a local / staging backend URL baked into the bundle. --backend <url> scans storefront and backend in one pass; @medusajs/* versions feed the incident check as “medusa”.
Platform profile: Astro + headless Shopify (auto-detected, --platform shopify forces it)
Astro with output: 'server' on Cloudflare Workers and Shopify as the commerce backend. In repo mode: workers_dev / preview_urls left on, secrets as plain vars, tokens declared public in the env schema or read through PUBLIC_*, staff routes with no check in the middleware (protection only at the edge), webhooks without a constant-time signature check, answering GET or without dedupe, a Shopify API version past its support window, the private Storefront token or the Admin API in client code. In a build folder the SSR build is recognised and the report says how to scan a local preview without deploying. Live: tokens in client code, the *.myshopify.com twin storefront (open = a duplicate shop), img-src wider than cdn.shopify.com, forms to checkout blocked by form-action.
Also for every site: robots.txt Disallow paths are requested — if the server itself guards them (401/403, Access login, X-Robots-Tag: noindex) the line only advertises them; HTML comments that describe the build; public /version and /changelog pages that name backend services; --forbid hits in _headers / _redirects are info (not served); --private for private repositories; editor settings fail only when they hold credentials.
Options
--json machine-readable output
--strict warnings count as failures (exit 1)
--no-probe live: skip the leak-path probes
--pages N live: sample N inner pages from the sitemap (default 5)
--admin <folder> dist: the CMS/admin folder name
--forbid a,b,c strings that must not appear in the output
--no-history repo: skip the git-history scan
--repo | --dist force the mode for a folder
--accept-edge-inline a CDN-injected inline script the CSP already blocks is info, not warning
--summary only warnings and failures, one line each, plus counts
--out <file> also write the report (.json / .md / .txt)
--no-watch skip the known-incident check (no request to pwn.watch)
--watch-file <f> match against a saved incidents.json (offline / CI)
--platform medusa|shopify force a platform profile
--origin <ip|host> behind Cloudflare: check the origin directly
--subdomains check subdomains for dangling CNAMEs / takeover (asks crt.sh)
--subdomain-list a,b check these subdomains (no crt.sh request)
--private repo: the origin is private (docs / AI footprint → info)
--backend <url> storefront scan: also check this Medusa backend
Exit code 0 = boundary holds, 1 = boundary broken, 2 = usage.
Local preview with real headers
astro preview and python -m http.server do not apply _headers. The guide ships a 20-line serve.py that does; scan http://127.0.0.1:4399 and the transport checks are skipped automatically.
One boundary, two tools
kekkai asks what does the site give away? Its twin, senrigan (千里眼), asks what does the site fail to tell the machines that should find it? — titles, canonicals, hreflang, sitemap, structured data. A site nobody can find has failed as completely as one that was broken into; the breach announces itself, the invisibility never does. Every kekkai report ends with the senrigan command for the same target, and senrigan hands the transport findings (http, two hosts answering, mixed content, apex as primary) back to kekkai.
Build it right from the start: kekkai init
A scan at the end catches mistakes; cheaper is not making them. reference/build-rules.md is a DO/DON’T list, one rule per check, for whoever writes the code — you or your assistant. Give it to the assistant before the first component, and run npx github:kappa-yashi/kekkai init . --admin <cms-folder> in the project: it scaffolds scripts/kekkai-postbuild.mjs, which after astro build writes dist/_headers from the HTML that was actually built (one CSP block per route group, never under /*, cache rules, the CMS block with its own CSP, no-store and noindex), writes version.txt from package.json and the commit, strips comments from served .yml/.toml, and refuses a public/_headers. It also appends the .gitignore block and wires npm run build. A site written by the rules has nothing left for the scan.
The guide
reference/build-rules.md holds the rules to write by, and kekkai init copies them into a new project; reference/hardening.md is the long-form guide (headers template, two CSP strategies with code, build fingerprint, host-dashboard traps, leak audit, the threat model of a Git-based CMS).
Limits
- Not a vulnerability scanner for server-side applications.
- Cannot see your host dashboard (bot rules, Access policies, managed robots.txt); it only observes the effects.
- Nonces cannot be verified statically.
- Only scan sites you own or are allowed to test.
Licence
INSTALL
npx github:kappa-yashi/kekkai https://www.example.com
npx github:kappa-yashi/kekkai ./dist
npx github:kappa-yashi/kekkai ./repo
# start a project right: post-build _headers, version.txt, gitignore, build rules
npx github:kappa-yashi/kekkai init . --admin <cms-folder>
# before you adopt a package or platform: what pwn.watch knows about it
npx github:kappa-yashi/kekkai check [email protected] "sveltia cms"CHANGELOG
v1.9.0 ·
The not-found page is checked on a real unknown path: it must answer 404 with the same security headers as the home page (CSP, X-Frame-Options, nosniff, Referrer-Policy …). Cloudflare Pages and Netlify serve 404.html under the requested path, so per-path rules never reach it; in a build folder a 404.html that would lose its CSP is a warning. A path CSP that does not detach the /* one is still two policies. kekkai init: the site CSP now sits under /*, and the CMS block detaches it before setting its own.
v1.8.3 ·
Packaging: the public repository ships the scanner, `kekkai init`, the build rules and the guide.
v1.8.3 ·
Unknown URLs that redirect are reported as a soft 404. A _headers or _redirects served as a plain file is explained as a host that does not read it. Sites built and hosted on Lovable are recognised.
v1.8.1 ·
Single-page apps that answer every path with their shell are no longer reported as serving config files, changelogs or text files. CDN cookies are listed as the CDN's, not judged as the site's. Assets without a Cache-Control are flagged as information instead of passing.
v1.8.0 ·
Cookie scope in every live scan: cookies set for the whole domain (a warning when they look like sessions), missing Secure, SameSite=None, broken __Host- and __Secure- prefixes. Subdomain takeover with --subdomains (names from certificate transparency) or --subdomain-list: dangling CNAMEs and unclaimed services matched against the can-i-take-over-xyz fingerprints. Guide 8.4c.
v1.7.3 ·
Hosted platforms: an incident counts only when it is about the platform itself, and is reported as information — the vendor patches it. Repo checks follow relative imports one level. Edge-injected scripts name the Cloudflare feature and where to switch it off. An unreachable target is reported as NOT CHECKED, not as a broken boundary. A sitemap declared in robots.txt but missing from the build is a warning; other build-fingerprint routes are recognised.
v1.7.2 ·
Every report names the version that ran and warns when a newer release is out (one request to GitHub, cached for a day; --no-update-check skips it). --version.
v1.7.1 ·
TLS upkeep: certificate expiry, chain validity, TLS 1.0 / 1.1 still accepted. Behind Cloudflare: what Full (strict) needs, a redirect loop reported as the Flexible-mode signature, and --origin to check the origin itself — certificate ready for Full (strict), and whether it serves the site around Cloudflare. nginx: built-in error pages, status pages, directory listing, proxy headers that name internal addresses.
v1.7.0 ·
Self-hosted origins: the bare IP and the certificate's other names, nginx header inheritance, server and deploy files among the leak probes, distribution-patched versions as warnings instead of failures. Fewer false positives in the incident check (generator names, scoped packages), for .npmrc, local development connection strings and a staging host's own name. Guide 8.4b.
v1.6.0 ·
Second platform profile: Astro + headless Shopify — Workers config, tokens in the env schema and in client code, staff routes protected only at the edge, webhook signatures, API version age, the myshopify.com twin storefront, checkout against form-action; SSR builds recognised in build-folder mode. For every site: robots.txt cross-checked against what the server itself treats as private, HTML comments that describe the build, public changelog pages, host config files, private repositories, editor settings. Guide 8.4–8.5.
v1.5.0 ·
Known incidents via pwn.watch: in repo mode every lockfile entry (npm, pnpm, yarn) is matched against the incident feed — patch-now advisories, breaches, supply-chain compromises — and a version inside an affected range fails the scan; `kekkai check <name>[@version]` is the decision gate before adopting a package or platform; in build-folder and live mode the products visible in the output are matched against open incidents. The feed is downloaded once with an ETag cache; nothing about the site leaves the machine. --no-watch and --watch-file for offline and CI. Guide PART 7.8. First platform profile: Medusa — medusa-config secrets, CORS and admin checks in repo mode; Store/Admin API, dashboard and CORS-reflection checks on a live backend; sk_ keys and baked-in dev backend URLs in storefront bundles. Guide PART 8.
v1.4.1 ·
308 counts as a permanent redirect like 301; a credential assignment is reported only when the value looks like a credential (and every match is scanned, not just the first); a CSP that carries only frame-ancestors is one finding instead of six; inner-page issues shared by every sampled page collapse to one site-wide line.
v1.4.0 ·
www as the primary host — apex as primary, or both hosts answering, is a warning (cookie isolation from subdomains, CNAME-able for CDN and failover); every report now ends with the hand-off to senrigan for the same target; guide: one boundary, two tools.
v1.3.0 ·
Build mode: reference/build-rules.md (DO/DON'T, one rule per check) and `kekkai init`, which scaffolds a post-build script that generates _headers from the built HTML (one CSP block per route group, never under /*), version.txt, config-comment stripping and the .gitignore block.
v1.2.0 ·
CSP evaluated per spec (every policy on the response intersected, -elem/-attr fallbacks, nonce attributes, hash algorithms as listed, 'unsafe-inline' ignored next to hashes); comments in served config files; runtime CDN loads inside JavaScript; scripts writing into CMS folders; CMS page and public config checks in live mode; tag-manager hosts in script-src; redirects followed on inner pages; --summary and --out; edge-injected scripts are warnings.
v1.1.0 ·
Repository mode (tracked secrets, .gitignore, history, docs hygiene, AI footprint); disclosure scan in live and dist modes (key prefixes, staging hosts, security vocabulary, HTML comments); --repo/--dist flags; whole-token --forbid; guide PART 7 on what the repository itself discloses.
v1.0.0 ·
First release. Live and build-folder modes, Cloudflare/Netlify _headers and _redirects parsing, CSP hash verification, SRI, inline-handler and SVG checks, leak probes.
DEVLOG
Why You Can't Hack a Brick: From PHP2Shell and Digital Luddism to Static Stacks
AI didn't gain sentience, programmers just forgot to lock the door. PR stunts, the WordPress breach, and the superiority of Static architecture.
SEE ALSO
workspace-switcher@kappayashi(applet), wallpapers-2026-11(wallpapers), musiccontrols@kappayashi(applet), wallpapers(wallpapers), sessionManager@kappayashi(applet), separator@kappayashi(applet), idle-vector-scrnsvr(tool), senrigan(tool)
