Skip to content
This repository was archived by the owner on Dec 15, 2018. It is now read-only.
This repository was archived by the owner on Dec 15, 2018. It is now read-only.

Can't get CSRF protection to work on CXF #202

@mthmulders

Description

@mthmulders

Setup:

  • OpenLiberty 18.0.0.2
  • Java EE 8
  • Ozark 1.0.0-m04 SNAPSHOT (20180903.132704-47)
  • MVC 1.0 SNAPSHOT (20180902.064053-77)

I'm trying to get CSRF protection to work on my controller. It looks like this:

    @CsrfProtected
    @POST
    @Path("/configure")
    @View("redirect:/hello")
    public void configure(@FormParam("locale") final String locale) {
        // left out
    }

If I read the spec correctly, the default for javax.mvc.security.CsrfProtection is EXPLICIT, saying that any method annotated with @CsrfProtected is to be protected.

I have a page that submits an HTML form to this controller method using POST, and it lacks the CSRF token parameter. I would expect the form submission to be rejected, but my controller method is hit.

Browsing through Ozark source code, I expect it is the responsibility of the CsrfValidateInterceptor class to perform this check. Using the debugger, I can see it is being instantiated, but the breakpoint in aroundReadFrom(...) is never hit.

Again, reproduction repo is https://github.com/mthmulders/openliberty-mvc. Any clues?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions