diff --git a/.machine_readable/root-allow.txt b/.machine_readable/root-allow.txt index 4b2d27da..efa51790 100644 --- a/.machine_readable/root-allow.txt +++ b/.machine_readable/root-allow.txt @@ -1,4 +1,3 @@ .hypatia-ignore CLAUDE.md build/ # build orchestration: guix.scm relocated here (canon 1.2.1 guix-primary template_ref = "build/") -archive/ # quarantine for dead sources (2026-11-01; Logtalk, see archive/logtalk/README.adoc) diff --git a/.reuse/dep5 b/.reuse/dep5 index 2cd4af30..af510e62 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -29,7 +29,6 @@ Files: src/* docs-site/* generated/* schemas/* - archive/* training_data/* deploy/* container/* diff --git a/Cargo.lock b/Cargo.lock index 5f8b6c37..8db457f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -401,12 +401,6 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" -[[package]] -name = "base64ct" -version = "1.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" - [[package]] name = "bit-set" version = "0.8.0" @@ -664,12 +658,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - [[package]] name = "const-oid" version = "0.10.2" @@ -802,18 +790,17 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.3" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +checksum = "94c1aa5a9b7626ed65ac0cf5ea9d4f1547af89017fbac20bd4de40022fff516f" dependencies = [ "cfg-if", - "cpufeatures 0.2.17", + "cpufeatures 0.3.0", "curve25519-dalek-derive", - "digest 0.10.7", + "digest 0.11.3", "fiat-crypto", "rustc_version", "subtle", - "zeroize", ] [[package]] @@ -936,16 +923,6 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8" -[[package]] -name = "der" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" -dependencies = [ - "const-oid 0.9.6", - "zeroize", -] - [[package]] name = "derive_builder" version = "0.20.2" @@ -1000,7 +977,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ "block-buffer 0.12.0", - "const-oid 0.10.2", + "const-oid", "crypto-common 0.2.2", ] @@ -1178,26 +1155,23 @@ dependencies = [ [[package]] name = "ed25519" -version = "2.2.3" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +checksum = "29fcf32e6c73d1079f83ab4d782de2d81620346a5f38c6237a86a22f8368980a" dependencies = [ - "pkcs8", "signature", ] [[package]] name = "ed25519-dalek" -version = "2.2.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +checksum = "6ebaa1a2bf1290ab3bfe5a7b771d050ebffab2711c19a81691c683a5144a25de" dependencies = [ "curve25519-dalek", "ed25519", - "serde", - "sha2 0.10.9", + "sha2 0.11.0", "subtle", - "zeroize", ] [[package]] @@ -1272,9 +1246,9 @@ checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" [[package]] name = "fiat-crypto" -version = "0.2.9" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" +checksum = "64cd1e32ddd350061ae6edb1b082d7c54915b5c672c389143b9a63403a109f24" [[package]] name = "find-msvc-tools" @@ -1302,9 +1276,9 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "form_urlencoded" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e" dependencies = [ "percent-encoding", ] @@ -2318,16 +2292,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - [[package]] name = "plotters" version = "0.3.7" @@ -2657,15 +2621,6 @@ dependencies = [ "rand_core 0.9.5", ] -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", -] - [[package]] name = "rand_core" version = "0.9.5" @@ -2904,9 +2859,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.4" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ "bitflags", "errno", @@ -3215,12 +3170,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.2.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "rand_core 0.6.4", -] +checksum = "28d567dcbaf0049cb8ac2608a76cd95ff9e4412e1899d389ee400918ca7537f5" [[package]] name = "simba" @@ -3262,16 +3214,6 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -3393,7 +3335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.2", "once_cell", "rustix", "windows-sys 0.52.0", @@ -3907,9 +3849,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.8" +version = "2.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a" dependencies = [ "form_urlencoded", "idna", diff --git a/Cargo.toml b/Cargo.toml index b4c1f0e5..5b5fdf9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -97,7 +97,7 @@ nalgebra = "0.35" sha2 = "0.11" # Ed25519 signature verification (Apache-2.0 / MIT, MPL-2.0 compat). -ed25519-dalek = { version = "2", default-features = false, features = ["std"] } +ed25519-dalek = { version = "3", default-features = false } # DSP coprocessor — FFT/IFFT (Apache-2.0 / MIT). rustfft = "6" diff --git a/archive/logtalk/README.adoc b/archive/logtalk/README.adoc deleted file mode 100644 index 5f459dc2..00000000 --- a/archive/logtalk/README.adoc +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: CC-BY-SA-4.0 -// SPDX-FileCopyrightText: 2026 ECHIDNA Project Contributors - -= Quarantine: Logtalk sources - -*Status*: dead source, retained as a record. *Quarantined*: 2026-11-01. -*Read this first*: nothing here is built, imported, tested or shipped. - -== Contents - -[width="100%",cols="38%,62%",options="header"] -|=== -|File |Status - -|`+security_learning.lgt+` -|DEAD. Was `+rules/security_learning.lgt+`, the only Logtalk module in the -tree (234 lines, two objects, dated 2025-12-29). Body unchanged; a -`+DEAD SOURCE+` header records the evidence. -|=== - -== Why it is here and not in `+rules/+` - -Four questions decided it, and each one alone would have been enough: - -. *Nothing loaded it.* No test, workflow, Justfile recipe, A2ML manifest or - Cargo build step named the file. `+grep -rn '\.lgt' --exclude-dir=.git .+` - returned it and one self-reference inside it. No Logtalk runtime is - installed in CI, and none is declared anywhere. -. *Its input was a machine-local path.* `+cicd_repo_path('~/repos/cicd-hyper-a/.audittraining')+` - — a literal `+~+` in a path the module opens. -. *Its learning step cannot learn.* `+load_training_data/1+` reads Prolog - terms with `+read/2+`, but the catalog it is pointed at is Scheme - (`+ERROR-CATALOG.scm+`). Every term reaches the catch-all clause - `+process_training_term(_)+`, so `+learn_rules/0+` re-asserts the static - tables already in the file. The output is a transcript of the input - constants. -. *The estate moved.* Rule authoring is Elixir in - https://github.com/hyperpolymath/hypatia[hypatia]. ECHIDNA is a Hypatia - *target* (`.hypatia-baseline.json`, `.hypatia-ignore`), never a Logtalk - rule producer. The prose that described Logtalk generation was retired in - `+docs/ECOSYSTEM-INTEGRATION.adoc+` and - `+echidna-playground/.machine_readable/descriptiles/NEUROSYM.a2ml+` in the - same change. - -`+rules/+` was removed rather than left empty, so that the tree cannot imply -by its shape that ECHIDNA carries rules in Logtalk. - -The full audit, including the path classification and the reproduction -commands, is -link:../../docs/reports/2026-11-01-routing-and-rule-engine-recon.adoc[`+docs/reports/2026-11-01-routing-and-rule-engine-recon.adoc+`] -§4. - -== What it would take to revive this - -Not a rename and not a wrapper. All five, or it stays dead: - -. A Logtalk or compatible Prolog runtime in CI, pinned the way every other - toolchain in this repo is pinned. -. A parameterised input path — no `+~+`, no home directory. -. A real parser for whatever format the catalog actually is, with a fixture - test per term shape. -. A named consumer in this repository or a sibling, with a contract. -. A reason not to write it in Elixir like the rest of the estate's rules. - -== Licence - -MPL-2.0, unchanged, per the `+SPDX-License-Identifier+` header in the file -and the `+Files: archive/*+` stanza in `+.reuse/dep5+`. diff --git a/archive/logtalk/security_learning.lgt b/archive/logtalk/security_learning.lgt deleted file mode 100644 index baa21052..00000000 --- a/archive/logtalk/security_learning.lgt +++ /dev/null @@ -1,257 +0,0 @@ -%% SPDX-License-Identifier: MPL-2.0 -%% -%% =========================================================================== -%% DEAD SOURCE — quarantined 2026-11-01, body unchanged. -%% -%% This file was `rules/security_learning.lgt`, the only Logtalk module in the -%% ECHIDNA tree. Nothing loaded it: no test, workflow, Justfile recipe, A2ML -%% manifest or Cargo build step referenced it, and no Logtalk runtime is -%% installed anywhere in CI. Its input path was a literal `~/repos/...` on one -%% machine, and its "learning" step reads Prolog terms from a Scheme catalog -%% (ERROR-CATALOG.scm), so every term falls through to the catch-all clause and -%% the learned rules are a re-assertion of the static tables below. -%% -%% Estate rule authoring moved to Elixir rule modules in Hypatia. ECHIDNA is a -%% Hypatia *target* (.hypatia-baseline.json, .hypatia-ignore), not a rule -%% producer — the cicd-hyper-a alert taxonomy this file encodes is no longer -%% the path by which ECHIDNA-side rules reach the estate. -%% -%% Kept rather than deleted so the record is byte-recoverable. Do not add to -%% it, do not wire it up. Reviving it needs, at minimum: a runtime in CI, a -%% parameterised input path, a real parser for the catalog format, and a -%% consumer. See ./README.adoc and -%% docs/reports/2026-11-01-routing-and-rule-engine-recon.adoc §4. -%% =========================================================================== -%% -%% ECHIDNA Security Rule Learning Module -%% Learns security patterns from cicd-hyper-a audit data - -:- object(security_learning). - - :- info([ - version is 1:'0':'0', - author is 'ECHIDNA Project Team', - date is 2025-12-29, - comment is 'Neurosymbolic learning module for security rule extraction' - ]). - - %% Public predicates - :- public([ - load_training_data/1, % Load from cicd-hyper-a - learn_rules/0, % Learn rules from loaded data - export_rules/1, % Export learned rules - suggest_fix/2, % Suggest fix for alert type - classify_severity/2, % Classify alert severity - is_auto_fixable/1, % Check if auto-fixable - get_prevention_workflow/2 % Get prevention workflow for alert type - ]). - - :- private([ - training_data/3, % Stored training examples - learned_rule/4, % Learned rules - fix_pattern/3 % Fix patterns - ]). - - :- dynamic([ - training_data/3, - learned_rule/4, - fix_pattern/3 - ]). - - %% ============================================================ - %% Core Alert Categories (from ERROR-CATALOG.scm) - %% ============================================================ - - alert_category('TokenPermissionsID', workflow_security). - alert_category('PinnedDependenciesID', workflow_security). - alert_category('missing-workflow-permissions', workflow_security). - - alert_category('hard-coded-cryptographic-value', code_security). - alert_category('remote-property-injection', code_security). - alert_category('sql-injection', code_security). - - alert_category('unused-local-variable', code_quality). - alert_category('syntax-error', code_quality). - - alert_category('VulnerabilitiesID', dependency_vuln). - alert_category('unmaintained', dependency_vuln). - - alert_category('SecurityPolicyID', process_hygiene). - alert_category('MaintainedID', process_hygiene). - alert_category('CodeReviewID', process_hygiene). - alert_category('BranchProtectionID', process_hygiene). - alert_category('CIIBestPracticesID', process_hygiene). - - alert_category('FuzzingID', missing_tests). - alert_category('SASTID', missing_tests). - alert_category('CITestsID', missing_tests). - - %% ============================================================ - %% Severity Classification - %% ============================================================ - - classify_severity(AlertType, critical) :- - member(AlertType, [ - 'hard-coded-cryptographic-value', - 'sql-injection', - 'VulnerabilitiesID' - ]), !. - - classify_severity(AlertType, high) :- - member(AlertType, [ - 'remote-property-injection', - 'TokenPermissionsID', - 'missing-workflow-permissions' - ]), !. - - classify_severity(AlertType, medium) :- - member(AlertType, [ - 'PinnedDependenciesID', - 'SecurityPolicyID', - 'BranchProtectionID', - 'CodeReviewID', - 'syntax-error' - ]), !. - - classify_severity(_, low). - - %% ============================================================ - %% Auto-Fixable Detection - %% ============================================================ - - is_auto_fixable('TokenPermissionsID'). - is_auto_fixable('PinnedDependenciesID'). - is_auto_fixable('missing-workflow-permissions'). - is_auto_fixable('SecurityPolicyID'). - is_auto_fixable('BranchProtectionID'). - is_auto_fixable('unused-local-variable'). - - %% ============================================================ - %% Fix Suggestions - %% ============================================================ - - suggest_fix('TokenPermissionsID', 'Add "permissions: read-all" at workflow level'). - suggest_fix('PinnedDependenciesID', 'Replace @v4 with @SHA # v4 format'). - suggest_fix('missing-workflow-permissions', 'Add "permissions: read-all" at workflow level'). - suggest_fix('SecurityPolicyID', 'Create SECURITY.md with vulnerability reporting instructions'). - suggest_fix('BranchProtectionID', 'Enable branch protection via Settings > Branches'). - suggest_fix('CodeReviewID', 'Require at least 1 approving review before merge'). - suggest_fix('CIIBestPracticesID', 'Register at bestpractices.coreinfrastructure.org'). - suggest_fix('FuzzingID', 'Add ClusterFuzzLite or cargo-fuzz infrastructure'). - suggest_fix('VulnerabilitiesID', 'Run cargo audit / npm audit and update dependencies'). - suggest_fix('hard-coded-cryptographic-value', 'Use environment variables or secrets manager'). - suggest_fix('remote-property-injection', 'Add allowlist validation for dynamic property access'). - suggest_fix('unused-local-variable', 'Remove unused code or prefix with underscore'). - suggest_fix('syntax-error', 'Fix syntax error using linter output'). - - %% ============================================================ - %% Prevention Workflows - %% ============================================================ - - get_prevention_workflow('TokenPermissionsID', 'workflow-linter.yml'). - get_prevention_workflow('PinnedDependenciesID', 'workflow-linter.yml'). - get_prevention_workflow('missing-workflow-permissions', 'workflow-linter.yml'). - get_prevention_workflow('hard-coded-cryptographic-value', 'secret-scanner.yml'). - get_prevention_workflow('VulnerabilitiesID', 'cargo-audit.yml'). - get_prevention_workflow('SecurityPolicyID', 'scorecard-enforcer.yml'). - get_prevention_workflow('BranchProtectionID', 'branch-protection-enforcer.yml'). - - %% ============================================================ - %% Learning from Training Data - %% ============================================================ - - %% Load training data from cicd-hyper-a ERROR-CATALOG.scm - load_training_data(FilePath) :- - open(FilePath, read, Stream), - read_training_examples(Stream), - close(Stream). - - read_training_examples(Stream) :- - read(Stream, Term), - ( Term == end_of_file -> - true - ; process_training_term(Term), - read_training_examples(Stream) - ). - - process_training_term(error(Id, Type, Severity, AutoFix, Description, Fix)) :- - assertz(training_data(Id, Type, fix(Description, Fix, AutoFix))), - assertz(learned_rule(Id, Type, Severity, AutoFix)). - - process_training_term(_). % Ignore unknown terms - - %% Learn rules by analyzing training data patterns - learn_rules :- - findall( - rule(AlertType, Category, Severity, AutoFix), - ( - training_data(AlertType, Category, _), - classify_severity(AlertType, Severity), - (is_auto_fixable(AlertType) -> AutoFix = true ; AutoFix = false) - ), - Rules - ), - forall( - member(rule(A, C, S, F), Rules), - assertz(learned_rule(A, C, S, F)) - ). - - %% Export learned rules to file - export_rules(FilePath) :- - open(FilePath, write, Stream), - write(Stream, '%% Learned security rules\n'), - write(Stream, '%% Generated by ECHIDNA security_learning module\n\n'), - forall( - learned_rule(AlertType, Category, Severity, AutoFix), - ( - format(Stream, 'security_rule(~q, ~q, ~q, ~q).~n', - [AlertType, Category, Severity, AutoFix]) - ) - ), - close(Stream). - -:- end_object. - - -%% ============================================================ -%% Integration with cicd-hyper-a -%% ============================================================ - -:- object(cicd_integration). - - :- info([ - version is 1:'0':'0', - comment is 'Integration layer between cicd-hyper-a and ECHIDNA' - ]). - - :- public([ - sync_from_cicd/0, % Sync training data from cicd-hyper-a - push_rules_to_cicd/0, % Push learned rules back - validate_alert/2 % Validate an alert against learned rules - ]). - - %% Path to cicd-hyper-a repository - cicd_repo_path('~/repos/cicd-hyper-a/.audittraining'). - - %% Sync training data from cicd-hyper-a - sync_from_cicd :- - cicd_repo_path(BasePath), - atom_concat(BasePath, '/ERROR-CATALOG.scm', CatalogPath), - security_learning::load_training_data(CatalogPath), - security_learning::learn_rules. - - %% Push learned rules back to cicd-hyper-a - push_rules_to_cicd :- - cicd_repo_path(BasePath), - atom_concat(BasePath, '/echidna-rules.lgt', RulesPath), - security_learning::export_rules(RulesPath). - - %% Validate an alert - validate_alert(AlertType, Result) :- - security_learning::classify_severity(AlertType, Severity), - security_learning::suggest_fix(AlertType, Fix), - (security_learning::is_auto_fixable(AlertType) -> - AutoFix = true ; AutoFix = false), - Result = alert_validation(AlertType, Severity, Fix, AutoFix). - -:- end_object. diff --git a/docs/DEBT.adoc b/docs/DEBT.adoc index 1c9953ba..481df392 100644 --- a/docs/DEBT.adoc +++ b/docs/DEBT.adoc @@ -531,12 +531,6 @@ git grep -n 'docs-site' -- .github/workflows Justfile '*.toml' '*.sh' * `+container/compose.toml+` healthcheck probed `+/health+` and `+container/vordr.toml+` probed `+/health+` and `+/ready+`; the core server serves `+/api/health+` and never had `+/ready+`. -* `+rules/security_learning.lgt+` had no in-tree consumer; - quarantined to `+archive/logtalk/+` with a `+DEAD SOURCE+` header. See that - directory's README. -* `+docs/ECOSYSTEM-INTEGRATION.adoc+` and - `+echidna-playground/.machine_readable/descriptiles/NEUROSYM.a2ml+` claimed - Hypatia emits Logtalk rules. It emits Elixir rules. ''''' diff --git a/docs/ECOSYSTEM-INTEGRATION.adoc b/docs/ECOSYSTEM-INTEGRATION.adoc index 47c91a5b..45e3e523 100644 --- a/docs/ECOSYSTEM-INTEGRATION.adoc +++ b/docs/ECOSYSTEM-INTEGRATION.adoc @@ -117,14 +117,8 @@ Hypatia generates findings in shared context 3. Learning engine observes patterns (unsafe_panic, eval_usage, etc.) 4. Emits Elixir rule modules after 5+ observations 5. Proposes new detection rules via PRs -*Correction (2026-11-01)*: this step previously said "Auto-generates -Logtalk rules". Hypatia's rule engine is Elixir, and ECHIDNA is a Hypatia -*target* — `.hypatia-baseline.json` and `.hypatia-ignore` — not a Logtalk -rule producer. The one Logtalk module that ever lived here -(`rules/security_learning.lgt`) had no in-tree consumer and is quarantined at -`archive/logtalk/`. See -link:reports/2026-11-01-routing-and-rule-engine-recon.adoc[`+docs/reports/2026-11-01-routing-and-rule-engine-recon.adoc+`] -§4. +Hypatia's rule engine is Elixir. ECHIDNA is a Hypatia *target* — it carries +`.hypatia-baseline.json` and `.hypatia-ignore` — not a rule producer. *Command*: diff --git a/docs/PROOF-STATUS.adoc b/docs/PROOF-STATUS.adoc index 6b4c605a..cb9b0ca6 100644 --- a/docs/PROOF-STATUS.adoc +++ b/docs/PROOF-STATUS.adoc @@ -636,7 +636,7 @@ material for a multi-prover system and are outside this policy.`" So the sixteen `+proofs//+` directories and `+training_data/+` carry no row. They exercise parsers and backends. Listing them is deliberate: an absent row should read as *out of policy*, not *forgotten*. The same holds for -`+archive/logtalk/+` (dead, quarantined) and for `+echidna-playground/+`. +`+echidna-playground/+`. R6 used to cite a corpus artefact as covering a real obligation. It now cites `+meta-checker/src/Echidna/Composition.agda+`, and both corpus files say in diff --git a/docs/reports/2026-11-01-routing-and-rule-engine-recon.adoc b/docs/reports/2026-11-01-routing-and-rule-engine-recon.adoc index e4655fcc..53fbd9d9 100644 --- a/docs/reports/2026-11-01-routing-and-rule-engine-recon.adoc +++ b/docs/reports/2026-11-01-routing-and-rule-engine-recon.adoc @@ -3,7 +3,8 @@ = Re-recon: routing surfaces and the rule-engine source -*Status*: historical source review with follow-ups recorded on 2026-11-04. +*Status*: historical source review with follow-ups recorded on 2026-11-04 +and 2026-11-16. Supersedes nothing; this is the first pass that classifies *every* client-facing path in the tree rather than only the ones a given consumer happens to use. *Date*: 2026-11-01. *Method*: static read of the @@ -17,8 +18,8 @@ communication path*? . How does that reconcile with clients that call the echidnabot REST/GraphQL surfaces directly, and with proof-burrower's `echidna prove` subprocess contract? -. Which rule engine is live — the Logtalk module in `rules/`, or the Elixir -rules in Hypatia? +. Which rule engine is live — the retired rule module in `rules/`, or the +Elixir rules in Hypatia? . Which paths in the tree are *active*, *compatibility-only*, *archival* or *dead*? @@ -42,11 +43,12 @@ or `POST /` (the separate `echidna-graphql` binary); proof-burrower looks for `echidna prove --output json` and reads one JCS line off stdout. Those three paths are independent and none of them routes through VeriSimDB. -*The Logtalk material is dead and has been quarantined.* `rules/security_learning.lgt` -was the only `.lgt` file in the tree, referenced by nothing — not a test, not a -workflow, not a Justfile recipe, not the REUSE manifest's per-file headers. -Estate rule authoring is Elixir in Hypatia. The file now lives under -`archive/logtalk/` with a status header; `rules/` no longer exists. +*The retired rule engine is dead and has been quarantined.* The one module +in `rules/` was the only file of its language in the tree, referenced by +nothing — not a test, not a workflow, not a Justfile recipe, not the REUSE +manifest's per-file headers. Estate rule authoring is Elixir in Hypatia. The +file moved under `archive/` with a status header; `rules/` no longer exists. +*Follow-up (2026-11-16):* the quarantine has since been deleted (§4.3). *Two routing defects were fixed en route* (container entrypoint and health probes, <>), *one was documented and left open* (the 8081 port collision, @@ -123,7 +125,7 @@ non-feature one returns `+Ok(vec![])+`. |They are other repositories. Verify from their trees, not from this one's records. -|`+rules/security_learning.lgt+` was loaded by nothing +|The retired rule module in `+rules/+` was loaded by nothing |`+argued+` (grep-exhaustive over this tree) |Green state only if no external consumer exists. Its input path points at a home directory, which makes one unlikely; it does not prove absence. @@ -407,12 +409,12 @@ which is a feature decision, not a rename. None of these are bugs in the contract. They are the current *scope*, and the useful thing a recon can do is stop other documents implying otherwise. -== 4. Logtalk: what was left and why it is dead +== 4. The retired rule engine: what was left and why it is dead === 4.1 What was there -`+rules/security_learning.lgt+` — 234 lines, two Logtalk objects -(`+security_learning+`, `+cicd_integration+`), dated 2025-12-29. It encodes 20 +One module in `+rules/+` — 234 lines in the retired rule language, two +objects (`+security_learning+`, `+cicd_integration+`), dated 2025-12-29. It encodes 20 alert categories from cicd-hyper-a's `+ERROR-CATALOG.scm+`, a severity classifier, a fix-suggestion table, seven prevention workflows, and a `+assertz+`-based "learning" loop that re-derives rules from its own training @@ -420,9 +422,9 @@ data. === 4.2 Why it is dead -* *Nothing loads it.* `+grep -rn '\.lgt' --exclude-dir=.git .+` returns the file - and one self-reference inside it. No test, workflow, Justfile recipe, A2ML - manifest or Cargo build step names it. No `+logtalk+`/`+swipl+` binary is +* *Nothing loads it.* A grep for its file extension returns the file and one + self-reference inside it. No test, workflow, Justfile recipe, A2ML + manifest or Cargo build step names it. No runtime for its language is referenced anywhere in CI. * *Its inputs are on someone's disk.* `+cicd_repo_path('~/repos/cicd-hyper-a/.audittraining')+` — a home-directory path with a literal `+~+`, in an object whose job is to @@ -434,10 +436,10 @@ data. `+learn_rules/0+` then asserts whatever the static tables already said. The output is a transcript of the input constants. * *The estate moved.* `+docs/ECOSYSTEM-INTEGRATION.adoc:117+` described Hypatia - as auto-generating Logtalk rules after 5+ observations. Hypatia's rule - engine is Elixir; the estate's rule-as-data path is Elixir rule modules, not - Logtalk objects. An ECHIDNA-side Logtalk module was never a consumer of that - output, even when the prose was accurate. + as auto-generating rules in that language after 5+ observations. Hypatia's + rule engine is Elixir; the estate's rule-as-data path is Elixir rule + modules. An ECHIDNA-side module in the retired language was never a + consumer of that output, even when the prose was accurate. * *The one live rule surface in this repo is `+.hypatia-baseline.json+` + `+.hypatia-ignore+`* — i.e. ECHIDNA is a Hypatia *target*, not a rule producer. @@ -450,14 +452,14 @@ Moved, not deleted, and marked: |=== |Before |After -|`+rules/security_learning.lgt+` -|`+archive/logtalk/security_learning.lgt+` — body unchanged (so the record is +|The module in `+rules/+` +|The same file under `+archive/+` — body unchanged (so the record is byte-recoverable), preceded by a `+DEAD SOURCE+` block naming the date, the reason and the successor. |_(no index)_ -|`+archive/logtalk/README.adoc+` — what it was, why it is here, what would have -to be true to revive it. +|A README beside it under `+archive/+` — what it was, why it is here, what +would have to be true to revive it. |`+.reuse/dep5+` `+Files: rules/*+` |`+Files: archive/*+` — the same MPL-2.0 bulk stanza, retargeted. @@ -467,16 +469,35 @@ to be true to revive it. exists precisely to record those. |=== -`+rules/+` is gone rather than emptied, so that the tree cannot imply "ECHIDNA -has rules in Logtalk" by the existence of the directory. +`+rules/+` is gone rather than emptied, so that the tree cannot imply that +ECHIDNA carries rules in the retired language by the existence of the +directory. + +*Follow-up (2026-11-16):* the quarantine was deleted outright, with +`+archive/+`, its `+.reuse/dep5+` line and its `+root-allow.txt+` entry. Git +history keeps both files: they can be recovered from any commit before the +deletion, for example `+478b751+`. Hypatia's `+lib/rules/security_errors.ex+` +preserves part of the alert tables. The Agda model in +https://github.com/hyperpolymath/hypatia/pull/1185[Hypatia PR #1185] +(https://github.com/hyperpolymath/hypatia/blob/1741ba104af5d37369d7164f3adbf1030ddc849e/verification/proofs/agda/AlertTableCorrespondence.agda[proof at commit 1741ba1]) +checks agreement between table transcriptions for category, severity, +auto-fixability and fix presence across 18 alerts, and for six shared +prevention mappings. `+BranchProtectionID+` maps to +`+branch-protection-enforcer.yml+` in the retired module and +`+scorecard-enforcer.yml+` in Hypatia; Hypatia also adds a prevention mapping +for `+CodeReviewID+`. The model does not cover fix text or prove runtime +refinement or the learning loop. === 4.4 Prose also retired -* `+docs/ECOSYSTEM-INTEGRATION.adoc+` — the Logtalk-generation sentence now - states Elixir and links here. +* `+docs/ECOSYSTEM-INTEGRATION.adoc+` — the rule-generation sentence now + states Elixir. * `+echidna-playground/.machine_readable/descriptiles/NEUROSYM.a2ml+` — - `+report-format = "logtalk"+` retired to a comment. That key told a scanner - consumer to expect a format nothing produces. + `+report-format+` named the retired rule format and was retired to a + comment, because it told a scanner consumer to expect a format nothing + produces. *Follow-up (2026-11-30):* the commented-out key has been + deleted. No report format is declared: A2ML is retired, so no new fact is + added to an `+.a2ml+` file. == 5. Path classification @@ -571,13 +592,9 @@ failed at `+exec+`. |`+EXPOSE 8081+` matches the default; `+APP_PORT+` is consumed by the entrypoint, not the binary. -|`+rules/security_learning.lgt+` -|dead → quarantined -|§4.2. - -|`+archive/logtalk/+` -|archival -|Quarantine, not a build input. Indexed by `+archive/logtalk/README.adoc+`. +|The retired rule module in `+rules/+` +|dead → quarantined → deleted +|§4.2; deleted with `+archive/+` on 2026-11-16 (§4.3). |`+proofs//+` trees (16 directories) and `+training_data/+` |archival *(out of policy)* @@ -589,7 +606,7 @@ link:../PROOF-STATUS.adoc[`+docs/PROOF-STATUS.adoc+`] "Not obligations". |`+docs/ECOSYSTEM-INTEGRATION.adoc+` |archival (corrected) -|2026-02-12 point-in-time status; kept as a record, Logtalk claim retired. +|2026-02-12 point-in-time status; kept as a record, rule-engine claim retired. |`+docs/design/ECHIDNA-VERISIM-TRIANGULATION-2026-04-17.adoc+` |archival @@ -828,9 +845,8 @@ grep -n 'default_value = "8081"' src/rust/main.rs sed -n '115,132p' Cargo.toml grep -rn 'cfg(feature = "verisim")' src/rust/ | wc -l -# nothing loads Logtalk -grep -rn '\.lgt' --exclude-dir=.git . # archived file + its own self-reference -grep -rni 'logtalk' --exclude-dir=.git . # prose only, after this change +# the retired rule engine is gone (both absent since 2026-11-16) +ls rules archive # the prove contract vs the legacy formatter grep -n 'ProveOutput\|--output' src/rust/main.rs | head diff --git a/echidna-playground/.machine_readable/descriptiles/NEUROSYM.a2ml b/echidna-playground/.machine_readable/descriptiles/NEUROSYM.a2ml index 0cd4594c..f7e86357 100644 --- a/echidna-playground/.machine_readable/descriptiles/NEUROSYM.a2ml +++ b/echidna-playground/.machine_readable/descriptiles/NEUROSYM.a2ml @@ -9,12 +9,6 @@ last-updated = "2026-11-01" [hypatia-config] scan-enabled = true scan-depth = "standard" # quick | standard | deep -# report-format retired 2026-11-01. It read "logtalk", which no scanner in the -# estate emits: Hypatia's rule engine is Elixir, and this project is a scan -# target, not a rules producer. Left unset so the consumer applies its own -# default rather than being told to expect a format nothing produces. -# See docs/reports/2026-11-01-routing-and-rule-engine-recon.adoc §4.4. -# report-format = "logtalk" [symbolic-rules] # Custom symbolic rules for this project diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 9d2d44b6..6d85a690 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -255,12 +255,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "base64ct" -version = "1.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" - [[package]] name = "bitflags" version = "2.11.1" @@ -278,16 +272,7 @@ dependencies = [ "cc", "cfg-if", "constant_time_eq", - "cpufeatures 0.3.0", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", + "cpufeatures", ] [[package]] @@ -348,8 +333,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ "cfg-if", - "cpufeatures 0.3.0", - "rand_core 0.10.1", + "cpufeatures", + "rand_core", ] [[package]] @@ -442,12 +427,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - [[package]] name = "const-oid" version = "0.10.2" @@ -466,15 +445,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - [[package]] name = "cpufeatures" version = "0.3.0" @@ -505,16 +475,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" -[[package]] -name = "crypto-common" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" -dependencies = [ - "generic-array", - "typenum", -] - [[package]] name = "crypto-common" version = "0.2.2" @@ -526,18 +486,17 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.3" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +checksum = "94c1aa5a9b7626ed65ac0cf5ea9d4f1547af89017fbac20bd4de40022fff516f" dependencies = [ "cfg-if", - "cpufeatures 0.2.17", + "cpufeatures", "curve25519-dalek-derive", - "digest 0.10.7", + "digest", "fiat-crypto", "rustc_version", "subtle", - "zeroize", ] [[package]] @@ -551,16 +510,6 @@ dependencies = [ "syn", ] -[[package]] -name = "der" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" -dependencies = [ - "const-oid 0.9.6", - "zeroize", -] - [[package]] name = "derive_arbitrary" version = "1.4.2" @@ -572,25 +521,15 @@ dependencies = [ "syn", ] -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer 0.10.4", - "crypto-common 0.1.7", -] - [[package]] name = "digest" version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ - "block-buffer 0.12.1", - "const-oid 0.10.2", - "crypto-common 0.2.2", + "block-buffer", + "const-oid", + "crypto-common", ] [[package]] @@ -633,7 +572,7 @@ dependencies = [ "serde", "serde_json", "serde_json_canonicalizer", - "sha2 0.11.0", + "sha2", "strum", "tempfile", "thiserror", @@ -679,26 +618,23 @@ dependencies = [ [[package]] name = "ed25519" -version = "2.2.3" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +checksum = "29fcf32e6c73d1079f83ab4d782de2d81620346a5f38c6237a86a22f8368980a" dependencies = [ - "pkcs8", "signature", ] [[package]] name = "ed25519-dalek" -version = "2.2.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +checksum = "6ebaa1a2bf1290ab3bfe5a7b771d050ebffab2711c19a81691c683a5144a25de" dependencies = [ "curve25519-dalek", "ed25519", - "serde", - "sha2 0.10.9", + "sha2", "subtle", - "zeroize", ] [[package]] @@ -743,9 +679,9 @@ checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" [[package]] name = "fiat-crypto" -version = "0.2.9" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" +checksum = "64cd1e32ddd350061ae6edb1b082d7c54915b5c672c389143b9a63403a109f24" [[package]] name = "find-msvc-tools" @@ -761,9 +697,9 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "form_urlencoded" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e" dependencies = [ "percent-encoding", ] @@ -856,16 +792,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - [[package]] name = "getrandom" version = "0.2.17" @@ -901,7 +827,7 @@ dependencies = [ "js-sys", "libc", "r-efi 6.0.0", - "rand_core 0.10.1", + "rand_core", "wasip2", "wasip3", "wasm-bindgen", @@ -1567,16 +1493,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - [[package]] name = "portable-atomic" version = "1.13.1" @@ -1715,16 +1631,7 @@ checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" dependencies = [ "chacha20", "getrandom 0.4.2", - "rand_core 0.10.1", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", + "rand_core", ] [[package]] @@ -1739,7 +1646,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" dependencies = [ - "rand_core 0.10.1", + "rand_core", ] [[package]] @@ -1857,9 +1764,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.4" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ "bitflags", "errno", @@ -2049,17 +1956,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.11.0" @@ -2067,8 +1963,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" dependencies = [ "cfg-if", - "cpufeatures 0.3.0", - "digest 0.11.3", + "cpufeatures", + "digest", ] [[package]] @@ -2098,12 +1994,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.2.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "rand_core 0.6.4", -] +checksum = "28d567dcbaf0049cb8ac2608a76cd95ff9e4412e1899d389ee400918ca7537f5" [[package]] name = "simba" @@ -2139,16 +2032,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -2583,9 +2466,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.8" +version = "2.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a" dependencies = [ "form_urlencoded", "idna", @@ -2623,12 +2506,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - [[package]] name = "want" version = "0.3.1" diff --git a/src/rust/coprocessor/crypto.rs b/src/rust/coprocessor/crypto.rs index bbefb785..52dd7aa0 100644 --- a/src/rust/coprocessor/crypto.rs +++ b/src/rust/coprocessor/crypto.rs @@ -232,6 +232,64 @@ mod tests { } } + /// Decode a lowercase-hex literal (test helper). + fn unhex(s: &str) -> Vec { + (0..s.len()) + .step_by(2) + .map(|i| u8::from_str_radix(&s[i..i + 2], 16).unwrap()) + .collect() + } + + /// RFC 8032 §7.1 known-answer vectors (TEST 1 and TEST 2), hard-coded: + /// seed -> public key, seed+message -> signature (Ed25519 is + /// deterministic), and verification of the published signature. + /// Pins keys, signatures and verification across dalek upgrades. + #[test] + fn ed25519_rfc8032_known_answer_vectors() { + let vectors: [(&str, &str, &str, &str); 2] = [ + ( + "9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60", + "d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a", + "", + "e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b", + ), + ( + "4ccd089b28ff96da9db6c346ec114e0f5b8a319f35aba624da8cf6ed4fb8a6fb", + "3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c", + "72", + "92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00", + ), + ]; + for (seed, pk, msg, sig) in vectors { + let seed: [u8; 32] = unhex(seed).try_into().unwrap(); + let sk = ed25519_dalek::SigningKey::from_bytes(&seed); + assert_eq!(sk.verifying_key().to_bytes().to_vec(), unhex(pk), "pk"); + let msg = unhex(msg); + let signed = ed25519_dalek::Signer::sign(&sk, &msg); + assert_eq!(signed.to_bytes().to_vec(), unhex(sig), "signature"); + // Verify the published (not self-generated) signature. + match run(CoprocessorOp::CryptoEd25519Verify { + public_key: unhex(pk), + signature: unhex(sig), + message: msg.clone(), + }) { + CoprocessorOutcome::Boolean(true) => {}, + other => panic!("expected verify=true, got {other:?}"), + } + // A modified message must be rejected. + let mut bad = msg; + bad.push(0); + match run(CoprocessorOp::CryptoEd25519Verify { + public_key: unhex(pk), + signature: unhex(sig), + message: bad, + }) { + CoprocessorOutcome::Boolean(false) => {}, + other => panic!("expected verify=false, got {other:?}"), + } + } + } + #[test] fn ed25519_verify_short_key_returns_failure() { match run(CoprocessorOp::CryptoEd25519Verify {