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
After adding triggers to a couple of types, we started observing errors relating to access policies, with entities being hidden that should not be. Removing the trigger causes the issue to resolve. This is not ideal, as we have started needing to re-implement trigger behavior in business logic instead.
Example
Schema looks something like:
# In a non-default moduletype ResourceIdentifier extendingdefault::Owned {
required resourceId: uuid {
default:=uuid_generate_v4();
}
required resourceType: ResourceType;
requiredhash: str;
required hashVersion: int32;
# We allow multiple hashes to be associated with the same resourceId, in# order to handle merges of duplicate resources.trigger validate_resource_identifier afterinsert, updateforeachdo (
assert(
notexists (
select ResourceIdentifier
filter
.owner =__new__.owner
and .resourceType =__new__.resourceType
and .hashVersion =__new__.hashVersion
and .hash =__new__.hash
and .id !=__new__.id
),
message:='ResourceIdentifier with the same key already exists'
)
);
}
# In the default moduleabstracttypeOwned {
# This is the field being setrequiredsinglelink owner: default::User {
ontargetdeletedeletesource;
}
accesspolicy ownerHasFullAccess
allowallusing (globaldefault::currentUserId ?= .owner.id);
}
type User {
# ... other fieldsaccesspolicy ownerHasFullAccess
allowallusing (global currentUserId ?= .id);
# ... Other access policies
}
userId is given for a User that exists, and the currentUserId global is set to the same value. We observe an error: required link 'owner' of object type 'fhirext::ResourceIdentifier' is hidden by access policy
This is just one concrete example, but it has occurred for other types too. It's unclear whether the access policy is being mis-evaluated in the trigger evaluation or the insert evaluation.
Version
EdgeDB Version: 5.6
EdgeDB CLI Version: 7.1
OS Version: Debian Bullseye
Note that we are planning to upgrade to v6 within the next month, but are still pinned to an older version for now. So it's unclear whether this is still a problem or not.
The text was updated successfully, but these errors were encountered:
This isn't enough information to reproduce the error, unfortunately, since the schema doesn't compile.
Could you share a standalone reduced schema that reproduces the issue or else your full schema? (You can email it to me at [email protected] if you wish.)
Overview
After adding triggers to a couple of types, we started observing errors relating to access policies, with entities being hidden that should not be. Removing the trigger causes the issue to resolve. This is not ideal, as we have started needing to re-implement trigger behavior in business logic instead.
Example
Schema looks something like:
We do an insert using the TS query builder:
userId
is given for aUser
that exists, and thecurrentUserId
global is set to the same value. We observe an error:required link 'owner' of object type 'fhirext::ResourceIdentifier' is hidden by access policy
This is just one concrete example, but it has occurred for other types too. It's unclear whether the access policy is being mis-evaluated in the trigger evaluation or the insert evaluation.
Version
Note that we are planning to upgrade to v6 within the next month, but are still pinned to an older version for now. So it's unclear whether this is still a problem or not.
The text was updated successfully, but these errors were encountered: