mirror of
https://github.com/openai/codex.git
synced 2026-09-20 12:47:38 +00:00
## What changed Probe the default Windows system config namespace at session start and record `codex.windows_system_config.namespace_squatting_probe` once per process when metrics are available. When `config.toml` or `requirements.toml` exists, check the containing directories for expected ownership and broad standard-user mutation allow ACEs, including permissions inherited by child files. Report coarse results for missing files, expected directories, unexpected types or owners, mutation permissions, and check errors. The probe is observational: it does not change configuration loading or enforce a trust decision. GitOrigin-RevId: e1c79dca5548e16e83c7b84b44ab0de4e2643d0d
36 lines
1.2 KiB
Rust
36 lines
1.2 KiB
Rust
//! Telemetry for the default Windows system-config namespace.
|
|
|
|
use codex_config::loader::WindowsSystemConfigNamespaceProbe as Probe;
|
|
use std::sync::atomic::AtomicBool;
|
|
use std::sync::atomic::Ordering;
|
|
|
|
const NAMESPACE_SQUATTING_PROBE_METRIC: &str =
|
|
"codex.windows_system_config.namespace_squatting_probe";
|
|
static NAMESPACE_SQUATTING_PROBE_RECORDED: AtomicBool = AtomicBool::new(false);
|
|
|
|
/// Records the coarse system-config namespace probe once after metrics exist.
|
|
pub(crate) fn emit_namespace_squatting_probe() {
|
|
let Some(metrics) = codex_otel::global() else {
|
|
return;
|
|
};
|
|
if NAMESPACE_SQUATTING_PROBE_RECORDED
|
|
.compare_exchange(false, true, Ordering::Relaxed, Ordering::Relaxed)
|
|
.is_err()
|
|
{
|
|
return;
|
|
}
|
|
let result = match codex_config::loader::probe_windows_system_config_namespace() {
|
|
Probe::Missing => "missing",
|
|
Probe::Expected => "expected",
|
|
Probe::UnexpectedType => "unexpected_type",
|
|
Probe::UnexpectedOwner => "unexpected_owner",
|
|
Probe::StandardUserMutationAcl => "standard_user_acl",
|
|
Probe::CheckError => "check_error",
|
|
};
|
|
let _ = metrics.counter(
|
|
NAMESPACE_SQUATTING_PROBE_METRIC,
|
|
/*inc*/ 1,
|
|
&[("result", result)],
|
|
);
|
|
}
|