@auth directives don't apply to nested objects when using interfaces?

Oh sorry I didn’t circle back on this. I will bookmark this for a review tomorrow.


Walking through this again and this keeps striking me as odd.

What is the purpose of checking that the same value is true and is false? That will never equate out to a true statement. Is that what you are trying to prove here? That this should never be seen but it is. My mind just keeps getting stuck on this and says that’s not right and I can’t think past it.


Did you try to insert this data as a GraphQL mutation instead of RDF triples? Also it looks like you are trying to use namespaces in the rdf which isn’t supported until v21.03 and you are using:

both standalone:v20.11.3 and standalone:latest as of 2021/05/28

latest should be v21.03 but the former might not handle the rdf syntax correctly, idk.


I disabled auth rules and added data using GraphQL Mutations:

Add a Post:

mutation {
  addPost(input: [{approved: true}]) {
    post {
      id
      approved
      changes {
        x
      }
    }
  }
}

Results:

{
  "data": {
    "addPost": {
      "post": [
        {
          "id": "0x2710a",
          "approved": true
        }
      ]
    }
  }
}

Add a PostContent:

mutation {
  addPostContent(input: [{
    x: true,
    approvable: {
      id: "0x2710a"
    }
  }]) {
    postContent {
      id
    }
  }
}

Results:

{
  "data": {
    "addPostContent": {
      "postContent": [
        {
          "id": "0x2710b"
        }
      ]
    }
  }
}

Run a query to see all data with nested back to parent from both queryPost and queryPostContent:

{
  queryPost {
    id
    approved
    changes {
      x
      approvable {
        id
        approved
      }
    }
  }
  queryPostContent {
    id
    x
    approvable {
      id
      approved
      changes {
        x
      }
    }
  }
}

Results:

{
  "data": {
    "queryPost": [
      {
        "id": "0x2710a",
        "approved": true,
        "changes": [
          {
            "x": true,
            "approvable": {
              "id": "0x2710a",
              "approved": true
            }
          }
        ]
      }
    ],
    "queryPostContent": [
      {
        "id": "0x2710b",
        "x": true,
        "approvable": {
          "id": "0x2710a",
          "approved": true,
          "changes": [
            {
              "x": true
            }
          ]
        }
      }
    ]
  }
}

Turn on the @auth rules and run the same query again and see results:

{
  "data": {
    "queryPost": [
      {
        "id": "0x2710a",
        "approved": true,
        "changes": [
          {
            "x": true,
            "approvable": {
              "id": "0x2710a",
              "approved": true
            }
          }
        ]
      }
    ],
    "queryPostContent": []
  }
}

Run the same query using the queryApprovable and queryApprovableChange at the interface level:

{
  queryApprovable {
    id
    approved
    changes {
      x
      approvable {
        id
        approved
      }
    }
  }
  queryApprovableChange {
    x
    approvable {
      id
      approved
      changes {
        x
      }
    }
  }
}

Results:

{
  "data": {
    "queryApprovable": [
      {
        "id": "0x2710a",
        "approved": true,
        "changes": [
          {
            "x": true,
            "approvable": {
              "id": "0x2710a",
              "approved": true
            }
          }
        ]
      }
    ],
    "queryApprovableChange": []
  }
}

Run the query rules themselves:

{
  queryApprovable(filter: { approved: true }) { id }
  queryApprovableChange(filter: { x: true, and: { x: false } }) { x }
}

Results:

{
  "data": {
    "queryApprovable": [
      {
        "id": "0x2710a"
      }
    ],
    "queryApprovableChange": []
  }
}

According to the rules, the queries are returning the wrong responses because we should never be able to see the node with x: true when the rules are enabled.