Three HIGH security findings resolved in _primitives/_rust/kei-forge/: - F-1: DNS rebinding — require_local_host middleware returns 421 on non-localhost Host headers - F-2: CSRF via urlencoded — require_json_content_type middleware returns 415 on non-JSON; form HTML now POSTs JSON via fetch() - crit#1/SA F-7: description sed injection — whitelist validator rejects newline/CR/tab/NUL/backtick/$/length>200, blocks the shell-script attack at the Rust layer - crit#11: missing security headers — CSP, X-Frame-Options DENY, X-Content-Type-Options nosniff, Referrer-Policy no-referrer on GET / Zero new deps (axum 0.7 middleware::from_fn + HeaderMap native). Constructor Pattern compliant — 6 Cube files, largest 231 LOC including tests. Tests: 29/29 (was 12/12; +17 new). Includes 4 adversarial integration tests for each defence layer. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
21 lines
845 B
Rust
21 lines
845 B
Rust
//! kei-forge — local web wizard for scaffolding new atoms per the locked
|
|
//! SUBSTRATE-SCHEMA.md contract.
|
|
//!
|
|
//! Architecture (Constructor Pattern, one responsibility per file):
|
|
//! - [`server`] — axum router + handlers
|
|
//! - [`middleware`] — DNS-rebinding + CSRF defences
|
|
//! - [`headers`] — CSP / nosniff / frame-deny / referrer headers
|
|
//! - [`html`] — static HTML form (JSON-over-fetch)
|
|
//! - [`form`] — request deserialization + validation
|
|
//! - [`generate`] — invoke scripts/new-atom.sh, parse output
|
|
//!
|
|
//! Public entry point is [`server::app`], which returns the fully-wired
|
|
//! `axum::Router` ready to be served by any bind target (production =
|
|
//! 127.0.0.1:8747; tests = random ephemeral port).
|
|
|
|
pub mod form;
|
|
pub mod generate;
|
|
pub mod headers;
|
|
pub mod html;
|
|
pub mod middleware;
|
|
pub mod server;
|