-
Notifications
You must be signed in to change notification settings - Fork 0
fix(auth): fail closed without write-capable admin on public bind #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
cd063cc
fix(auth): fail closed without write-capable admin on public bind
seonghobae 300ec4e
docs: record PR #94 in the product-technical gap baseline
seonghobae 5baab54
feat(security): fail-closed destination policy for outbound HTTP
seonghobae e0892be
feat(waf): enforce proven-engine payloads for any client IP
seonghobae 868a7e5
chore(pr): remove unrelated destination and WAF drift
seonghobae c1b0372
test(auth): cover credential comparison and blank path regressions
seonghobae b69a22e
fix(auth): harden credential path and comparison invariants
seonghobae 96ca869
test(startup): prove state validation precedes readiness
seonghobae b9daeb5
fix(auth): generate a per-process smoke-test admin token
seonghobae f31d960
fix(startup): validate persisted state before reporting readiness
seonghobae ee72b1e
test(fuzz): cover strict admin token parser
seonghobae 75e950c
docs(gaps): correct snapshot and admin credential boundary
seonghobae b150132
docs(a11y): remove shared token example and correct target-size claims
seonghobae 5a62909
docs(a11y): make target-size evidence fail closed
seonghobae e811a0b
test(auth): reject whitespace-only admin token bootstrap
seonghobae 5014129
fix(auth): normalize whitespace-only admin credentials
seonghobae 341a385
fix(ci): apply rustfmt to credential regression test
seonghobae 9999e00
Merge branch 'main' into fix/issue-78-fail-closed-credentials
seonghobae 2b2ed4e
Merge branch 'main' into fix/issue-78-fail-closed-credentials
seonghobae 7c6dc3d
Merge branch 'main' into fix/issue-78-fail-closed-credentials
seonghobae e2d5c91
fix(auth): reject explicit blank file credentials
seonghobae 094f653
fix(auth): require literal loopback bind addresses
seonghobae d7fa9a1
docs(auth): clarify numeric loopback exception
seonghobae 2b1ab2d
Merge branch 'main' into fix/issue-78-fail-closed-credentials
seonghobae 0d2c495
merge(main): keep fail-closed public-bind auth with KEV catalog
seonghobae 7b13e0e
fix(auth): preserve state and write-gate semantics
codex a0cbcd5
docs(auth): clarify blank bootstrap path semantics
codex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| /target | ||
| /waf-ids-state*.json | ||
| /runtime-state*.json | ||
| /.codegraph |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to this project are documented in this file. | ||
|
|
||
| The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | ||
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| ## Unreleased | ||
|
|
||
| ### Security | ||
|
|
||
| - Fail closed before readiness when `BIND_ADDR` is not loopback-only and no write-capable admin principal is configured (`ADMIN_TOKEN`, `ADMIN_TOKENS`, or `WAF_IDS_CREDENTIALS_PATH`). Loopback development may still start without a token and reports `auth_mode=development` on `/healthz`. | ||
| - A blank `WAF_IDS_STATE_PATH` is treated as in-memory state instead of becoming ready and then failing to replace an empty path. | ||
| - Management writes now distinguish `401` (unauthenticated) from `403` (authenticated, not permitted to write) without naming the expected role. | ||
| - Presented admin secrets are compared in constant time, including when lengths differ by a multiple of 256. Duplicate, blank, and unknown `ADMIN_TOKENS` roles fail startup. A blank `WAF_IDS_CREDENTIALS_PATH` is treated as unset. | ||
| - `scripts/smoke.sh` generates a per-process admin token instead of embedding a shared secret (CWE-798). | ||
|
|
||
| ### Documentation | ||
|
|
||
| - Product/technical gap baseline at `docs/product-technical-gap-baseline.md` (open PRs/Issues inventory, operator-perceptible gaps, Figma file IDs, UI-UX areas). | ||
| - File://-openable admin-console scene and edge-case inventory at `docs/ui-ux/storybook-scene-inventory.md`. | ||
| - Figma file IDs recorded in `docs/adr/0001-figma-and-design-system.md` and `docs/architecture.md`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # ADR 0001 — Figma design-system source and embedded admin console | ||
|
|
||
| Status: accepted | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
|
||
| Date: 2026-08-23 | ||
|
|
||
| ## Context | ||
|
|
||
| Wardnet ships an operator console as vanilla HTML/CSS/JS embedded in the Rust | ||
| binary (`ADMIN_HTML` in `src/lib.rs`, served at `GET /` and `/admin`). Repeating | ||
| objects (KPI tiles, cards, tables, badges, buttons, forms, toasts) must stay | ||
| token-based. A Node Storybook toolchain cannot be loaded by that console without | ||
| a separate static site. | ||
|
|
||
| ## Decision | ||
|
|
||
| - Canonical design-system tokens live in CSS custom properties on `:root` | ||
| (`docs/design-system.md` matches the running `/admin` CSS). | ||
| - Figma is the visual mirror, not a runtime dependency. **Figma Code Connect is | ||
| not used** (repo `AGENTS.md`). | ||
| - Record file IDs here so operators and agents can open the same files. | ||
|
|
||
| ## Figma file IDs | ||
|
|
||
| | Artifact | File ID | URL | | ||
| | --- | --- | --- | | ||
| | Design system / console frames | `QTH5UuU0FJv2VyM2xb02Fp` | https://www.figma.com/design/QTH5UuU0FJv2VyM2xb02Fp | | ||
| | Enterprise product architecture FigJam | `JExziD87eUWKLERECUGhWQ` | https://www.figma.com/board/JExziD87eUWKLERECUGhWQ | | ||
|
|
||
| ## Scene and edge-case events | ||
|
|
||
| Scene-by-scene and edge-case event definitions for the ten UI-UX areas live in | ||
| `docs/ui-ux/storybook-scene-inventory.md`, which opens from disk (`file://`) | ||
| without a Node Storybook server. That inventory is the Storybook-equivalent | ||
| contract for this embedded-console architecture. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - Token changes must land in `ADMIN_HTML` and `docs/design-system.md` together. | ||
| - Do not add a frontend framework to `/admin`; it would break the | ||
| binary-embedded load path used by `scripts/smoke.sh`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Doctoring — fail-closed management authentication | ||
|
|
||
| This note grounds the issue #78 implementation (non-loopback listeners refuse to | ||
| become ready without a write-capable admin principal; `401` vs `403`; | ||
| constant-time secret compare). IEEE PDFs are not redistributed; freely licensed | ||
| standards are cited by URL. | ||
|
|
||
| ## Adopted standards and literature | ||
|
|
||
| Saltzer, J. H., & Schroeder, M. D. (1975). The protection of information in | ||
| computer systems. *Proceedings of the IEEE*, *63*(9), 1278–1308. | ||
| https://doi.org/10.1109/PROC.1975.9939 | ||
|
|
||
| - **Design impact:** Fail-safe defaults — a missing access rule is deny, not | ||
| allow. Wardnet previously treated an empty credential registry as “auth | ||
| disabled” for management writes. That violates fail-safe defaults as soon as | ||
| `BIND_ADDR` is not loopback-only. Startup now refuses readiness in that case. | ||
|
|
||
| OWASP Foundation. (2025). *OWASP Application Security Verification Standard | ||
| 5.0.0*. https://owasp.org/www-project-application-security-verification-standard/ | ||
|
|
||
| - **Design impact:** ASVS V6 authentication and V4 access control require | ||
| authentication for administrative functions and distinct authorization | ||
| outcomes. Management writes use `401` when no valid principal is presented and | ||
| `403` when a readonly principal attempts a mutation. Bodies do not name the | ||
| expected secret or role. | ||
|
|
||
| National Institute of Standards and Technology. (2022). *Secure Software | ||
| Development Framework (SSDF) version 1.1* (NIST SP 800-218). | ||
| https://doi.org/10.6028/NIST.SP.800-218 | ||
|
|
||
| - **Design impact:** PW.1 / PW.5 — produce well-secured software and protect | ||
| authentication data. Secrets bootstrap into `CredentialRegistry`; health | ||
| exposes `credentials_source` and `auth_mode` labels only. | ||
|
|
||
| MITRE. (n.d.). *CWE-306: Missing authentication for critical function*. | ||
| https://cwe.mitre.org/data/definitions/306.html | ||
|
|
||
| - **Design impact:** Management APIs that mutate routes, threat indicators, | ||
| DNSBL, license, and feeds are critical functions. The CWE-306 anti-pattern is | ||
| “auth optional on a reachable listener.” The shipped gate is | ||
| `require_write_auth_for_bind` in `src/credentials.rs`, invoked from | ||
| `run_from_env` before `TcpListener::bind`. | ||
|
|
||
| ## Exact-head binding | ||
|
|
||
| | Decision | Implementation | | ||
| | --- | --- | | ||
| | Fail closed on public bind | `require_write_auth_for_bind` + `run_from_env` | | ||
| | Loopback development remains usable | `listen_is_loopback_only`; `/healthz.auth_mode=development` | | ||
| | 401 vs 403 | `reject_management_write` | | ||
| | Constant-time compare | `constant_time_eq` mixes a length-inequality flag, not `(len ^ len) as u8` | | ||
| | Blank credentials path | empty/whitespace `WAF_IDS_CREDENTIALS_PATH` is unset | | ||
| | Smoke-test token | `scripts/smoke.sh` generates a per-process secret (CWE-798) | | ||
| | Ambiguous token registry | `parse_admin_tokens_strict` (duplicate / blank / unknown role) | | ||
|
|
||
| PII is **not** masked on security events: SOC operators cannot do their job if | ||
| client IPs, paths, and indicator values are redacted. Access control, audit, | ||
| and encryption-at-rest (when a durable store lands) are the alternatives to | ||
| masking. See `docs/product-technical-gap-baseline.md`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.