MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / emit_denial

Function emit_denial

crates/openshell-supervisor-network/src/proxy.rs:480–505  ·  view source on GitHub ↗

Emit a denial event to the aggregator channel (if configured). Used by `handle_tcp_connection` which owns `Option `.

(
    tx: &Option<mpsc::UnboundedSender<DenialEvent>>,
    host: &str,
    port: u16,
    binary: &str,
    decision: &ConnectDecision,
    reason: &str,
    stage: &str,
)

Source from the content-addressed store, hash-verified

478/// Emit a denial event to the aggregator channel (if configured).
479/// Used by `handle_tcp_connection` which owns `Option<Sender>`.
480fn emit_denial(
481 tx: &Option<mpsc::UnboundedSender<DenialEvent>>,
482 host: &str,
483 port: u16,
484 binary: &str,
485 decision: &ConnectDecision,
486 reason: &str,
487 stage: &str,
488) {
489 if let Some(tx) = tx {
490 let _ = tx.send(DenialEvent {
491 host: host.to_string(),
492 port,
493 binary: binary.to_string(),
494 ancestors: decision
495 .ancestors
496 .iter()
497 .map(|p| p.display().to_string())
498 .collect(),
499 deny_reason: reason.to_string(),
500 denial_stage: stage.to_string(),
501 l7_method: None,
502 l7_path: None,
503 });
504 }
505}
506
507/// Emit a denial event from a borrowed sender reference.
508/// Used by `handle_forward_proxy` which borrows `Option<&Sender>`.

Callers 1

handle_tcp_connectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected