mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Handle credential provider source remapping across config layers (#44241)
## What changed - Let higher-priority providers in `features.network_proxy.credentials` displace lower-priority providers with overlapping `env` sources, including in profiles. Preserve inherited settings when providers swap sources, and compare environment names case-insensitively on Windows. - Preserve provider definitions across ordered batch remaps and persist displaced-provider removals without overwriting unrelated sibling updates. - Validate remapped providers using the credential broker's compilation rules before persisting writes, while allowing incomplete drafts and explicit deletions. - Omit displaced providers from config origins and report writes overridden by another provider's source ownership. - Build trusted credential-broker configuration before merging managed layers for project discovery, preserving remapped providers' environment protections. ## Testing Add unit and config RPC regression tests for source precedence, source swaps, ordered edits, concurrent sibling updates, atomic rejection of invalid remaps, persistence, and override reporting. Add a macOS managed-config regression test for remapped provider bindings during project discovery. GitOrigin-RevId: b7d402727acf4e5b0f25946db1cf18811f5e2679
This commit is contained in:
1 parent
3436cad5ab
commit
ed4ca07ba6
14 files changed
+1690
-45
No files matched your search
@@ -466,12 +466,35 @@ impl ConfigLayerStack {
|
||||
pub fn origins(&self) -> HashMap<String, ConfigLayerMetadata> {
|
||||
let mut origins = HashMap::new();
|
||||
let mut path = Vec::new();
|
||||
let mut provider_paths = vec!["features.network_proxy.credentials.".to_string()];
|
||||
|
||||
for layer in self.layers_low_to_high() {
|
||||
let config = normalized_with_key_aliases(&layer.config, &[]);
|
||||
if let Some(profiles) = config.get("profiles").and_then(TomlValue::as_table) {
|
||||
provider_paths.extend(
|
||||
profiles
|
||||
.keys()
|
||||
.map(|name| format!("profiles.{name}.features.network_proxy.credentials.")),
|
||||
);
|
||||
}
|
||||
record_origins(&config, &layer.metadata(), &mut path, &mut origins);
|
||||
}
|
||||
|
||||
if let Some(layer) = self.layers_low_to_high().next_back() {
|
||||
let effective = self.effective_config();
|
||||
let mut effective_origins = HashMap::new();
|
||||
record_origins(
|
||||
&effective,
|
||||
&layer.metadata(),
|
||||
&mut path,
|
||||
&mut effective_origins,
|
||||
);
|
||||
origins.retain(|path, _| {
|
||||
!provider_paths.iter().any(|prefix| path.starts_with(prefix))
|
||||
|| effective_origins.contains_key(path)
|
||||
});
|
||||
}
|
||||
|
||||
origins
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user