Repository: wicket Updated Branches: refs/heads/wicket-7.x beb7421e7 -> 139f6248a
Add a section for CsrfPreventionRequestCycleListener Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/139f6248 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/139f6248 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/139f6248 Branch: refs/heads/wicket-7.x Commit: 139f6248a8c4c1accb3345e2c410ec1b27ecd499 Parents: beb7421 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Sun Aug 28 23:22:27 2016 +0200 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Sun Aug 28 23:24:00 2016 +0200 ---------------------------------------------------------------------- .../src/docs/guide/security/security_4_1.gdoc | 18 ++++++++++++++++++ wicket-user-guide/src/docs/guide/toc.yml | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/139f6248/wicket-user-guide/src/docs/guide/security/security_4_1.gdoc ---------------------------------------------------------------------- diff --git a/wicket-user-guide/src/docs/guide/security/security_4_1.gdoc b/wicket-user-guide/src/docs/guide/security/security_4_1.gdoc new file mode 100644 index 0000000..0ed7906 --- /dev/null +++ b/wicket-user-guide/src/docs/guide/security/security_4_1.gdoc @@ -0,0 +1,18 @@ + +@CryptoMapper@ helps preventing CSRF attacks by making the urls impossible to be guessed by an attacker but still there is some theoretical chance this to happen. + +To further help against this kind of vulnerability Wicket provides @CsrfPreventionRequestCycleListener@ - a @IRequestCycleListener@ that forbids requests made from a different origin. By default only actions are forbidden, i.e. a request coming from different origin cannot execute @Link#onClick()@ or submit forms (@Form#onSubmit()@). Any request to render pages are still allowed so Wicket pages could be easily embedded in other applications. + +MyApplication.java +{code} + @Override + protected void init() { + super.init(); + getRequestCycleListeners().add(new CsrfPreventionRequestCycleListener()); + // ... + } +{code} + +@CsrfPreventionRequestCycleListener@ is highly configurable. It allows to define a whitelist of allowed origins via @addAcceptedOrigin(String acceptedOrigin)@, to enable/disable it dynamically by overriding @isEnabled()@, to define different kind of actions when a request is rejected or allowed, to set custom error message and code for the rejected requests. + +@CsrfPreventionRequestCycleListener@ is not an alternative to @CryptoMapper@! Both of them could be used separately or in tandem to prevent CSRF attacks depending on the application requirements. http://git-wip-us.apache.org/repos/asf/wicket/blob/139f6248/wicket-user-guide/src/docs/guide/toc.yml ---------------------------------------------------------------------- diff --git a/wicket-user-guide/src/docs/guide/toc.yml b/wicket-user-guide/src/docs/guide/toc.yml index e3e0603..e6b89cf 100644 --- a/wicket-user-guide/src/docs/guide/toc.yml +++ b/wicket-user-guide/src/docs/guide/toc.yml @@ -175,7 +175,8 @@ security: security_1: Authentication security_2: Authorizations security_3: Using HTTPS protocol - security_4: URLs encryption in detail + security_4: URLs encryption in detail + security_4_1: CSRF protection security_5: Package Resource Guard security_6: External Security Checks security_7: Summary
