Partial evaluation condition location #548
Replies: 3 comments 15 replies
-
From which version are you upgrading? This could be a side effect related to ref head rules, but it's hard to tell without knowing your policy. There was no general "move stuff to support modules" bullet point because there hasn't been any such effort. |
Beta Was this translation helpful? Give feedback.
-
I commented out the following two defaults and ran the OPA cli. default allow := false
The output of the command with the "-f pretty" option is:
Here is the output without the "-f pretty" option. The information required to build the SQL criteria clause still appears to be in the modules -> rules sections of the output.
|
Beta Was this translation helpful? Give feedback.
-
Is it still possible to rely on the Query portion of the output to determine if the decision is unconditionally granted or partially granted as mentioned in the table found on this page: https://www.openpolicyagent.org/docs/latest/rest-api/#partially-evaluate-a-query The reason I'm asking is if I swap the token for one that is an administrator I would expect to receive an unconditional decision. However, I don't see an empty query in the response. I've confirmed I do receive an allow=true decision when dropping the partial evaluation arguments (-p -u "data.resources") from the command with the administrator token. Just looking to make sure I understand how to interpret the output correctly. Output:
|
Beta Was this translation helpful? Give feedback.
-
I'm in the process of upgrading to version 0.60 of OPA and I noticed that the location of the partial evaluation condition information in a response appears to have moved from the body of the Queries field to underneath the modules rules section. I looked over release notes but didn't find anything that mentioned this change. However, maybe I missed it. Can you confirm if the location has changed?
{
"partial": {
"queries": [
[
{
"index": 0,
"terms": {
"type": "ref",
"value": [
{
"type": "var",
"value": "data"
},
{
"type": "string",
"value": "partial"
},
{
"type": "string",
"value": "sas"
},
{
"type": "string",
"value": "audit"
},
{
"type": "string",
"value": "authz"
},
{
"type": "string",
"value": "allow"
}
]
}
}
]
],
"modules": [
{
"package": {
"path": [
{
"type": "var",
"value": "data"
},
{
"type": "string",
"value": "partial"
},
{
"type": "string",
"value": "sas"
},
{
"type": "string",
"value": "audit"
},
{
"type": "string",
"value": "authz"
}
]
},
"rules": [
{
"body": [
{
"index": 0,
"terms": {
"type": "boolean",
"value": true
}
}
],
"default": true,
"head": {
"name": "allow",
"value": {
"type": "boolean",
"value": false
},
"ref": [
{
"type": "var",
"value": "allow"
}
]
}
},
{
"body": [
{
"index": 0,
"terms": [
{
"type": "ref",
"value": [
{
"type": "var",
"value": "eq"
}
]
},
{
"type": "ref",
"value": [
{
"type": "var",
"value": "data"
},
{
"type": "string",
"value": "partial"
},
{
"type": "string",
"value": "sas"
},
{
"type": "string",
"value": "audit"
},
{
"type": "string",
"value": "authz"
},
{
"type": "string",
"value": "grant"
}
]
},
{
"type": "var",
"value": "$_term_1_21"
}
],
"with": [
{
"target": {
"type": "ref",
"value": [
{
"type": "var",
"value": "data"
},
{
"type": "string",
"value": "request"
}
]
},
"value": {
"type": "object",
"value": [
[
{
"type": "string",
"value": "permission"
},
{
"type": "string",
"value": "read"
}
],
[
{
"type": "string",
"value": "uri"
},
{
"type": "string",
"value": "/audit/entries/123"
}
]
]
}
}
]
},
{
"index": 1,
"terms": {
"type": "var",
"value": "$_term_1_21"
}
}
],
"head": {
"name": "allow",
"value": {
"type": "boolean",
"value": true
},
"ref": [
{
"type": "var",
"value": "allow"
}
]
}
},
{
"body": [
{
"index": 0,
"terms": {
"type": "boolean",
"value": true
}
}
],
"default": true,
"head": {
"name": "grant",
"value": {
"type": "boolean",
"value": false
},
"ref": [
{
"type": "var",
"value": "grant"
}
]
}
},
{
"body": [
{
"index": 0,
"terms": [
{
"type": "ref",
"value": [
{
"type": "var",
"value": "eq"
}
]
},
{
"type": "string",
"value": "wfuser1"
},
{
"type": "ref",
"value": [
{
"type": "var",
"value": "data"
},
{
"type": "string",
"value": "resources"
},
{
"type": "var",
"value": "__local51__36"
},
{
"type": "string",
"value": "user"
}
]
}
]
}
],
"head": {
"name": "grant",
"value": {
"type": "boolean",
"value": true
},
"ref": [
{
"type": "var",
"value": "grant"
}
]
}
}
]
}
]
}
}
Beta Was this translation helpful? Give feedback.
All reactions