Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -15,10 +15,10 @@ authors = ["Dcode <support@1pass.dev>"]
# `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"
Expand Down
1 change: 1 addition & 0 deletions crates/kc-cli/locales/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
1 change: 1 addition & 0 deletions crates/kc-cli/locales/es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
1 change: 1 addition & 0 deletions crates/kc-cli/locales/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
1 change: 1 addition & 0 deletions crates/kc-cli/locales/ja.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
1 change: 1 addition & 0 deletions crates/kc-cli/locales/ko.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
1 change: 1 addition & 0 deletions crates/kc-cli/locales/zh-Hans.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
1 change: 1 addition & 0 deletions crates/kc-cli/locales/zh-Hant.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
25 changes: 15 additions & 10 deletions crates/kc-cli/src/local_auth/linux.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -13,27 +15,33 @@ 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",
"org.freedesktop.policykit.exec",
"--process",
&format!("{pid},{start_time}"),
"--allow-user-interaction",
"--detail",
"polkit.message",
reason,
]);
command.stdin(std::process::Stdio::null());
command
Expand Down Expand Up @@ -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())
Expand All @@ -127,9 +135,6 @@ mod tests {
"--process",
"42,123456",
"--allow-user-interaction",
"--detail",
"polkit.message",
"kc: allow 'this' $(action)?",
]
);
}
Expand Down
4 changes: 3 additions & 1 deletion docs/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading