How is the policy feature meant to be used? #278

Open
opened 2026-10-04 18:56:07 +00:00 by mih · 2 comments
Owner

I am trying to wrap my head around how the new user/policy mapping feature can be used. The targeted purpose is clear to me. I am describing it here nevertheless to establish a shared understanding.

Being able to declare access policies allows for differentiating access within a dumpthings collection.

Previously, users were forced to create an additional collection whenever a single record (or record part) required a different target audience constraint. This exploded workflow complexity for users and curators. Now a single collection will be enough for most use cases. The primary reason for another collection is the need for a different schema.

Policies are read access policies

The handling of write access is handled very differently. Any user with write access to a collection can write any information to the collection, but only (ever) to their personal inbox. Write access only enables the submission of "candidate updates". The inclusion into a collection is subject to a curator's decision to access and/or rewrite it.

Policies are opaque tags

The label policy could be misunderstood for something like an ODLR policy. But this is not the case. It is a literal tag. While this tag can in fact be an ODLR policy identifier, the service makes not attempt to interpret it in any way. The literal string SECRET is a suitable "policy". It has per se no meaning. Its meaning comes from the service using it as a literal tag that is matched against a set of "approved" tags for user requesting a record (for read).

User-policy mappings are separate from records

The service needs to look up whether a particular requesting user is approved for a particular policy that a specific record may be tagged with. This mapping is independent and outside the record itself.

dumpthings "tokens" are user identities

The term "token" is used in the documentation in many ways. However, a "token" always refers to a user identity. This identity may not be specific to a particular user (e.g., a collection can declare a "default token", which refers to a pre-crafted identity with arbitrary permissions that is assigned to unauthenticated requests), or may not be a 1:1 mapping (e.g., any number of forgejo access tokens can refer to a single forgejo user, and all uniformly evaluate to a single forgejo-defined permission setup for that user).


Now for my question/concerns/thoughts/.... going through scenarios that the documentation is presently not explicit about.

This is a useful feature. Even though it is presently optional for a collection, it should be considered standard/enabled in the long-run for any collection -- because the first access-level differentiation will trigger it. Therefore I am considering policy-enforcement to be enabled for any collection for all of the following.

Mechanics of an "opt-out read" collection

Such a collection is, for example, a collection that has a "default token" with READ_CURATED permissions. If it has a record that may not be read by a non-authenticated user (or only be a specific authenticated user), that record need to get a policy tag.

  • to enable this feature, policy_annotation_tag has to be set (to a single value).
  • a default_policy must not be set to keep the "default token" permissions effective.
  • a user->policy mapping has to be created that approves a specific policy tag for the relevant user
  • the respective record need to have this policy tag set

User/policy mapping management is only needed for the "opt-out" records.

Mechanics of an "opt-in read" collection

Such a collection is, for example, a collection that has a "default token" with NOTHING permissions. Any record can only be read by an authenticated user. Records can now use policy tags to establish additional conditions for authenticated users to match, before they gain access.

  • to enable this feature, policy_annotation_tag has to be set (to a single value).
  • a default_policy can be set to cover a "most users" scenario.
  • a user->policy mapping has to be created that approves a specific (or default) policy tag for the relevant user
  • all records must have an effective policy tag, either via default policy or explicitly

User/policy mapping management is required for every user.

User/policy mapping management mechanics

It is unclear to me, where this is supposed to be located in dumpthing's role concepts. As expressed in #275, the effectively placed into the hands of an individual collections curator. This is different from the overall permission setup of a collection, which can only be done by an administrator. This feels fuzzy to me.

Access policies are the feature to reflect legal constraints. Whether or not a particular person has signed a specific DUA, or is part of a specific group/organization will often be information globally associated with a requester, and not specific to a particular collection.

Dumpthings places the user/policy mapping into the scope of an individual collection. And it places the responsibility for its maintenance (and congruence with record tags) into the hands of a collection curator.
This makes sense, because a curator has ultimate reign over a record, and they can effectively determine the conditions with which information becomes available.

However, a collection curator deals with metadata records, and with (abstract) conditions that determine access, but they do not generally know who fulfills these conditions, when, and for how long.

Moreover, dumpthings wants a mapping from user identity to approved policy tags. This makes sense, because that is ultimately the mapping that is required to decide whether or not to show a particular record.

However, this is unlikely to be the way this information is (or becomes) available. I suspect that real-life applications will have a mix of structural sources (e.g., membership in a particular organization/unit), and case-by-case properties (e.g., signed a particular DUA). These will be provided by different sources and update at different frequencies.

