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

未關閉
#340 0 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 1 天內回覆

@inureyes 已經在處理了。

開始於 2026年11月5日。

評估

難度
5/5
預估耗時
一週以上
新手友好度
35/100
Issue 類型
功能
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
rust

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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
主要語言
Rust
星號
71
分支
7
平均合併
4 小時 51 分鐘
30 天內合併 PR
14

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

lablup/bssh 的其他 Issue

查看 lablup/bssh 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。