diff --git a/Cargo.lock b/Cargo.lock index 6fc71d6..02f52ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1496,7 +1496,7 @@ dependencies = [ [[package]] name = "kc-cli" -version = "0.3.2" +version = "0.3.3" dependencies = [ "base64 0.22.1", "block2", @@ -1535,7 +1535,7 @@ dependencies = [ [[package]] name = "kc-proto" -version = "0.3.2" +version = "0.3.3" dependencies = [ "base64 0.22.1", "chacha20poly1305", @@ -1558,7 +1558,7 @@ dependencies = [ [[package]] name = "kc-relay" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "axum", @@ -1586,7 +1586,7 @@ dependencies = [ [[package]] name = "kc-store" -version = "0.3.2" +version = "0.3.3" dependencies = [ "apple-native-keyring-store", "directories", @@ -1610,7 +1610,7 @@ dependencies = [ [[package]] name = "kc-sync" -version = "0.3.2" +version = "0.3.3" dependencies = [ "rand", "serde", @@ -1620,7 +1620,7 @@ dependencies = [ [[package]] name = "kc-wire" -version = "0.3.2" +version = "0.3.3" dependencies = [ "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index e824b8b..5189c61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/kc-wire", "crates/kc-proto", "crates/kc-store", "crates/kc-relay", "crates/kc-cli", "crates/kc-sync"] [workspace.package] -version = "0.3.2" +version = "0.3.3" edition = "2024" rust-version = "1.88" license = "MIT" @@ -15,10 +15,10 @@ authors = ["Dcode "] # `dep = { workspace = true, features = [...] }`. A lane that needs a crate that # isn't listed here may add it to its own Cargo.toml directly. [workspace.dependencies] -kc-wire = { path = "crates/kc-wire", version = "0.3.2" } -kc-proto = { path = "crates/kc-proto", version = "0.3.2" } -kc-store = { path = "crates/kc-store", version = "0.3.2" } -kc-sync = { path = "crates/kc-sync", version = "0.3.2" } +kc-wire = { path = "crates/kc-wire", version = "0.3.3" } +kc-proto = { path = "crates/kc-proto", version = "0.3.3" } +kc-store = { path = "crates/kc-store", version = "0.3.3" } +kc-sync = { path = "crates/kc-sync", version = "0.3.3" } anyhow = "1" thiserror = "2" diff --git a/crates/kc-cli/locales/de.toml b/crates/kc-cli/locales/de.toml index d88d2f1..2999481 100644 --- a/crates/kc-cli/locales/de.toml +++ b/crates/kc-cli/locales/de.toml @@ -526,3 +526,4 @@ "Still pending: {what}." = "Noch offen: {what}." "No polkit authentication agent is running in this session (for example over SSH, or on a desktop without one such as hyprpolkitagent or polkit-gnome). Run this command from a desktop session that has an agent." = "In dieser Sitzung läuft kein polkit-Authentifizierungsagent (zum Beispiel über SSH oder auf einem Desktop ohne Agent wie hyprpolkitagent oder polkit-gnome). Führen Sie diesen Befehl in einer Desktop-Sitzung mit Agent aus." "The operating system couldn't ask for confirmation: {reason}." = "Das Betriebssystem konnte keine Bestätigung anfordern: {reason}." +"The polkit prompt shows a generic message. It is confirming: {reason}" = "Die polkit-Abfrage zeigt einen allgemeinen Text. Bestätigt wird: {reason}" diff --git a/crates/kc-cli/locales/es.toml b/crates/kc-cli/locales/es.toml index a874a6a..ac30257 100644 --- a/crates/kc-cli/locales/es.toml +++ b/crates/kc-cli/locales/es.toml @@ -526,3 +526,4 @@ "Still pending: {what}." = "Aún pendiente: {what}." "No polkit authentication agent is running in this session (for example over SSH, or on a desktop without one such as hyprpolkitagent or polkit-gnome). Run this command from a desktop session that has an agent." = "No hay ningún agente de autenticación de polkit en ejecución en esta sesión (por ejemplo, por SSH o en un escritorio sin agente como hyprpolkitagent o polkit-gnome). Ejecute este comando desde una sesión de escritorio que tenga un agente." "The operating system couldn't ask for confirmation: {reason}." = "El sistema operativo no pudo pedir la confirmación: {reason}." +"The polkit prompt shows a generic message. It is confirming: {reason}" = "La ventana de polkit muestra un mensaje genérico. Se está confirmando: {reason}" diff --git a/crates/kc-cli/locales/fr.toml b/crates/kc-cli/locales/fr.toml index c1a5659..c7dcf3c 100644 --- a/crates/kc-cli/locales/fr.toml +++ b/crates/kc-cli/locales/fr.toml @@ -526,3 +526,4 @@ "Still pending: {what}." = "Encore en attente : {what}." "No polkit authentication agent is running in this session (for example over SSH, or on a desktop without one such as hyprpolkitagent or polkit-gnome). Run this command from a desktop session that has an agent." = "Aucun agent d’authentification polkit ne tourne dans cette session (par exemple via SSH, ou sur un bureau sans agent tel que hyprpolkitagent ou polkit-gnome). Exécutez cette commande depuis une session de bureau qui en a un." "The operating system couldn't ask for confirmation: {reason}." = "Le système d’exploitation n’a pas pu demander la confirmation : {reason}." +"The polkit prompt shows a generic message. It is confirming: {reason}" = "La fenêtre polkit affiche un message générique. Elle confirme : {reason}" diff --git a/crates/kc-cli/locales/ja.toml b/crates/kc-cli/locales/ja.toml index 3bca45b..ede1866 100644 --- a/crates/kc-cli/locales/ja.toml +++ b/crates/kc-cli/locales/ja.toml @@ -526,3 +526,4 @@ "Still pending: {what}." = "未完了: {what}。" "No polkit authentication agent is running in this session (for example over SSH, or on a desktop without one such as hyprpolkitagent or polkit-gnome). Run this command from a desktop session that has an agent." = "このセッションでは polkit 認証エージェントが動作していません(SSH 接続や、hyprpolkitagent・polkit-gnome などのエージェントがないデスクトップなど)。認証エージェントのあるデスクトップセッションでこのコマンドを実行してください。" "The operating system couldn't ask for confirmation: {reason}." = "OS が確認を求められませんでした: {reason}。" +"The polkit prompt shows a generic message. It is confirming: {reason}" = "polkit の画面には汎用のメッセージが表示されます。確認する操作: {reason}" diff --git a/crates/kc-cli/locales/ko.toml b/crates/kc-cli/locales/ko.toml index 3a6dd69..a4b2982 100644 --- a/crates/kc-cli/locales/ko.toml +++ b/crates/kc-cli/locales/ko.toml @@ -526,3 +526,4 @@ "Still pending: {what}." = "아직 남은 일: {what}." "No polkit authentication agent is running in this session (for example over SSH, or on a desktop without one such as hyprpolkitagent or polkit-gnome). Run this command from a desktop session that has an agent." = "이 세션에는 polkit 인증 에이전트가 실행 중이지 않습니다(예: SSH 접속, 또는 hyprpolkitagent·polkit-gnome 같은 에이전트가 없는 데스크톱). 인증 에이전트가 있는 데스크톱 세션에서 이 명령을 실행하세요." "The operating system couldn't ask for confirmation: {reason}." = "운영체제가 본인 확인을 요청하지 못했습니다: {reason}." +"The polkit prompt shows a generic message. It is confirming: {reason}" = "polkit 창에는 일반 안내 문구가 표시됩니다. 확인하려는 작업: {reason}" diff --git a/crates/kc-cli/locales/zh-Hans.toml b/crates/kc-cli/locales/zh-Hans.toml index 8dd8360..08f02fa 100644 --- a/crates/kc-cli/locales/zh-Hans.toml +++ b/crates/kc-cli/locales/zh-Hans.toml @@ -526,3 +526,4 @@ "Still pending: {what}." = "仍待处理:{what}。" "No polkit authentication agent is running in this session (for example over SSH, or on a desktop without one such as hyprpolkitagent or polkit-gnome). Run this command from a desktop session that has an agent." = "此会话中没有运行 polkit 身份验证代理(例如通过 SSH 连接,或桌面上没有 hyprpolkitagent、polkit-gnome 之类的代理)。请在有身份验证代理的桌面会话中运行此命令。" "The operating system couldn't ask for confirmation: {reason}." = "操作系统无法请求确认:{reason}。" +"The polkit prompt shows a generic message. It is confirming: {reason}" = "polkit 窗口显示的是通用提示。正在确认的操作:{reason}" diff --git a/crates/kc-cli/locales/zh-Hant.toml b/crates/kc-cli/locales/zh-Hant.toml index 3928108..1488e9a 100644 --- a/crates/kc-cli/locales/zh-Hant.toml +++ b/crates/kc-cli/locales/zh-Hant.toml @@ -526,3 +526,4 @@ "Still pending: {what}." = "仍待處理:{what}。" "No polkit authentication agent is running in this session (for example over SSH, or on a desktop without one such as hyprpolkitagent or polkit-gnome). Run this command from a desktop session that has an agent." = "此工作階段中沒有執行 polkit 驗證代理程式(例如透過 SSH 連線,或桌面上沒有 hyprpolkitagent、polkit-gnome 之類的代理程式)。請在有驗證代理程式的桌面工作階段中執行此命令。" "The operating system couldn't ask for confirmation: {reason}." = "作業系統無法要求確認:{reason}。" +"The polkit prompt shows a generic message. It is confirming: {reason}" = "polkit 視窗顯示的是通用提示。正在確認的操作:{reason}" diff --git a/crates/kc-cli/src/local_auth/linux.rs b/crates/kc-cli/src/local_auth/linux.rs index c9ce8fe..ec2935a 100644 --- a/crates/kc-cli/src/local_auth/linux.rs +++ b/crates/kc-cli/src/local_auth/linux.rs @@ -1,6 +1,8 @@ use std::process::Command; use super::LocalAuthOutcome; +#[cfg(target_os = "linux")] +use crate::i18n::tr; #[cfg(target_os = "linux")] pub(super) fn confirm(reason: &str) -> LocalAuthOutcome { @@ -13,17 +15,26 @@ pub(super) fn confirm(reason: &str) -> LocalAuthOutcome { return LocalAuthOutcome::Unavailable(format!("cannot read /proc/self/stat: {error}")); } }; + // polkit (since 121) refuses details such as polkit.message from untrusted callers, so the + // agent shows the exec action's generic text; name the actual request on the terminal. + eprintln!( + "{}", + tr!( + "The polkit prompt shows a generic message. It is confirming: {reason}", + reason = reason + ) + ); // Do not enable pkcheck's internal terminal agent. Authentication belongs to // the session's OS agent, with no input inherited from kc's PTY. // Polkit policy controls whether this check requires fresh authentication; // kc itself never retains or reuses an authorization result. - match command(reason, std::process::id(), start_time).output() { + match command(std::process::id(), start_time).output() { Ok(output) => outcome(output.status.code(), &output.stderr), Err(error) => LocalAuthOutcome::Unavailable(format!("cannot run pkcheck: {error}")), } } -fn command(reason: &str, pid: u32, start_time: u64) -> Command { +fn command(pid: u32, start_time: u64) -> Command { let mut command = Command::new("pkcheck"); command.args([ "--action-id", @@ -31,9 +42,6 @@ fn command(reason: &str, pid: u32, start_time: u64) -> Command { "--process", &format!("{pid},{start_time}"), "--allow-user-interaction", - "--detail", - "polkit.message", - reason, ]); command.stdin(std::process::Stdio::null()); command @@ -113,8 +121,8 @@ mod tests { } #[test] - fn reason_is_one_argument_and_no_internal_agent_is_enabled() { - let command = command("kc: allow 'this' $(action)?", 42, 123456); + fn no_details_and_no_internal_agent_are_passed() { + let command = command(42, 123456); let args: Vec<_> = command .get_args() .map(|arg| arg.to_str().unwrap()) @@ -127,9 +135,6 @@ mod tests { "--process", "42,123456", "--allow-user-interaction", - "--detail", - "polkit.message", - "kc: allow 'this' $(action)?", ] ); } diff --git a/docs/SECURITY.md b/docs/SECURITY.md index d236758..a8ea243 100644 --- a/docs/SECURITY.md +++ b/docs/SECURITY.md @@ -68,7 +68,9 @@ or polkit; agents cannot supply this confirmation. new local publication from a remaining copy. - **Linux sync confirmation:** L currently uses polkit's `org.freedesktop.policykit.exec` action, which may ask for an administrator - password. The OS policy controls authentication and caching. A kc-specific + password. polkit only shows that action's generic text ("run a program as + another user"), so kc prints what is being confirmed on the terminal first. + The OS policy controls authentication and caching. A kc-specific policy is planned with the later sync installer; neither ships in Phase 1. - **No signed sync approvals yet:** A/A+ and FIDO2 are Phase 1b work; the 1pass.dev phone approver is Phase 2b work. They cannot authorize overwrites