It feels clunky and fragile to require this information to be merged into a single mapping with an external mechanism and on top of that to require a curator to choose an appropriate timing to apply it (routinely).


Musings

I am writing this before having had any feedback on the above, so I might be missing the mark by quite a margin...

However, I do wonder whether it is necessary or even useful to invent more mechanisms like policy_mapping and policy mapping reloading endpoints with special permissions....

This appears to be really just a metadata query problem like any other that dumpthings is built to serve. Why not have a simple schema for a "built in" collection where records represent "policies" and their properties carry all essential information, including a mapping to "approved users".

If that is the underlying mechanism, we would have all standard features available to attach existing workflows and agents to this process. Certain people can have certain permissions for this collection. Curators can apply appropriate levels of scrutiny to incoming information from individual sources, and automatically (machine-)accept others.

This would change the nature of the mapping from user->policy to policy->user -- but it would arguable reflect the "source" nature of the problem space more adequately. Internally, an implementation can reverse the mapping whenever it makes sense.

I am trying to wrap my head around how the new user/policy mapping feature can be used. The targeted purpose is clear to me. I am describing it here nevertheless to establish a shared understanding. > Being able to declare access policies allows for differentiating access *within* a dumpthings collection. Previously, users were forced to create an additional collection whenever a single record (or record part) required a different target audience constraint. This exploded workflow complexity for users and curators. Now a single collection will be enough for most use cases. The primary reason for another collection is the need for a different schema. > Policies are *read* access policies The handling of write access is handled very differently. Any user with write access to a collection can write *any* information to the collection, but only (ever) to their personal inbox. Write access only enables the submission of "candidate updates". The inclusion into a collection is subject to a curator's decision to access and/or rewrite it. > Policies are *opaque* tags The label policy could be misunderstood for something like an [ODLR policy](https://www.w3.org/TR/odrl-model/#policy). But this is not the case. It is a literal tag. While this tag can in fact be an ODLR policy identifier, the service makes not attempt to interpret it in any way. The literal string `SECRET` is a suitable "policy". It has per se no meaning. Its meaning comes from the service using it as a literal tag that is matched against a set of "approved" tags for user requesting a record (for read). > User-policy mappings are separate from records The service needs to look up whether a particular requesting user is approved for a particular policy that a specific record may be tagged with. This mapping is independent and outside the record itself. > dumpthings "tokens" are user identities The term "token" is used in the documentation in many ways. However, a "token" always refers to a user identity. This identity may not be specific to a particular user (e.g., a collection can declare a "default token", which refers to a pre-crafted identity with arbitrary permissions that is assigned to unauthenticated requests), or may not be a 1:1 mapping (e.g., any number of forgejo access tokens can refer to a single forgejo user, and all uniformly evaluate to a single forgejo-defined permission setup for that user). --- Now for my question/concerns/thoughts/.... going through scenarios that the documentation is presently not explicit about. This is a useful feature. Even though it is presently optional for a collection, it should be considered standard/enabled in the long-run for any collection -- because the first access-level differentiation will trigger it. Therefore I am considering policy-enforcement to be enabled for any collection for all of the following. ### Mechanics of an "opt-out read" collection Such a collection is, for example, a collection that has a "default token" with `READ_CURATED` permissions. If it has a record that may not be read by a non-authenticated user (or only be a specific authenticated user), that record need to get a policy tag. - to enable this feature, `policy_annotation_tag` has to be set (to a single value). - a `default_policy` *must not* be set to keep the "default token" permissions effective. - a user->policy mapping has to be created that approves a specific policy tag for the relevant user - the respective record need to have this policy tag set User/policy mapping management is only needed for the "opt-out" records. ### Mechanics of an "opt-in read" collection Such a collection is, for example, a collection that has a "default token" with `NOTHING` permissions. Any record can only be read by an authenticated user. Records can now use policy tags to establish *additional* conditions for authenticated users to match, before they gain access. - to enable this feature, `policy_annotation_tag` has to be set (to a single value). - a `default_policy` *can be* set to cover a "most users" scenario. - a user->policy mapping has to be created that approves a specific (or default) policy tag for the relevant user - all records must have an effective policy tag, either via `default policy` or explicitly User/policy mapping management is required for *every* user. ### User/policy mapping management mechanics It is unclear to me, where this is supposed to be located in dumpthing's role concepts. As expressed in #275, the effectively placed into the hands of an individual collections curator. This is different from the overall permission setup of a collection, which can only be done by an administrator. This feels fuzzy to me. Access policies are the feature to reflect legal constraints. Whether or not a particular person has signed a specific DUA, or is part of a specific group/organization will often be information globally associated with a requester, and not specific to a particular collection. Dumpthings places the user/policy mapping into the scope of an individual collection. And it places the responsibility for its maintenance (and congruence with record tags) into the hands of a collection curator. This makes sense, because a curator has ultimate reign over a record, and they can effectively determine the conditions with which information becomes available. However, a collection curator deals with metadata records, and with (abstract) conditions that determine access, but they do not generally know *who* fulfills these conditions, when, and for how long. Moreover, dumpthings wants a mapping from user identity to approved policy tags. This makes sense, because that is ultimately the mapping that is required to decide whether or not to show a particular record. However, this is unlikely to be the way this information is (or becomes) available. I suspect that real-life applications will have a mix of structural sources (e.g., membership in a particular organization/unit), and case-by-case properties (e.g., signed a particular DUA). These will be provided by different sources and update at different frequencies. It feels clunky and fragile to require this information to be merged into a single mapping with an external mechanism and on top of that to require a curator to choose an appropriate timing to apply it (routinely). --- ### Musings I am writing this before having had any feedback on the above, so I might be missing the mark by quite a margin... However, I do wonder whether it is necessary or even useful to invent more mechanisms like `policy_mapping` and policy mapping reloading endpoints with special permissions.... This appears to be really just a metadata query problem like any other that dumpthings is built to serve. Why not have a simple schema for a "built in" collection where records represent "policies" and their properties carry all essential information, including a mapping to "approved users". If that is the underlying mechanism, we would have all standard features available to attach existing workflows and agents to this process. Certain people can have certain permissions for this collection. Curators can apply appropriate levels of scrutiny to incoming information from individual sources, and automatically (machine-)accept others. This would change the nature of the mapping from user->policy to policy->user -- but it would arguable reflect the "source" nature of the problem space more adequately. Internally, an implementation can reverse the mapping whenever it makes sense.
Owner

