mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Add telemetry for the Windows system config namespace (#44284)
## 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
This commit is contained in:
1 parent
c1840dc55e
commit
bb71d758cd
11 files changed
+254
-2
No files matched your search
@@ -0,0 +1,35 @@
|
||||
//! 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)],
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user