Skip to content

Proxito: remove version_type #10220

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

Open
stsewd opened this issue Apr 3, 2023 · 0 comments
Open

Proxito: remove version_type #10220

stsewd opened this issue Apr 3, 2023 · 0 comments
Labels
Improvement Minor improvement to code Needed: design decision A core team decision is required

Comments

@stsewd
Copy link
Member

stsewd commented Apr 3, 2023

We have a version type attribute that all calls to storage must use.

# We force all storage calls to use internal versions
# unless explicitly set to external.
version_type = INTERNAL

This is to prevent serving from external versions on non-external domains and vice versa, but I think this check should be done by the caller, this is using the right manager to search for external or normal versions.

In recent proxito refactors, I added these checks in several places, so setting this attribute manually shouldn't be required

# We force all storage calls to use the external versions storage,
# since we are serving an external version.
# The version that results from the unresolve_path() call already is
# validated to use the correct manager, this is here to add defense in
# depth against serving the wrong version.
if unresolved_domain.is_from_external_domain:
self.version_type = EXTERNAL

Adding this double layer of protection seems good, but is also kind of easy to miss changing that attribute to external and still ending exposing internal versions from external domains. And it's also kind of confusing when the version doesn't match the self.version_type attribute (usually because we forgot to change the attribute to match the current version being served).

Just a thought, if we are okay with that double check we can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Minor improvement to code Needed: design decision A core team decision is required
Projects
None yet
Development

No branches or pull requests

1 participant