Skip to content

fix: Hide internal data by making it auxiliary - #954

Merged
jvherweg merged 1 commit into
versions/2.0.0from
fix/visible-internal
Sep 14, 2021
Merged

jvherweg merged 1 commit into
versions/2.0.0from
fix/visible-internal

Conversation

@jvherweg

@jvherweg jvherweg commented Sep 9, 2021

Copy link
Copy Markdown
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.

@RubenVerborgh RubenVerborgh left a comment

Copy link
Copy Markdown
Member

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.

]
},
{
"comment": "Marks the /.internal/ storage container as an auxiliary resource, thereby hiding it from container representations.",

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread src/ldp/auxiliary/AuxiliaryStrategy.ts Outdated
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
Copy Markdown
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
Copy Markdown
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.

* 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
Copy Markdown
Member

Choose a reason for hiding this comment

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

breaking suggestion: isRequiredInRoot

@jvherweg
jvherweg force-pushed the fix/visible-internal branch from 1821252 to 0a81c75 Compare September 14, 2021 07:19
@jvherweg
jvherweg force-pushed the fix/visible-internal branch from 0a81c75 to 6c6b0c2 Compare September 14, 2021 07:32
@jvherweg
jvherweg merged commit 0271133 into versions/2.0.0 Sep 14, 2021
@jvherweg
jvherweg deleted the fix/visible-internal branch September 14, 2021 08:51
@jvherweg jvherweg added this to the v2.0.0 milestone Oct 8, 2021
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