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 hydra documentation respect access control #2719

Open
armellarcier opened this issue Apr 9, 2019 · 11 comments
Open

Make hydra documentation respect access control #2719

armellarcier opened this issue Apr 9, 2019 · 11 comments

Comments

@armellarcier
Copy link

My api has public and private entries.

But the hydra and swagger documentations expose all of them.

As a result, a connected user that has access to only parts of the api will see the whole documentation which is not a good thing for security.

More importantly, the admin is broken in that case because it tries to fetch every resource in the hydra documentation.

@teohhanhui
Copy link
Contributor

The documentation should be available even for operations that require authentication. There is nothing wrong with that. "Security by obscurity" is bad.

@teohhanhui
Copy link
Contributor

More importantly, the admin is broken in that case because it tries to fetch every resource in the hydra documentation.

Then that's a bug in the admin.

@armellarcier
Copy link
Author

I agree. I first created an issue in the admin repository. I ended up overriding the documentation parser.
But still, I would like the ability to hide entrypoints from the swagger ui based on access control. It’s more of a feature request

@armellarcier
Copy link
Author

Maybe it can be done in userland?

@er1z
Copy link
Contributor

er1z commented May 10, 2019

Just decorate documentation normalizer.

@dunglas
Copy link
Member

dunglas commented May 10, 2019

It's a very frequent request. It would be nice to have it in core (with a flag to enable or disable this feature).

@dunglas
Copy link
Member

dunglas commented May 10, 2019

Basically it means executing the security expression in the documentation normalizers.

@armellarcier
Copy link
Author

I really need this and I’d need some directions to push a PR quickly. @dunglas what modifications and configuration options would you like to see?

@dunglas
Copy link
Member

dunglas commented May 17, 2019

I suggest to inject the Security Expression executor in DocumentationNormalizer, and to security expression of every resource class before this line and of every operation here.

If the security expression can be executed (it doesn't depend of the current object but only use is_granted() for instance), then I would skip generating the documentation of not allowed operations.

The same logic must be adapted for the OpenAPI DocumentationNormalizer.

@gomcodoctor
Copy link

I am working on it, i wanted to decorate DocumentationNormalizer but all functions are private !

@klobastov
Copy link

Is there any news on this topic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants