mirror of
https://github.com/openai/codex.git
synced 2026-11-01 19:33:35 +00:00
Deny network access when an allow amendment fails (#36037)
## Why A failed network policy amendment must not grant access to the requested host or approve it for the rest of the session. ## What changed - Only approve the host for the session after the allow amendment is applied successfully. - Otherwise deny the pending request and record a policy-denial outcome for its owning call. ## Testing Added a managed-network regression test that submits an invalid allow amendment, verifies that the request is blocked, and confirms that retrying the host prompts for approval again. GitOrigin-RevId: b2014d19128133abd5e19b8a7e4eb27810a45306
This commit is contained in:
@@ -920,12 +920,25 @@ impl NetworkApprovalService {
|
||||
.await;
|
||||
}
|
||||
}
|
||||
{
|
||||
let mut denied_hosts = self.session_denied_hosts.lock().await;
|
||||
denied_hosts.remove(&key);
|
||||
if pending_owner.decision_on_drop == PendingApprovalDecision::AllowForSession {
|
||||
{
|
||||
let mut denied_hosts = self.session_denied_hosts.lock().await;
|
||||
denied_hosts.remove(&key);
|
||||
}
|
||||
self.session_approved_hosts.lock().await.insert(key.clone());
|
||||
PendingApprovalDecision::AllowForSession
|
||||
} else {
|
||||
if let Some(owner_call) = owner_call.as_ref() {
|
||||
self.record_call_outcome(
|
||||
&owner_call.registration_id,
|
||||
NetworkApprovalOutcome::DeniedByPolicy(
|
||||
policy_denial_message.clone(),
|
||||
),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
PendingApprovalDecision::Deny
|
||||
}
|
||||
self.session_approved_hosts.lock().await.insert(key.clone());
|
||||
PendingApprovalDecision::AllowForSession
|
||||
}
|
||||
NetworkPolicyRuleAction::Deny => {
|
||||
match session
|
||||
|
||||
Reference in New Issue
Block a user