T09 · Insecure Skill Coding Practices
- Location
scripts/eval_expression.py:121- Finding
Textual denylist bypass permits unrestricted WolframKernel operations
- Content
View full analysis
list[str]: hits: list[str] = [] for symbol in UNSAFE_SYMBOLS: pattern = rf"(? ResultPayload: if not args.allow_unsafe: blocked = find_unsafe_symbols(args.expr) if blocked: blocked_text = ", ".join(sorted(set(blocked))) raise EvaluationError( "Expression blocked by safety policy (unsafe symbols detected): " f"{blocked_text}. Use --allow-unsafe only in an isolated environment." ) ``` The accepted expression is then passed directly to a full WolframKernel: ```python with WolframLanguageSession(kernel=kernel) as session: version = evaluate_with_timeout(session, wlexpr("$Version"), args.timeout) exact_value = evaluate_with_timeout(session, wlexpr(args.expr), args.timeout) failed_exact = evaluate_with_timeout( session, wl.SameQ(exact_value, wlexpr("$Failed")), args.timeout, ) if bool(failed_exact): raise EvaluationError("Exact evaluation returned $Failed (invalid expression or runtime error).") numeric_value = evaluate_with_timeout( session, wl.N(wlexpr(args.expr), args.precision), args.timeout, ) ``` ### Technical Analysis The safety mechanism scans raw source text for a finite list of literal dangerous symbol names. This is not a reliable security ...[truncated 2673 chars]- Remediation
View remediation