Thanks @mih for the writeup.

Generally, most of the described concepts and functionality exists exactly as described in the in the issue.

[...]

Being able to declare access policies allows for differentiating access within a dumpthings collection.
[...]

This is supported

[...]

Policies are read access policies
[...]

Yes, write access is not affected by policies

[...]

Policies are opaque tags

The label policy could be misunderstood for something like an ODLR policy. But this is not the case. It is a literal tag. While this tag can in fact be an ODLR policy identifier, the service makes not attempt to interpret it in any way. The literal string SECRET is a suitable "policy". It has per se no meaning. Its meaning comes from the service using it as a literal tag that is matched against a set of "approved" tags for user requesting a record (for read).
[...]

Yes (since 6.5.1)

[...]

User-policy mappings are separate from records

The service needs to look up whether a particular requesting user is approved for a particular policy that a specific record may be tagged with. This mapping is independent and outside the record itself.

[...]

Yes

Opt-out and opt-in

If I understand the description of opt-out and opt-in correctly, they can be implemented via the default_policy-property.

Opt-out

Opt-out functionality:

  1. The default for any user is to be able to read a record
  2. Mark records that should not be read by everybody with a policy -> only users who are assigned the policy can read the record
Opt-in

Opt-in functionality:

  1. The default for any user is NOT to be able to read a record
  2. Mark records that should be read by specific users with a policy that is associated with the users
Implementation

Because the token check precedes the policy check, both scenarios require a token-based READ_CURATED permission.

The difference between opt-out and opt-in is determined by the default policy.

Opt-out:

  • Default policy is not set -> everybody can read record without a policy
  • Add a policy-annotation to records that should only be read by users that are associated with the policy

Opt-in:

  • Default policy is set -> only people that are associated with the default policy can read a record (and if nobody is associated with the default policy, nobody can read any record by default)
  • Add a policy annotation to records that should be read by users that are associated with the policy

In both cases: user/policy mapping management is required for every user that should read one of the specific records. In the opt-out case, "specific record" refers to a record that should not be readable by all users. In the opt-in case, "specific record" refers to a record that should only be readable by specific users.

[...]

User/policy mapping management mechanics

It is unclear to me, where this is supposed to be located in dumpthing's role concepts. As expressed in #275, the effectively placed into the hands of an individual collections curator. This is different from the overall permission setup of a collection, which can only be done by an administrator. This feels fuzzy to me.
[...]

