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

Make Security annotations work on interfaces #22540

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rmanibus
Copy link
Contributor

Fix #22530

@rmanibus rmanibus force-pushed the fix_22530 branch 2 times, most recently from b6c65e2 to 22f7fd9 Compare December 28, 2021 12:14
@rmanibus rmanibus changed the title Make @RolesAllowed work on interfaces Make Security annotations work on interfaces Dec 28, 2021
@rmanibus rmanibus force-pushed the fix_22530 branch 3 times, most recently from 45cc56d to 669360a Compare December 29, 2021 09:13
@rmanibus rmanibus marked this pull request as ready for review December 29, 2021 09:21
@rmanibus rmanibus force-pushed the fix_22530 branch 2 times, most recently from acd9052 to 0649a92 Compare December 29, 2021 09:27
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 29, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building 0649a92

Status Name Step Failures Logs Raw logs
Initial JDK 11 Build Build Failures Logs Raw logs

Failures

⚙️ Initial JDK 11 Build #

- Failing: extensions/security/deployment 
! Skipped: core/test-extension/deployment devtools/bom-descriptor-json docs and 309 more

📦 extensions/security/deployment

Failed to execute goal net.revelc.code:impsort-maven-plugin:1.6.2:check (check-imports) on project quarkus-security-deployment: Imports are not sorted in /home/runner/work/quarkus/quarkus/extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/CDIAccessDenyUnannotatedTest.java

@rmanibus rmanibus force-pushed the fix_22530 branch 4 times, most recently from 1809706 to 5d45643 Compare December 31, 2021 10:10
@gastaldi gastaldi requested review from geoand and sberyozkin January 4, 2022 03:14
@famod
Copy link
Member

famod commented Jan 4, 2022

FTR, crosslink: #22530 (comment)

@geoand
Copy link
Contributor

geoand commented Jan 4, 2022

I am not sure about this TBH given what @famod posted

@rmanibus
Copy link
Contributor Author

rmanibus commented Jan 4, 2022

It's still a step toward the second point: harmonize bean interface annotation handling across features. And it's not enabled by default !

@geoand
Copy link
Contributor

geoand commented Jan 4, 2022

I'll leave it up to @sberyozkin and @michalszynkiewicz

@sberyozkin
Copy link
Member

I'm off to the airport in an hour or so, so I'll comment when I'm back; also CC @stuartwdouglas

@rmanibus
Copy link
Contributor Author

hello @sberyozkin, any news on that topic ?

@gsmet
Copy link
Member

gsmet commented Jan 12, 2022

@mkouba I think your experience with CDI annotations and inheritance rules could be useful here.

@gsmet
Copy link
Member

gsmet commented Jan 12, 2022

@sberyozkin I agree it would be nice to have @stuartwdouglas 's opinion on this. I'm assigning this to you but it's really so that you coordinate the work on this. Thanks!

@sberyozkin
Copy link
Member

@gsmet Thanks, I definitely recall Stuart having some reservations, I'll try to find where he commented as well

@sberyozkin
Copy link
Member

Here is another issue, #16840. I see some CDI related concerns are raised there, Stuart does not have objections, @mkouba and @manovotn, @Ladicek, @michalszynkiewicz, can you comment on this PR please

@manovotn
Copy link
Contributor

Hm, do we really want a CDI-breaking feature like this? Personally I am -1 on this, at least in default settings (but then again, if not default, who's gonna use it :-/)

BTW if we want to implement it, this approach is fine but we could also just wire it directly into Arc, i.e. make it 'scan' interfaces for annotations.

@Ladicek
Copy link
Contributor

Ladicek commented Jan 13, 2022

My personal opinion is that JAX-RS screwed up by ignoring Common Annotations (though they probably had good reasons), and now we have to live with it. If so, I'd say it would be better to do it consistently in the CDI implementation, and not drive it by configuration, but by code. (Something like class MyResource implements @InheritCdiAnnotations MyJaxrsInterface -- yes I've recently learned too much about type annotations :-) )

@rmanibus
Copy link
Contributor Author

any update about this @sberyozkin @rsvoboda ? it is conflicted again, are you still planning to merge it ?

This comment has been minimized.

@rsvoboda
Copy link
Member

Some security tests aare failing, could be related

@sberyozkin could you please take a look at the proposed changes and decide?

@rmanibus
Copy link
Contributor Author

just rebased this

This comment has been minimized.

@sberyozkin
Copy link
Member

@rmanibus @rsvoboda Apologies for a delay, we are talking this very issue right now with the team (though as part of a different issue's discussion), let me CC @michalvavrik for now

@sberyozkin
Copy link
Member

@rmanibus Can you please give us a favor and check if it works as expected with the latest Quarkus release, for example, 3.9.3, and if it does not, please show the test hierarchy which does not work (interface and implementation class)

This comment has been minimized.

@rmanibus rmanibus force-pushed the fix_22530 branch 2 times, most recently from 18225cf to 16eb214 Compare April 16, 2024 23:41
@rmanibus
Copy link
Contributor Author

rmanibus commented Apr 16, 2024

@stuartwdouglas I was missing a null check, only one test is failing now:

[ERROR] io.quarkus.resteasy.reactive.server.test.security.DenyAllJaxRsTest.shouldDenyUnannotatedOverriddenOnInterfaceImplementor -- Time elapsed: 0.006 s <<< FAILURE!
java.lang.AssertionError: 
1 expectation failed.
Expected status code <403> but was <200>.

I am wondering if we should just remove this test. or at least we should execute it with this feature deactivated

@rmanibus
Copy link
Contributor Author

Is there a way I could trigger the CI myself ?

This comment has been minimized.

@rmanibus
Copy link
Contributor Author

@sberyozkin I disabled this feature for the failing test, please tell me if it's ok for you. Build is passing now

@rmanibus
Copy link
Contributor Author

@sberyozkin following up with this one

@rmanibus
Copy link
Contributor Author

@sberyozkin are you still interested in merging this ?

@sberyozkin
Copy link
Member

@rmanibus Sorry for keeping missing your pings, if I don't reply, ping me anytime on Zulip.

As far as this and similar issues are concerned, we've been analyzing and looking into them. It is hard to have a consistent treatment of this issue across REST and Resteasy stacks, but the effort is underway, it can take time but sooner or later we'll get the framework for supporting such cases in shape

@cescoffier
Copy link
Member

@sberyozkin What should we do here?

@cescoffier
Copy link
Member

@sberyozkin ping?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest area/resteasy-classic area/security triage/needs-feedback We are waiting for feedback. triage/needs-rebase This PR needs to be rebased first because it has merge conflicts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Security Annotations Does not work on JaxRS resource interface