Repository navigation
[Security / Bug] Project .prime/settings.json overrides global agentTraces opt-out (CWE-863) & git URL credential redaction (fix ready in #3886) #3887
stealthmark-io
started this conversation in
Bug reports
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Per
CONTRIBUTING.md, opening a Discussion first so a maintainer can review and vouch PR #3886 (stealthmark-io/prime-agent@6538a97).During a static audit of
crates/pa-core, our team at StealthMark Security found an asymmetric precedence bug inSettingsManager::get_agent_traces_enabled()alongside unredacted HTTP(S) git remote credentials inactive_git_context().1. Project
.prime/settings.jsonCan Override GlobalagentTracesOpt-Out / Default-Off (crates/pa-core/src/settings/manager.rs:418-435)get_telemetry_enabled(),manager.rs:839-847),SettingsManagerevaluates.all(...)across[self.global, self.project, self.runtime_overrides]so a project config cannot override a global opt-out.get_agent_traces_enabled()(manager.rs:418-424) andagent_traces_choice_written()(manager.rs:429-435) read fromself.merged.agent_traces(deep_merge(&global, &project)), whereSettingsScope::Project(<cwd>/.prime/settings.json) wins overSettingsScope::Global(~/.prime/settings.json)."agentTraces": {"enabled": false}) or left it unset (default off), opening a third-party repository that contains.prime/settings.jsonwith{"agentTraces": {"enabled": true}}flipsget_agent_traces_enabled()totrueand marksagent_traces_choice_written()astrue, allowingContinuousTraceUpload(continuous.rs:130-141) to upload session transcripts using the user'sPRIME_API_KEY/ inference credential (agent_traces.rs:95-109).2. Embedded HTTP(S) Credentials in
active_git_context()(crates/pa-core/src/agent_traces.rs:369-443)active_git_context()extractsgit.repoUrlfrom sessiongit_stateor headers and attaches it toX-Git-Repowithout stripping embedded HTTP(S)userinfo@tokens (e.g.,https://x-access-token:<token>@github.com/org/repo.git).Fix & Unit Tests Ready in PR #3886 (
6538a97)We prepared a minimal patch in PR #3886 (
6538a97) that:self.global.agent_traces.enabled == Some(true)as the baseline consent gate while still allowingself.projectorself.runtime_overridesto veto (enabled: false) trace uploads for sensitive workspaces (preservingmixed_consent_fixtureincontinuous/tests.rs:704).agent_traces_choice_written()toself.global.agent_traces.userinfo@credentials insanitize_git_repo_url()with unit tests (project_settings_cannot_override_global_agent_traces_opt_out_or_unsetandactive_git_context_strips_embedded_http_credentials).Happy to have a maintainer take a look and re-open/vouch #3886!
All reactions