cedar-policy / cedar-docs

Documentation for Cedar policy language
https://docs.cedarpolicy.com
Apache License 2.0
24 stars 23 forks source link

Incorrect example for JSON EST #96

Closed aaronjeline closed 4 months ago

aaronjeline commented 7 months ago

What were you trying to do? Reading the docs for the JSON EST format (https://docs.cedarpolicy.com/policies/json-format.html), and the following is given as an example of a policy:

{
    "effect": "permit",
    "principal": {
        "op": "==",
        "entity": { "type": "User", "id": "12UA45" }
    },
    "action": {
        "op": "==",
        "entity": { "type": "Action", "id": "view" }
    },
    "resource": {
        "op": "in",
        "entity": { "type": "Folder", "id": "abc" }
    },
    "conditions": [
        {
            "kind": "when",
            "body": {
                "==": {
                    "left": {
                        ".": {
                            "left": {
                                "Var": "context"
                            },
                            "attr": "tls_version"
                        }
                    },
                    "right": {
                        "Literal": "1.3"
                    }
                }
            }
        }
    ]
}

What is wrong and why? { "Literal" : "1.3" } is not valid EST JSON What do we need to do to fix this? Is should be {"Value" : "1.3"}

kinclay commented 4 months ago

This has already been fixed.