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

fix: Hide internal data by making it auxiliary #954

Merged
merged 1 commit into from
Sep 14, 2021

Conversation

joachimvh
Copy link
Member

Closes #892

I did not create an auxiliary strategy that identifies all resources starting with an . as auxiliary. Some reasons:
The strategy requires there to be an associated resource for an auxiliary resource. The most logical choice would be the container they are located in. The issue is that locking happens on the associated resource, so all access to any of those resources (in the same container) would require the same lock. Might not be horrible but perhaps also not great. On the other hand it is also not possible to construct an auxiliary identifier when taking an associated identifier as input. This is used when deleting a resource to first delete its auxiliary resources.

The locking issue is perhaps not that bad though, and the other parts might indicate an issue with the current implementation that can potentially be resolved, so if this is something that would be required we can make a new issue to support those as auxiliary resources.

Copy link
Member

@RubenVerborgh RubenVerborgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good for me, but I find the solution a bit weird perhaps.

@@ -56,6 +56,19 @@
"PathBasedAuthorizer:_paths_value": { "@type": "DenyAllAuthorizer" }
}
]
},
{
"comment": "Marks the /.internal/ storage container as an auxiliary resource, thereby hiding it from container representations.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that marking it as an auxiliary resource, just for the effect that has, is the right way.

/.internal/ does otherwise not behave as an auxiliary resource, does it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, since most other requests where auxiliary features are relevant will be blocked of by the authorizer preventing access to the /.internal/ container.

I'm also not the biggest fan of this solution, so I'm even ok with reverting this, but it is currently the simplest way we have to hide resources. But it definitely is sort of hacky. I mostly went with it since it's only a config change and doesn't actually change any code.

Another solution would be to have the DataAccessorBasedStore (or a new store type) take a list of regexes to ignore, but that class already does a lot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me—good to proceed.

config/storage/key-value/resource-store.json Show resolved Hide resolved
@@ -10,7 +10,7 @@ import type { AuxiliaryIdentifierStrategy } from './AuxiliaryIdentifierStrategy'
*/
export interface AuxiliaryStrategy extends AuxiliaryIdentifierStrategy {
/**
* Whether this auxiliary resource in a root storage container.
* Whether this auxiliary resource is required in a root storage container.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I understood this sentence correctly, but do we mean this?

Suggested change
* Whether this auxiliary resource is required in a root storage container.
* Whether the root storage container requires this auxiliary resource to be present.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much. The current auxiliary implementation is based on what is needed for acl files and might be overtuned a bit for that, but one of the features there is that you can't delete an acl file that is stored in a pim:Storage container.

@@ -10,7 +10,7 @@ import type { AuxiliaryIdentifierStrategy } from './AuxiliaryIdentifierStrategy'
*/
export interface AuxiliaryStrategy extends AuxiliaryIdentifierStrategy {
/**
* Whether this auxiliary resource in a root storage container.
* Whether this auxiliary resource is required in a root storage container.
* If yes, this means they can't be deleted individually from such a container.
* @param identifier - Identifier of the auxiliary resource.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

breaking suggestion: isRequiredInRoot

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

Successfully merging this pull request may close these issues.

2 participants