WIP fase 2b-3: rimozione sottosistemi solo-ChatGPT (plugin remoti, image gen, daybreak, cyber, attestation, cloud config, app/connettori) - test in corso

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-10 16:07:22 +01:00
parent 231e8cd136
commit 5afc7e9f7f
1223 changed files with 6225 additions and 113722 deletions

View File

@@ -371,13 +371,6 @@ fn fallback_managed_hooks_source_path(
Some(RequirementSource::Composite { .. }) => {
synthetic_layer_path("<requirements-composition>/requirements.toml")
}
Some(RequirementSource::EnterpriseManaged { id, name }) => {
let name = escape_xml_text(name);
let id = escape_xml_text(id);
synthetic_layer_path(&format!(
"<enterprise-managed:{name}:{id}>/requirements.toml"
))
}
Some(RequirementSource::LegacyManagedConfigTomlFromMdm) => {
synthetic_layer_path("<legacy-managed-config.toml-mdm>/managed_config.toml")
}
@@ -463,9 +456,6 @@ fn config_toml_source_path(layer: &ConfigLayerEntry) -> AbsolutePathBuf {
ConfigLayerSource::Mdm { domain, key } => {
synthetic_layer_path(&format!("<mdm:{domain}:{key}>/{CONFIG_TOML_FILE}"))
}
ConfigLayerSource::EnterpriseManaged { id, name } => synthetic_layer_path(&format!(
"<enterprise-managed:{name}:{id}>/{CONFIG_TOML_FILE}"
)),
ConfigLayerSource::LegacyManagedConfigTomlFromMdm => {
synthetic_layer_path("<legacy-managed-config.toml-mdm>/managed_config.toml")
}
@@ -485,21 +475,6 @@ fn synthetic_layer_path(path: &str) -> AbsolutePathBuf {
}
}
fn escape_xml_text(value: &str) -> String {
let mut escaped = String::with_capacity(value.len());
for ch in value.chars() {
match ch {
'&' => escaped.push_str("&amp;"),
'<' => escaped.push_str("&lt;"),
'>' => escaped.push_str("&gt;"),
'"' => escaped.push_str("&quot;"),
'\'' => escaped.push_str("&apos;"),
_ => escaped.push(ch),
}
}
escaped
}
pub(crate) fn discover_environment_hooks(
sources: Vec<crate::EnvironmentHookSource>,
mut display_order: i64,
@@ -816,7 +791,6 @@ fn append_matcher_groups(
event_name,
group.matcher.as_deref(),
&config,
/*app_connector_id*/ None,
)
});
let plugin_content_hash = match source.plugin_content_hash {
@@ -1033,7 +1007,6 @@ fn hook_metadata_for_config_layer_source(source: &ConfigLayerSource) -> (HookSou
ConfigLayerSource::User { .. } => (HookSource::User, false),
ConfigLayerSource::Project { .. } => (HookSource::Project, false),
ConfigLayerSource::Mdm { .. } => (HookSource::Mdm, true),
ConfigLayerSource::EnterpriseManaged { .. } => (HookSource::CloudManagedConfig, true),
ConfigLayerSource::SessionFlags => (HookSource::SessionFlags, false),
ConfigLayerSource::LegacyManagedConfigTomlFromFile { .. } => {
(HookSource::LegacyManagedConfigFile, true)
@@ -1061,7 +1034,6 @@ fn hook_source_for_requirement_source(source: Option<&RequirementSource>) -> Hoo
// available coarse attribution.
hook_source_for_requirement_source(sources.first())
}
Some(RequirementSource::EnterpriseManaged { .. }) => HookSource::CloudRequirements,
Some(RequirementSource::Unknown) | None => HookSource::Unknown,
}
}
@@ -1151,9 +1123,9 @@ mod tests {
RequirementSource::SystemRequirementsToml {
file: test_path_buf("/etc/codex/requirements.toml").abs(),
},
RequirementSource::EnterpriseManaged {
id: "layer-1".to_string(),
name: "Engineering".to_string(),
RequirementSource::MdmManagedPreferences {
domain: "com.openai.codex".to_string(),
key: "requirements".to_string(),
},
],
};
@@ -1164,21 +1136,6 @@ mod tests {
);
}
#[test]
fn enterprise_managed_synthetic_path_escapes_display_fields() {
let source = RequirementSource::EnterpriseManaged {
id: "id<&>".to_string(),
name: "Name <Admin> & \"Ops\"".to_string(),
};
let source_path = super::fallback_managed_hooks_source_path(Some(&source));
let source_path = source_path.display().to_string();
assert!(source_path.contains("Name &lt;Admin&gt; &amp; &quot;Ops&quot;"));
assert!(source_path.contains("id&lt;&amp;&gt;"));
assert!(!source_path.contains("Name <Admin>"));
}
fn command_group(matcher: Option<&str>) -> MatcherGroup {
MatcherGroup {
matcher: matcher.map(str::to_string),
@@ -1936,13 +1893,6 @@ mod tests {
}),
(HookSource::Mdm, true),
);
assert_eq!(
super::hook_metadata_for_config_layer_source(&ConfigLayerSource::EnterpriseManaged {
id: "cfg_123".to_string(),
name: "Base policy".to_string(),
}),
(HookSource::CloudManagedConfig, true),
);
assert_eq!(
super::hook_metadata_for_config_layer_source(&ConfigLayerSource::SessionFlags),
(HookSource::SessionFlags, false),

View File

@@ -345,8 +345,6 @@ pub(crate) fn hook_source_label(source: codex_protocol::protocol::HookSource) ->
codex_protocol::protocol::HookSource::Mdm => "mdm",
codex_protocol::protocol::HookSource::SessionFlags => "session_flags",
codex_protocol::protocol::HookSource::Plugin => "plugin",
codex_protocol::protocol::HookSource::CloudRequirements => "cloud_requirements",
codex_protocol::protocol::HookSource::CloudManagedConfig => "cloud_managed_config",
codex_protocol::protocol::HookSource::LegacyManagedConfigFile => {
"legacy_managed_config_file"
}

View File

@@ -182,8 +182,6 @@ impl ConfiguredHandler {
| HookSource::Plugin => false,
HookSource::System
| HookSource::Mdm
| HookSource::CloudRequirements
| HookSource::CloudManagedConfig
| HookSource::LegacyManagedConfigFile
| HookSource::LegacyManagedConfigMdm
// Required hooks can have unknown attribution; retain them fail-closed.

View File

@@ -2737,8 +2737,6 @@ async fn memory_consolidation_stop_preserves_policy_and_executor_cleanup() {
(HookSource::Plugin, false),
(HookSource::System, true),
(HookSource::Mdm, true),
(HookSource::CloudRequirements, true),
(HookSource::CloudManagedConfig, true),
(HookSource::LegacyManagedConfigFile, true),
(HookSource::LegacyManagedConfigMdm, true),
(HookSource::Unknown, true),