dgraph
dgraph copied to clipboard
[BUG]: RBAC on update with input arrays causes error
What version of Dgraph are you using?
v23 or v24.0.1
What is the hardware spec (RAM, CPU, OS)?
Cloud
What steps will reproduce the bug?
Deploy schema
type User @auth(
update: {
rule: "{ $role: { eq: \"ADMIN\" } }"
}
){
email: String! @id
note: String
}
# Dgraph.Authorization {"VerificationKey":"6ABBAA2014CFF00289D20D20DA296F67","header":"X-Dgraph-AuthToken","namespace":"https://dgraph.io/jwt/claims","Algo":"HS256","ClosedByDefault":true}
from Postman send GraphQL request
mutation MyMutation($input: [AddUserInput!]!, $upsert: Boolean) {
addUser(input: $input, upsert: $upsert) {
numUids
user {
email
}
}
}
with variables
{ "upsert": true,
"input" : [
{"email": "[email protected]"},
{"email": "[email protected]"},
{"email": "[email protected]"}
]
}
and header
X-Dgraph-AuthToken eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJodHRwczovL2RncmFwaC5pby9qd3QvY2xhaW1zIjp7InJvbGUiOiJBRE1JTiJ9fQ.DHYBRLpXfGxntOWTDQObq8_0PrPZfn_xVMAFZqE_zCM
The first invocation is successful ( add) The second invocation fails with
{
"errors": [
{
"message": "mutation addUser failed because Dgraph execution failed because Some variables are declared multiple times.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"addUser"
]
}
],
"data": {
"addUser": null
},
"extensions": {
"touched_uids": 6,
"tracing": {
"version": 1,
"startTime": "2024-08-15T19:42:35.509121642Z",
"endTime": "2024-08-15T19:42:35.513617509Z",
"duration": 4495877,
"execution": {
"resolvers": [
{
"path": [
"addUser"
],
"parentType": "Mutation",
"fieldName": "addUser",
"returnType": "AddUserPayload",
"startOffset": 154632,
"duration": 4330005,
"dgraph": [
{
"label": "preMutationQuery",
"startOffset": 216753,
"duration": 3521409
},
{
"label": "mutation",
"startOffset": 4068519,
"duration": 0
},
{
"label": "query",
"startOffset": 0,
"duration": 0
}
]
}
]
}
}
}
}