Mountain/Vine/Server/Notification/SecurityIncident.rs
1#![allow(non_snake_case)]
2//! Cocoon → Mountain `security.incident` notification.
3//! Emitted by `Cocoon/.../Services/SecurityService.ts:284` when the
4//! Cocoon-side security policy flags a policy breach (extension violated
5//! its declared permission set, blocked filesystem access, etc.). Land
6//! has no central security dashboard yet, so the atom surfaces the
7//! incident via `dev_log!` on the `grpc` tag and re-emits on
8//! `sky://security/incident` for any future Sky listener.
9
10use serde_json::Value;
11use tauri::Emitter;
12
13use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
14
15pub async fn SecurityIncident(Service:&MountainVinegRPCService, Parameter:&Value) {
16 let _ = Service.ApplicationHandle().emit("sky://security/incident", Parameter);
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}