Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g:form csrf protection adjustments #550

Merged
merged 1 commit into from
Nov 22, 2024
Merged

Conversation

codeconsole
Copy link
Contributor

Move configureCsrf into method that can also be invoked later for late filterChain registration additions.
Iignore situations where FilterChainProxy exists in classpath, but is not being used.

…e filterChain registration additions. Also ignore situations where FilterChainProxy exists in classpath, but is not being used.
@@ -85,7 +90,7 @@ class FormTagLib implements ApplicationContextAware, InitializingBean, TagLibrar
springSecurityCsrfTokenClass =
Class.forName("org.springframework.security.web.csrf.CsrfToken")
}
} catch (ClassNotFoundException ignore) {}
} catch (ClassNotFoundException | BeansException ignore) {}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works. My only question is you want to ignore all bean exceptions rather than just NoSuchBeanDefinitionException?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkoehm because there could be a situation where you have no bean and also a situation where you have 2 beans the you should only have 1. this catches both of them. There could very well be a situation where somebody mistakenly has a duplicate registration. No need to fail because of that and both of those exception types extend BeansException.

@codeconsole codeconsole merged commit 3b8f4af into grails:7.0.x Nov 22, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants