mirror of
https://github.com/openai/codex.git
synced 2026-11-24 15:21:20 +00:00
Fail closed on unsafe config and sed parsing (#39700)
## Why Unsupported untrusted approval policies must remain startup errors even when app-server is allowed to fall back from other invalid configuration. Likewise, compound command summaries must not discard a `sed` stage that can edit files in place. ## What changed - Propagate `UnsupportedUntrustedApprovalPolicyError` from both app-server configuration loads instead of replacing it with default configuration. - Parse `sed` options through `--`, option arguments, combined short flags, and backup suffixes so `-i`/`--in-place` commands remain unknown actions. - Keep non-mutating `sed` operands after `--` from being mistaken for flags. ## Testing Added parser coverage for in-place `sed` variants in compound commands and for dash-prefixed operands after `--`. GitOrigin-RevId: 112ead912e10fcb6c7dd0ede4bf84e390af82da8
This commit is contained in:
1 parent
478dbe9df0
commit
f277e313f1
2 files changed
+81
-11
No files matched your search
@@ -82,6 +82,14 @@ use tracing_subscriber::util::SubscriberInitExt;
|
||||
|
||||
const SQLITE_RECOVERY_CONFIG_WARNING_SUMMARY: &str = "Codex rebuilt its local database.";
|
||||
|
||||
fn is_unsupported_untrusted_approval_policy_error(err: &std::io::Error) -> bool {
|
||||
err.get_ref().is_some_and(
|
||||
<dyn std::error::Error + Send + Sync + 'static>::is::<
|
||||
UnsupportedUntrustedApprovalPolicyError,
|
||||
>,
|
||||
)
|
||||
}
|
||||
|
||||
mod analytics_utils;
|
||||
mod app_info;
|
||||
mod app_server_tracing;
|
||||
@@ -505,13 +513,7 @@ pub async fn run_main_with_transport_options(
|
||||
config.http_client_factory(),
|
||||
);
|
||||
}
|
||||
Err(err)
|
||||
if err.get_ref().is_some_and(
|
||||
<dyn std::error::Error + Send + Sync + 'static>::is::<
|
||||
UnsupportedUntrustedApprovalPolicyError,
|
||||
>,
|
||||
) =>
|
||||
{
|
||||
Err(err) if is_unsupported_untrusted_approval_policy_error(&err) => {
|
||||
return Err(err);
|
||||
}
|
||||
Err(err) => {
|
||||
@@ -526,6 +528,9 @@ pub async fn run_main_with_transport_options(
|
||||
.await
|
||||
{
|
||||
Ok(config) => config,
|
||||
Err(err) if is_unsupported_untrusted_approval_policy_error(&err) => {
|
||||
return Err(err);
|
||||
}
|
||||
Err(err) => {
|
||||
if strict_config {
|
||||
return Err(err);
|
||||
|
||||
Reference in new issue
Block a user