Mountain/Vine/Server/Notification/SecurityIncident.rs
1//! Cocoon → Mountain `security.incident` notification.
2//! Emitted by `Cocoon/.../Services/SecurityService.ts:284` when the
3//! Cocoon-side security policy flags a policy breach (extension violated
4//! its declared permission set, blocked filesystem access, etc.). Land
5//! has no central security dashboard yet, so the atom surfaces the
6//! incident via `dev_log!` on the `grpc` tag and re-emits on
7//! `sky://security/incident` for any future Sky listener.
8
9use serde_json::Value;
10use tauri::Emitter;
11
12use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
13
14pub async fn SecurityIncident(Service:&MountainVinegRPCService, Parameter:&Value) {
15 let _ = Service.ApplicationHandle().emit("sky://security/incident", Parameter);
16
17 dev_log!(
18 "grpc",
19 "warn: [Security] incident type={} severity={} ext={}",
20 Parameter.get("type").and_then(Value::as_str).unwrap_or("?"),
21 Parameter.get("severity").and_then(Value::as_str).unwrap_or("?"),
22 Parameter.get("extensionId").and_then(Value::as_str).unwrap_or("?")
23 );
24}