I think you are right, it is a little fuzzy. My reasoning for putting the management of the visibility of records in the curator role was (I also commented on #275):

  1. a curator should be most familiar with the data and confidentiality aspects of it.
  2. an administrator has a role that is related to creating and deleting higher level "container like"-objects, i.e., collections (which contain records) or authentication sources (which contain authentication information). The administrator does not control the content of the containers (this is not exactly true for the token-container in the config file, which does not neatly fit into the container-view).

[...]

Access policies are the feature to reflect legal constraints. Whether or not a particular person has signed a specific DUA, or is part of a specific group/organization will often be information globally associated with a requester, and not specific to a particular collection.

Dumpthings places the user/policy mapping into the scope of an individual collection. And it places the responsibility for its maintenance (and congruence with record tags) into the hands of a collection curator. This makes sense, because a curator has ultimate reign over a record, and they can effectively determine the conditions with which information becomes available.

However, a collection curator deals with metadata records, and with (abstract) conditions that determine access, but they do not generally know who fulfills these conditions, when, and for how long.

Moreover, dumpthings wants a mapping from user identity to approved policy tags. This makes sense, because that is ultimately the mapping that is required to decide whether or not to show a particular record.

However, this is unlikely to be the way this information is (or becomes) available. I suspect that real-life applications will have a mix of structural sources (e.g., membership in a particular organization/unit), and case-by-case properties (e.g., signed a particular DUA). These will be provided by different sources and update at different frequencies.

It feels clunky and fragile to require this information to be merged into a single mapping with an external mechanism and on top of that to require a curator to choose an appropriate timing to apply it (routinely).
[...]

I see your point. I am not sure yet how to address it. I think there are a number of possible strategries, which come with their own tradeoffs. But I definitely have to look a little more into the aspects of policy-creation, policy-determination, and policy-management. One thing to keep in mind is: user IDs are collection-specific, due to collection-specific authentication sources and token-assignments.

Musings

I am writing this before having had any feedback on the above, so I might be missing the mark by quite a margin...

However, I do wonder whether it is necessary or even useful to invent more mechanisms like policy_mapping and policy mapping reloading endpoints with special permissions....

This appears to be really just a metadata query problem like any other that dumpthings is built to serve. Why not have a simple schema for a "built in" collection where records represent "policies" and their properties carry all essential information, including a mapping to "approved users".

If that is the underlying mechanism, we would have all standard features available to attach existing workflows and agents to this process. Certain people can have certain permissions for this collection. Curators can apply appropriate levels of scrutiny to incoming information from individual sources, and automatically (machine-)accept others.

It crossed my mind to use such an implementation, but did not pursue it further yet. Thinking of it, enabling standard tools would require a mechanism to identify the "policy collection" that should be connected to a collection. It might be a one-to-one mapping where every collection has a policy collection with a canonical name. It might also be a many-to-one mapping where multiple collections refer to a shared policy collection. Although in the latter case there might be problems with information leakage, e.g., about user IDs and policies that apply to user IDs.

This would change the nature of the mapping from user->policy to policy->user -- but it would arguable reflect the "source" nature of the problem space more adequately. Internally, an implementation can reverse the mapping whenever it makes sense.

I see your point that a policy->user mapping might be more natural. It certainly fits the opt-in and opt-out use case better where records and policies are the elements that are primarily considered.

Thanks @mih for the writeup. Generally, most of the described concepts and functionality exists exactly as described in the in the issue. > [...] > > Being able to declare access policies allows for differentiating access _within_ a dumpthings collection. > [...] This is supported > [...] > > Policies are _read_ access policies > [...] Yes, write access is not affected by policies > [...] > > Policies are _opaque_ tags > > The label policy could be misunderstood for something like an [ODLR policy](https://www.w3.org/TR/odrl-model/#policy). But this is not the case. It is a literal tag. While this tag can in fact be an ODLR policy identifier, the service makes not attempt to interpret it in any way. The literal string `SECRET` is a suitable "policy". It has per se no meaning. Its meaning comes from the service using it as a literal tag that is matched against a set of "approved" tags for user requesting a record (for read). > [...] Yes (since 6.5.1) > [...] > > > User-policy mappings are separate from records > > The service needs to look up whether a particular requesting user is approved for a particular policy that a specific record may be tagged with. This mapping is independent and outside the record itself. > > [...] Yes ### Opt-out and opt-in If I understand the description of opt-out and opt-in correctly, they can be implemented via the default_policy-property. ##### Opt-out Opt-out functionality: 1. The default for any user is to be able to read a record 2. Mark records that should not be read by everybody with a policy -> only users who are assigned the policy can read the record ##### Opt-in Opt-in functionality: 1. The default for any user is NOT to be able to read a record 2. Mark records that should be read by specific users with a policy that is associated with the users ##### Implementation Because the token check precedes the policy check, both scenarios require a token-based READ_CURATED permission. The difference between opt-out and opt-in is determined by the default policy. Opt-out: - Default policy is not set -> everybody can read record without a policy - Add a policy-annotation to records that should only be read by users that are associated with the policy Opt-in: - Default policy is set -> only people that are associated with the default policy can read a record (and if nobody is associated with the default policy, nobody can read any record by default) - Add a policy annotation to records that should be read by users that are associated with the policy In both cases: user/policy mapping management is required for every user that should read one of the specific records. In the opt-out case, "specific record" refers to a record that should not be readable by all users. In the opt-in case, "specific record" refers to a record that should only be readable by specific users. > [...] > ### [](#user-policy-mapping-management-mechanics)User/policy mapping management mechanics > It is unclear to me, where this is supposed to be located in dumpthing's role concepts. As expressed in #275, the effectively placed into the hands of an individual collections curator. This is different from the overall permission setup of a collection, which can only be done by an administrator. This feels fuzzy to me. > [...] I think you are right, it is a little fuzzy. My reasoning for putting the management of the visibility of records in the curator role was (I also commented on #275): 1. a curator should be most familiar with the data and confidentiality aspects of it. 2. an administrator has a role that is related to creating and deleting higher level "container like"-objects, i.e., collections (which contain records) or authentication sources (which contain authentication information). The administrator does not control the content of the containers (this is not exactly true for the `token`-container in the config file, which does not neatly fit into the container-view). [...] > Access policies are the feature to reflect legal constraints. Whether or not a particular person has signed a specific DUA, or is part of a specific group/organization will often be information globally associated with a requester, and not specific to a particular collection. > > Dumpthings places the user/policy mapping into the scope of an individual collection. And it places the responsibility for its maintenance (and congruence with record tags) into the hands of a collection curator. This makes sense, because a curator has ultimate reign over a record, and they can effectively determine the conditions with which information becomes available. > > However, a collection curator deals with metadata records, and with (abstract) conditions that determine access, but they do not generally know _who_ fulfills these conditions, when, and for how long. > > Moreover, dumpthings wants a mapping from user identity to approved policy tags. This makes sense, because that is ultimately the mapping that is required to decide whether or not to show a particular record. > > However, this is unlikely to be the way this information is (or becomes) available. I suspect that real-life applications will have a mix of structural sources (e.g., membership in a particular organization/unit), and case-by-case properties (e.g., signed a particular DUA). These will be provided by different sources and update at different frequencies. > > It feels clunky and fragile to require this information to be merged into a single mapping with an external mechanism and on top of that to require a curator to choose an appropriate timing to apply it (routinely). > [...] I see your point. I am not sure yet how to address it. I think there are a number of possible strategries, which come with their own tradeoffs. But I definitely have to look a little more into the aspects of policy-creation, policy-determination, and policy-management. One thing to keep in mind is: user IDs are collection-specific, due to collection-specific authentication sources and token-assignments. > ### [](#musings)Musings > I am writing this before having had any feedback on the above, so I might be missing the mark by quite a margin... > > However, I do wonder whether it is necessary or even useful to invent more mechanisms like `policy_mapping` and policy mapping reloading endpoints with special permissions.... > > This appears to be really just a metadata query problem like any other that dumpthings is built to serve. Why not have a simple schema for a "built in" collection where records represent "policies" and their properties carry all essential information, including a mapping to "approved users". > > If that is the underlying mechanism, we would have all standard features available to attach existing workflows and agents to this process. Certain people can have certain permissions for this collection. Curators can apply appropriate levels of scrutiny to incoming information from individual sources, and automatically (machine-)accept others. > It crossed my mind to use such an implementation, but did not pursue it further yet. Thinking of it, enabling standard tools would require a mechanism to identify the "policy collection" that should be connected to a collection. It might be a one-to-one mapping where every collection has a policy collection with a canonical name. It might also be a many-to-one mapping where multiple collections refer to a shared policy collection. Although in the latter case there might be problems with information leakage, e.g., about user IDs and policies that apply to user IDs. > This would change the nature of the mapping from user->policy to policy->user -- but it would arguable reflect the "source" nature of the problem space more adequately. Internally, an implementation can reverse the mapping whenever it makes sense. I see your point that a policy->user mapping might be more natural. It certainly fits the opt-in and opt-out use case better where records and policies are the elements that are primarily considered.
Owner

One observation: in order to support the curation-workflow in its current state a curator has to have full access to all records, i.e., his access should not be governed by policies.

One observation: in order to support the curation-workflow in its current state a curator has to have full access to all records, i.e., his access should not be governed by policies.
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
orinoco/dump-things-service#278
No description provided.