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

Java 21 regression bug: devserver (but not the production server) responds with HTTP 403 Forbidden when a securtiy constraint is defined upon a static file (e.g. index.html) #242

Open
cyril-briquet opened this issue Jul 2, 2024 · 6 comments
Assignees

Comments

@cyril-briquet
Copy link

When setting <java21> in appengine-web.xml,
and when a security constraint is defined over a static file (e.g. index.html), the devserver (and probably the production server) responds with HTTP 403 instead of serving the file.

Note that setting <java17> in appengine-web.xml is a workaround that prevents the issue.

test-files.txt

@cyril-briquet
Copy link
Author

and I forgot to add: ...despite being logged in.

@ludoch
Copy link
Collaborator

ludoch commented Jul 2, 2024

Devappserver code path is really different than prod. Could you also try to deploy in prod and report?
Thanks!

@ludoch ludoch self-assigned this Jul 2, 2024
@cyril-briquet
Copy link
Author

I deployed the test files (test-files.txt) on the production server. Apparently, the production server is not impacted by this bug.

@ludoch ludoch changed the title Java 21 regression bug: devserver (and probably the production server) responds with HTTP 403 Forbidden when a securtiy constraint is defined upon a static file (e.g. index.html) Java 21 regression bug: devserver (but not the production server) responds with HTTP 403 Forbidden when a securtiy constraint is defined upon a static file (e.g. index.html) Jul 3, 2024
@ludoch
Copy link
Collaborator

ludoch commented Jul 3, 2024

Thanks for attaching the repro app, @lachlan-roberts has already some ideas for a fix.

@lachlan-roberts
Copy link
Collaborator

Your admin security constraint is redundant as admin is already covered under *.

I have been able to reproduce this, and removing the admin constraint stopped me getting 403's.

I am still investigating why these are combining to not allow the request. In my tests I am not seeing the request for /index.html reach the Jetty security handler at all.

@lachlan-roberts
Copy link
Collaborator

I can even reproduce this on prod in the java8 runtime.

The request is not served by Jetty because it is detected as a static file, and I can see in app.yaml. It has defined the required role as admin instead of required which would allow any user.

- url: (/index\.html)
  static_files: __static__\1
  upload: __NOT_USED__
  require_matching_file: True
  login: admin
  secure: always

This is different to how these constrains would combine in the servlet spec which should go to required. So if the request were to reach Jetty it should serve the index.html.

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

No branches or pull requests

3 participants