You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The server responds 400 Invalid Request, Cannot set status to 'signed'
Explanations
When a collection is created, we receive a ResourceChanged event, and we use an event listener to sign it right away (here)
When we sign a collection, we update the source attributes to set its status to signed. In order to keep track of this change, we emit a ResourceChanged event. We call this a cascade event, since it's sent from an event listener.
When several events are sent for the same action and resource name, we merge them together. There will be one event, but with several impacted_objects.
In the batch request example above, when we process the collection b creation, and its initial signing, a ResourceChanged event is sent for the status switch to signed. This event gets merged with the ResourceChanged event emitted for the PATCH update of collection a.
The issuer of the event for the PATCH update is a normal user (author of the batch request). However, the one for the signed status event is the signer code itself (user id = plugin:signer)
When events get merged, we «loose» some information about the merged one, including its issuer.
The check that we have in place to make sure that no user can manually set a collection status to signed ignores update events that were issued by the signer code. But since the signer event was merged into the user event, the check code raises an invalid request Cannot set status to 'signed', assuming the status change was performed by a user and not by the signer code.
Possible solutions
Prevent event merging when their issuer differs
Prevent event merging of cascade events with upstream events
The text was updated successfully, but these errors were encountered:
Steps to reproduce
a
existsb
and update the collectiona
Expected result
b
a
Actual result
400 Invalid Request
,Cannot set status to 'signed'
Explanations
When a collection is created, we receive a
ResourceChanged
event, and we use an event listener to sign it right away (here)When we sign a collection, we update the source attributes to set its
status
tosigned
. In order to keep track of this change, we emit aResourceChanged
event. We call this a cascade event, since it's sent from an event listener.When several events are sent for the same action and resource name, we merge them together. There will be one event, but with several
impacted_objects
.In the batch request example above, when we process the collection
b
creation, and its initial signing, aResourceChanged
event is sent for thestatus
switch tosigned
. This event gets merged with theResourceChanged
event emitted for the PATCH update of collectiona
.The issuer of the event for the PATCH update is a normal user (author of the batch request). However, the one for the signed status event is the signer code itself (
user id = plugin:signer
)When events get merged, we «loose» some information about the merged one, including its issuer.
The check that we have in place to make sure that no user can manually set a collection status to
signed
ignores update events that were issued by the signer code. But since the signer event was merged into the user event, the check code raises an invalid requestCannot set status to 'signed'
, assuming the status change was performed by a user and not by the signer code.Possible solutions
The text was updated successfully, but these errors were encountered: