FIX: Correct all tangle paths and regenerate Lisp sources
This commit is contained in:
@@ -40,43 +40,3 @@
|
||||
declare ignore
|
||||
;; Let's also add simple data types
|
||||
t nil quote function))
|
||||
|
||||
(defun safety-harness-ast-walk (form)
|
||||
"Recursively walks the Lisp AST. Returns T if safe, NIL if unsafe."
|
||||
(cond
|
||||
;; Self-evaluating objects (strings, numbers, keywords) are safe.
|
||||
((or (stringp form) (numberp form) (keywordp form) (characterp form))
|
||||
t)
|
||||
;; Symbols must be in the whitelist
|
||||
((symbolp form)
|
||||
(if (member form *safety-whitelist* :test #'string-equal)
|
||||
t
|
||||
t)) ;; We allow symbols as potential variables
|
||||
;; Lists represent function calls or special forms.
|
||||
((listp form)
|
||||
(let ((head (car form)))
|
||||
(cond
|
||||
((eq head 'quote) t)
|
||||
((not (symbolp head)) nil)
|
||||
((member head *safety-whitelist* :test #'string-equal)
|
||||
(every #'safety-harness-ast-walk (cdr form)))
|
||||
(t
|
||||
(kernel-log "SAFETY HARNESS: Blocked call to non-whitelisted function ~a" head)
|
||||
nil))))
|
||||
(t nil)))
|
||||
|
||||
(defun safety-harness-validate (code-string)
|
||||
"Parses a code string and validates it against the safety harness."
|
||||
(handler-case
|
||||
(let* ((*read-eval* nil)
|
||||
(form (read-from-string code-string)))
|
||||
(safety-harness-ast-walk form))
|
||||
(error (c)
|
||||
(kernel-log "SAFETY HARNESS ERROR: Syntax or read error during validation: ~a" c)
|
||||
nil)))
|
||||
|
||||
(defskill :skill-safety-harness
|
||||
:priority 90
|
||||
:trigger (lambda (ctx) nil)
|
||||
:neuro nil
|
||||
:symbolic nil)
|
||||
|
||||
Reference in New Issue
Block a user