Skip to content

Cannot deny fn* without denying the fn macros #1002

@jeroenvandijk

Description

@jeroenvandijk

version

0.10.49 and lower

platform

JVM

problem

We can't :deny fn* without denying the fn macros

(sci/eval-string "((fn* [a] a) 1)" {:deny ['fn*]}) ;=> clojure.lang.ExceptionInfo: fn* is not allowed! 
(sci/eval-string "((fn [a] a) 1)" {:deny ['fn*]})  ;=> clojure.lang.ExceptionInfo: fn* is not allowed!
(sci/eval-string "(defn f [a] a) (f a)" {:deny ['fn*]})  ;=> clojure.lang.ExceptionInfo: fn* is not allowed!
(sci/eval-string "(letfn [(f [a] a)] (f a))" {:deny ['fn*]})  ;=> clojure.lang.ExceptionInfo: fn* is not allowed!
(sci/eval-string "((bound-fn* (fn [a] a)) 1)" {:deny ['fn*]})  ;=> clojure.lang.ExceptionInfo: fn* is not allowed!
(sci/eval-string "((bound-fn [a] a) 1)" {:deny ['fn*]})  ;=> clojure.lang.ExceptionInfo: fn* is not allowed!

We see something similar when denying loop* and let*

 (sci/eval-string "(loop [i 10] (if (< i 0) :done (recur (dec i))))" {:deny ['loop*]})
clojure.lang.ExceptionInfo: loop* is not allowed! [at <repl>:1:1]
(sci/eval-string "(let [i 10] i)" {:deny ['let*]})
clojure.lang.ExceptionInfo: let* is not allowed! [at <repl>:1:1]

;; case is fine:
(sci/eval-string "(case 1 :ok)" {:deny ['case*]}) ;=> :ok

expected behavior

No error and the code would work like without the :deny since fn* is not called directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions