fluree / core

Fluree releases and public bug reports
0 stars 0 forks source link

Same Policy-Enforced Txn Fails at ~33-50% Rate #91

Closed aaj3f closed 4 months ago

aaj3f commented 5 months ago

Description

While working on documenting / communicating how to transact JWS-signed messages against a server instance w/ existing Policy rules, the exact same txn fails at a rate of ~33-50%

Steps to Reproduce

/create ledger

{
    "ledger": "232894ba-7862-4530-beb9-9efd8eb6e86c",
    "insert": {
        "message": "success"
    }
}

/transact Policy & ID data

{
    "@context": {
        "f": "https://ns.flur.ee/ledger#",
        "ex": "http://example.org/",
        "f:equals": {
            "@container": "@list"
        }
    },
    "insert": [
        {
            "@id": "ex:alice",
            "@type": "ex:User",
            "ex:secret": "alice's secret"
        },
        {
            "@id": "ex:bob",
            "@type": "ex:User",
            "ex:secret": "bob's secret"
        },
        {
            "@id": "ex:userPolicy",
            "@type": [
                "f:Policy"
            ],
            "f:targetClass": {
                "@id": "ex:User"
            },
            "f:allow": [
                {
                    "@id": "ex:globalViewAllow",
                    "f:targetRole": {
                        "@id": "ex:userRole"
                    },
                    "f:action": [
                        {
                            "@id": "f:view"
                        }
                    ]
                }
            ],
            "f:property": [
                {
                    "f:path": {
                        "@id": "ex:secret"
                    },
                    "f:allow": [
                        {
                            "@id": "ex:secretsRule",
                            "f:targetRole": {
                                "@id": "ex:userRole"
                            },
                            "f:action": [
                                {
                                    "@id": "f:view"
                                },
                                {
                                    "@id": "f:modify"
                                }
                            ],
                            "f:equals": [
                                {
                                    "@id": "f:$identity"
                                },
                                {
                                    "@id": "ex:user"
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "@id": "did:fluree:TfHgFTQQiJMHaK1r1qxVPZ3Ridj9pCozqnh",
            "ex:user": {
                "@id": "ex:alice"
            },
            "f:role": {
                "@id": "ex:userRole"
            }
        }
    ],
    "ledger": "232894ba-7862-4530-beb9-9efd8eb6e86c"
}

/transact with signed JWS

"eyJhbGciOiJFUzI1NkstUiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19.eyJpbnNlcnQiOlt7IkBpZCI6ImV4OmFsaWNlIiwiZXg6c2VjcmV0IjoiYWxpY2UncyBuZXcgc2VjcmV0In1dLCJsZWRnZXIiOiIyMzI4OTRiYS03ODYyLTQ1MzAtYmViOS05ZWZkOGViNmU4NmMiLCJAY29udGV4dCI6eyJmIjoiaHR0cHM6Ly9ucy5mbHVyLmVlL2xlZGdlciMiLCJleCI6Imh0dHA6Ly9leGFtcGxlLm9yZy8ifX0.MWMzMDQ1MDIyMTAwY2JkMzJlNDYzNTY3ZmVmYzJmMTIwNDI1YjAyMjRkOWQyNjMwMDg5MTE2NTNmNTBlODM5NTNmNDdjZmJlZjNiYzAyMjAxYTE5ODE4Yzk2M2ZlOThlMDA5NzUyZTgzZmQxZTMwODk0NzI1YTNjZThiYmY5ODgwNWIzMDM5Mjg0M2Q5YzRl"