Expand description
Algorithm-override surface for SSH negotiation (PRD §5.8.6, M17).
This module exposes the four moving pieces a downstream CLI needs
to honour KexAlgorithms,
Ciphers, MACs, and HostKeyAlgorithms from ~/.ssh/config
(FR-76) plus the matching CLI overrides (--kex, --ciphers,
--macs, --host-key-algorithms — FR-77):
apply_overridesparses an OpenSSH-format override string —algo,algo(replace),+algo(append),-algo(remove),^algo(front-load) — against a base list and returns the resulting algorithm preference.DENYLIST+apply_denylistenforce FR-78’s permanent block on broken algorithms (DSA, 3DES, Arcfour, SHA-1 HMAC < 96 bits, SSH-1) regardless of override.anvil_default_kex/anvil_default_ciphers/anvil_default_macs/anvil_default_host_keysreturn the curated default that’s used as the base for+/-/^overrides.all_supportedreturns theCataloguesurfaced bygitway list-algorithms(FR-79) — every name russh accepts, tagged withis_defaultanddenylistedflags.
§Trust model
Russh 0.59 silently drops unknown algorithm names at negotiation
time — there is no error, no log. This module validates user
input before it reaches russh: an unknown algorithm in an
override surfaces an AnvilError::invalid_config with a
tips-thinking hint pointing at gitway list-algorithms.
The denylist is enforced after every override transformation
so a user-supplied +ssh-dss cannot bypass FR-78 by smuggling a
banned algorithm through an ^ move.
Structs§
- AlgEntry
- One entry in the
Cataloguereturned byall_supported. - Catalogue
- Full catalogue of every algorithm Gitway can negotiate, grouped
by
AlgCategory. Returned byall_supportedand consumed bygitway list-algorithms.
Enums§
- AlgCategory
- Algorithm category — the four
ssh_config(5)directive families Gitway plumbs through to russh. Matches the four CLI flags--kex/--ciphers/--macs/--host-key-algorithms.
Constants§
- DENYLIST
- Permanent denylist — algorithms refused regardless of any override.
Functions§
- all_
supported - Returns the full
Catalogueof algorithms russh advertises plus the flagsgitway list-algorithmsneeds to render the operator- facing view. - anvil_
default_ ciphers - Returns Anvil’s curated default cipher preference.
- anvil_
default_ host_ keys - Returns Anvil’s curated default host-key algorithm preference.
- anvil_
default_ kex - Returns Anvil’s curated default key-exchange algorithm
preference. Used as the base when an override carries a
+/-/^prefix. - anvil_
default_ macs - Returns Anvil’s curated default MAC preference.
- apply_
denylist - Filters a list of algorithm names through
is_denylisted, preserving the order of the surviving entries. - apply_
overrides - Applies an OpenSSH-format
KexAlgorithms/etc. override string tobase, returning the resulting algorithm list. - is_
denylisted - Returns
trueiffalgis on the permanent denylist (DENYLIST). Comparison is case-insensitive ASCII.