Skip to content

Global search on elasticsearch for private repositories #6107

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

Closed
maldag opened this issue Aug 27, 2019 · 5 comments
Closed

Global search on elasticsearch for private repositories #6107

maldag opened this issue Aug 27, 2019 · 5 comments
Labels
Status: stale Issue will be considered inactive soon

Comments

@maldag
Copy link

maldag commented Aug 27, 2019

I'm running a local instance of RTD (3.7.2) combined with elasticsearch.
Searching the whole RTD instance from the landing page also returns search entries belonging to private repositories. This seems to be a security flaw since the index probably doesn't care about access rights on the webpage.

The major goal I'm trying to achieve is hosting development and user documentation on the same server using private repositories for developers (which would access and search both) as well as user documentation for people without credentials.

Is there a way to propagate repository rights to elasticsearch?

@stsewd
Copy link
Member

stsewd commented Aug 27, 2019

Did you set the privacy level of those projects to private (project and versions)?

If so, I think we missed filtering search results using the privacy level here. But on the commercial site we override our classes to respect privacy levels.

@stsewd stsewd added the Needed: more information A reply from issue author is required label Aug 27, 2019
@maldag
Copy link
Author

maldag commented Aug 28, 2019

Yes, I did setup two projects with one version (latest) each. Project A is a public project with public version and project B is a private project with a private version.

Elasticsearch will index both (Autoindex set to true) and will return results from the private project when not logged in as an appropriate user.

Would you be willing to share that template with me or is there any help for this?
Right now I'm using an http-auth mechanism in nginx to prevent the global search for the public when deploying, but that's not really slick since it prevents public projects to provide the downloads and the api is still publicly available.

It would make sense to me if elasticsearch will generate n-indices based on permissions (or one index per project) and offer only the ones that fit the user permissions.

@no-response no-response bot removed the Needed: more information A reply from issue author is required label Aug 28, 2019
@stsewd
Copy link
Member

stsewd commented Oct 8, 2019

Just in case, this is the class the needs to be overriden

class PageSearch(SettingsOverrideObject):
"""
Allow this class to be overridden based on CLASS_OVERRIDES setting.
This is primary used on the .com to adjust how we filter our search queries
"""
_default_class = PageSearchBase

Also, we are in the process of moving some private code to the public repo.

@stsewd
Copy link
Member

stsewd commented Nov 13, 2019

Just a note here, we are in process to remove the privacy level from all projects #6194

@humitos humitos added this to the Search improvements milestone Nov 18, 2019
@stale
Copy link

stale bot commented Jan 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: stale Issue will be considered inactive soon label Jan 2, 2020
@stale stale bot closed this as completed Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: stale Issue will be considered inactive soon
Projects
None yet
Development

No branches or pull requests

3 participants