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

SEC-3049: Adding @Validated annotation creates Proxy when in AspectJ mode #3215

Closed
spring-projects-issues opened this issue Jul 20, 2015 · 4 comments
Assignees
Labels
in: config An issue in spring-security-config status: declined A suggestion or change that we don't feel we should currently apply type: bug A general bug type: jira An issue that was migrated from JIRA

Comments

@spring-projects-issues
Copy link

Craig Chapman (Migrated from SEC-3049) said:

When configuring Global Method Security and/or Transaction Management in AspectJ mode, the advised class is not created as a proxy. However, if you wish to then add JSR-303 validation to the advised class by adding @validated annotation, the class is then proxied without warning.

See attached sample that demonstrates this and note that I am using Spring Security version 4.0.2.CI-SNAPSHOT due to SEC-3005.

@spring-projects-issues
Copy link
Author

Craig Chapman said:

Note that it is the creation of MethodValidationPostProcessor bean and @validated annotation that causes the class to be proxied. MethodValidationPostProcessor is required for JSR-303 method parameter validation...

@Bean
public MethodValidationPostProcessor methodValidationPostProcessor() {
     return new MethodValidationPostProcessor();
}

It may be that not much can be done about this issue and that it is deemed as misconfiguration but it should probably be documented.

@spring-projects-issues
Copy link
Author

Rob Winch said:

craigchapman1975 Thanks for the report. Is this causing any problems with the application? Spring Security only controls if Spring Security is using aspectj or proxying the class...it cannot control what other parts of your configuration are doing to the objects. If there are no problematic side effects, I think this is a works as designed. If your application is no longer being secured properly, then we have something we need to sort out.

@spring-projects-issues
Copy link
Author

Craig Chapman said:

Hi Rob,

There are no security side effects as far as I can tell, though I haven't spent much time investigating.

I'm inclined to agree with you that it is as designed and just something to be mindful of when using AspectJ mode.

Cheers,
Craig

@spring-projects-issues
Copy link
Author

Rob Winch said:

Thanks In light of our conversation, I'm resolving this as works as designed

@spring-projects-issues spring-projects-issues added in: config An issue in spring-security-config Resolved type: bug A general bug type: jira An issue that was migrated from JIRA labels Feb 5, 2016
@rwinch rwinch added the status: declined A suggestion or change that we don't feel we should currently apply label May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: config An issue in spring-security-config status: declined A suggestion or change that we don't feel we should currently apply type: bug A general bug type: jira An issue that was migrated from JIRA
Projects
None yet
Development

No branches or pull requests

2 participants