Skip to content

Commit

Permalink
system property for middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
frenchy64 committed Apr 22, 2024
1 parent 32cd8b8 commit 21b056b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/compojure/api/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
(routes/create nil nil {} nil (partial handle handlers))))

(defmacro middleware
"Wraps routes with given middleware using thread-first macro.
"Wraps routes with given middlewares using thread-first macro.
Note that middlewares will be executed even if routes in body
do not match the request uri. Be careful with middleware that
Expand All @@ -47,6 +47,10 @@
:deprecated "1.1.14"
:superseded-by "route-middleware"}
[middleware & body]
(assert (= "true" (System/getProperty "compojure.api.core.allow-dangerous-middleware"))
(str "compojure.api.core.middleware is deprecated because of security issues. "
"Please use route-middleware instead. "
"Set compojure.api.core.allow-dangerous-middleware=true to keep using middleware."))
`(let [body# (routes ~@body)
wrap-mw# (mw/compose-middleware ~middleware)]
(routes/create nil nil {} [body#] (wrap-mw# body#))))
Expand Down

0 comments on commit 21b056b

Please sign in to comment.