fix(security): enforce sk-* UP and UV flags once russh exposes the signature

Offen
#340 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@inureyes arbeitet bereits daran.

Seit 05.11.2026.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
rust

Rechercherichtung

Read docs/UPSTREAM_PR_RUSSH.md and inspect russh’s server/encrypted.rs and src/server/handler.rs to understand the signature handoff; the upstream API change and release are prerequisites. Then trace src/server/auth/publickey.rs and the security key signature code, starting with tests that encode signatures. Done means the real auth flow enforces UP and UV as specified, tests cover both key types and flag failures, and the two security docs are updated.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

priority:medium status:blocked type:security

Depends on #338.

Problem

After #338, bssh-server accepts an [email protected] or [email protected] user key only when its authorized_keys line has no-touch-required and lacks verify-required, because bssh cannot read the signature's flags byte. OpenSSH accepts the other lines too, enforcing user presence (UP, flag 0x01) unless no-touch-required is set and user verification (UV, flag 0x04) when verify-required is set.

Current Behavior

  • russh 0.64.1 server/encrypted.rs:1060-1074 runs Verifier::verify, then calls handler.auth_publickey(user, key) with the key only, so src/server/handler.rs:349 never sees the signature.
  • ssh-key's sk verifiers (signature.rs:456-490) authenticate SHA256(app) || flags || counter || SHA256(msg) but do not test the flags. The flags byte is the 5th-to-last byte of the decoded signature (flags || u32 counter trailer).

Proposed Solution

  1. Propose an upstream russh change that passes the verified Signature (or its sk flags) to the server handler, for example a Handler method called after verification with (user, key, signature) whose default delegates to auth_publickey. Record the proposal in docs/UPSTREAM_PR_RUSSH.md.
  2. Once a russh release contains it, bump russh in Cargo.toml.
  3. In src/server/auth/publickey.rs, for sk keys require flags & 0x01 unless the matching line has no-touch-required, and flags & 0x04 when it has verify-required. Replace #338's fail-closed rejection with this check.

Acceptance Criteria

  • Upstream proposal filed and recorded in docs/UPSTREAM_PR_RUSSH.md; russh bumped to a release containing it.
  • UP required by default and relaxed only by no-touch-required.
  • UV required when verify-required is set.
  • Enforced in the real auth_publickey flow; docs/security.md and docs/openssh-compatibility-status.md updated.
  • Tests sign with encode_signature (src/ssh/security_key/signature.rs) or fixed vectors, cover both key types, and each fails when its flag check is removed.

Verification

cargo test server::auth
cargo clippy --all-targets -- -D warnings
Vorherrschende Sprache
Rust
Sterne
71
Forks
7
Ø Merge
4 Std. 51 Min.
Gemergte PRs (30 T.)
14

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus lablup/bssh

Alle Issues in lablup/bssh

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.