File tree 3 files changed +10
-3
lines changed
3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ The following configuration keys are supported:
121
121
122
122
- ` :anti-forgery ` -
123
123
Set to true to add CSRF protection via the [ ring-anti-forgery] [ 5 ]
124
- library.
124
+ library, or supply a map of options to be passed to the middleware .
125
125
126
126
- ` :content-type-options ` -
127
127
Prevents attacks based around media-type confusion. See:
Original file line number Diff line number Diff line change 47
47
:session {:flash true
48
48
:cookie-attrs {:http-only true }
49
49
:store default-session-store }
50
- :security {:anti-forgery true
50
+ :security {:anti-forgery { :safe-header " X-Ring-Anti-Forgery " }
51
51
:frame-options :sameorigin
52
52
:content-type-options :nosniff }
53
53
:static {:resources " public" }
Original file line number Diff line number Diff line change 241
241
(assoc-in [:security :xss-protection :mode ] :block ))))
242
242
resp (handler (request :get " /" ))]
243
243
(is (not (nil? (get-in resp [:headers " X-XSS-Protection" ]))))
244
- (is (= (get-in resp [:headers " X-XSS-Protection" ]) " 1; mode=block" )))))
244
+ (is (= (get-in resp [:headers " X-XSS-Protection" ]) " 1; mode=block" ))))
245
+
246
+ (testing " anti-forgery"
247
+ (let [handler (-> (constantly (response " foo" ))
248
+ (wrap-defaults site-defaults))]
249
+ (is (= 403 (:status (handler (request :post " /" )))))
250
+ (is (= 200 (:status (handler (-> (request :post " /" )
251
+ (header " X-Ring-Anti-Forgery" " 1" )))))))))
You can’t perform that action at this time.
0 commit comments