From e3ba948c2b9d487884121fa9de176fc4a60c5204 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 8 Sep 2026 08:23:43 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=20Fix=20missing=20process=20capabi?= =?UTF-8?q?lity=20check=20in=20std.notification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added capability checking logic in both the `show` and `alert` functions in `stdlib/src/notification.rs` to verify that `Capability::Process` is granted, as they both run external processes. Updated the `required_capabilities` in the `std.notification` module registration to include `Capability::Process`. Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com> --- stdlib/src/notification.rs | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/stdlib/src/notification.rs b/stdlib/src/notification.rs index 07e07b65..60f2e2b7 100644 --- a/stdlib/src/notification.rs +++ b/stdlib/src/notification.rs @@ -1,7 +1,11 @@ use crate::{StdFunction, StdlibModule, StdlibRegistry}; use std::collections::HashMap; use std::rc::Rc; -use techscript_runtime::{error::RuntimeError, value::RuntimeValue}; +use techscript_runtime::{ + context::Capability, + error::{RuntimeError, RuntimeErrorKind}, + value::RuntimeValue, +}; impl StdlibRegistry { pub fn register_notification(&mut self) { @@ -13,7 +17,17 @@ impl StdlibRegistry { Rc::new(StdFunction { name: "show".to_string(), arity: 2, - callback: |_ctx, args| { + callback: |ctx, args| { + if !ctx.config.capabilities.contains(&Capability::Process) { + return Err(RuntimeError::new( + RuntimeErrorKind::InvalidOperation( + "Security policy violation: Process capability is denied" + .to_string(), + ), + None, + None, + )); + } let title = args[0].to_string(); let body = args[1].to_string(); #[cfg(target_os = "windows")] @@ -46,7 +60,17 @@ impl StdlibRegistry { Rc::new(StdFunction { name: "alert".to_string(), arity: 1, - callback: |_ctx, args| { + callback: |ctx, args| { + if !ctx.config.capabilities.contains(&Capability::Process) { + return Err(RuntimeError::new( + RuntimeErrorKind::InvalidOperation( + "Security policy violation: Process capability is denied" + .to_string(), + ), + None, + None, + )); + } let msg = args[0].to_string(); #[cfg(target_os = "windows")] { @@ -69,7 +93,7 @@ impl StdlibRegistry { name: "std.notification".to_string(), version: "1.0.0".to_string(), exports, - required_capabilities: Vec::new(), + required_capabilities: vec![Capability::Process], }, ); }