blob: 86da28ce2b20c57ac0a6da295bb356609dd38b31 [file] [log] [blame]
{
"testCases":[
{
"name":"value=/a/b*y.txt; isRecursive=true; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/a/b*y.txt"],
"isRecursive":true
},
"tests":[
{ "name":"exact-path","input":"/a/b*y.txt", "result":true},
{ "name":"child-path","input":"/a/b/y.txt", "result":true},
{ "name":"grand-child-path","input":"/a/b1/b2/y.txt", "result":true},
{ "name":"descendant-child-path","input":"/a/b1/c1/d1/any.txt", "result":true},
{ "name":"mismatche-path","input":"/a/any.txt", "result":false},
]
}
,
{
"name":"value=/a/b*y.txt; isRecursive=false; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/a/b*y.txt"],
"isRecursive":false
},
"tests":[
{ "name":"exact-path","input":"/a/b*y.txt", "result":true},
{ "name":"child-path","input":"/a/b/y.txt", "result":true},
{ "name":"grand-child-path","input":"/a/b1/b2/y.txt", "result":true},
{ "name":"descendant-child-path","input":"/a/b1/c1/d1/any.txt", "result":true},
{ "name":"mismatche-path","input":"/a/any.txt", "result":false},
]
}
,
{
"name":"value=*; isRecursive=false; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["*"],
"isRecursive":false
},
"tests":[
{ "name":"exact-path","input":"*", "result":true},
{ "name":"child-path","input":"/path1", "result":true},
{ "name":"grand-child-path","input":"/path1/path2", "result":true},
{ "name":"no-slash-path","input":"path1", "result":true}
]
}
,
{
"name":"value=*; isRecursive=true; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["*"],
"isRecursive":true
},
"tests":[
{ "name":"exact-path","input":"*", "result":true},
{ "name":"child-path","input":"/path1", "result":true},
{ "name":"grand-child-path","input":"/path1/path2", "result":true},
{ "name":"no-slash-path","input":"path1", "result":true}
]
}
,
{
"name":"value=/; isRecursive=false; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/"],
"isRecursive":false
},
"tests":[
{ "name":"exact-path","input":"/", "result":true},
{ "name":"child-path","input":"/path1", "result":false},
{ "name":"grand-child-path","input":"/path1/path2", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=/path1; isRecursive=false; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/path1"],
"isRecursive":false
},
"tests":[
{ "name":"parent-path","input":"/", "result":false},
{ "name":"exact-path","input":"/path1", "result":true},
{ "name":"child-path","input":"/path1/path2", "result":false},
{ "name":"grand-child-path","input":"/path1/path2/path3", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=/path1/*; isRecursive=false; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/path1/*"],
"isRecursive":false
},
"tests":[
{ "name":"parent-path","input":"/", "result":false},
{ "name":"exact-path","input":"/path1/*", "result":true},
{ "name":"child-path","input":"/path1/path2", "result":true},
{ "name":"grand-child-path","input":"/path1/path2/path3", "result":true},
{ "name":"sibling-path","input":"/path2/path3/path4", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=/; isRecursive=true; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/"],
"isRecursive":true
},
"tests":[
{ "name":"exact-path","input":"/", "result":true},
{ "name":"child-path","input":"/path1", "result":true},
{ "name":"grand-child-path","input":"/path1/path2", "result":true},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=/path1; isRecursive=true; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/path1"],
"isRecursive":true
},
"tests":[
{ "name":"parent-path","input":"/", "result":false},
{ "name":"exact-path","input":"/path1", "result":true},
{ "name":"child-path","input":"/path1/path2", "result":true},
{ "name":"grand-child-path","input":"/path1/path2/path3", "result":true},
{ "name":"exact-path-upper-case","input":"/PATH1", "result":true},
{ "name":"child-path-mixed-case","input":"/PaTh1/pAtH2", "result":true},
{ "name":"grand-child-path-camel-case","input":"/Path1/Path2/Path3", "result":true},
{ "name":"sibling-path","input":"/path2", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
{ "name":"prefix-path","input":"/path12", "result":false},
{ "name":"no-path","input":"", "result":false}
]
}
,
{
"name": "value=/path1/path2; isRecursive=true; wildCard=true; ignoreCase=true",
"resourceDef": {
"matcher": "org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions": {"wildCard": true, "ignoreCase": true
}
},
"policyResource": {"values": ["/path1/path2"], "isRecursive": true},
"tests": [
{"name": "exact-path", "input": "/path1/path2", "result": true},
{"name": "parent-path", "input": "/path1", "result": false},
{"name": "grand-parent-path", "input": "/", "result": false},
{"name": "child-path", "input": "/path1/path2/path3", "result": true},
{"name": "grandchild-path", "input": "/path1/path2/path3/path4", "result": true},
{"name": "sibling-path", "input": "/path1/path3", "result": false},
{"name": "prefix-path", "input": "/path1/path21", "result": false},
{"name": "invalid-path", "input": "path1/path2*", "result": false}
]
}
,
{
"name":"value=/path*; isRecursive=true; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/path*"],
"isRecursive":true
},
"tests":[
{ "name":"parent-path","input":"/", "result":false},
{ "name":"exact-path","input":"/path*", "result":true},
{ "name":"wild-path","input":"/path1", "result":true},
{ "name":"wild-path","input":"/path-to-success", "result":true},
{ "name":"child-path","input":"/path-to-success/is-slow", "result":true},
{ "name":"grand-child-path","input":"/path-to-success/is-slow/and-fun", "result":true},
{ "name":"wild-path-mixed-case","input":"/PaTh-To-SuCcEsS", "result":true},
{ "name":"child-path-upper-case","input":"/PATH-TO-SUCCESS/IS-SLOW", "result":true},
{ "name":"grand-child-path-camel-case","input":"/Path-To-Success/Is-Slow/And-Fun", "result":true},
{ "name":"unmatched-path","input":"/pat1ha", "result":false},
{ "name":"unmatched-child-path","input":"/pat1ha/path2b", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=/path?; isRecursive=true; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/path?"],
"isRecursive":true
},
"tests":[
{ "name":"parent-path","input":"/", "result":false},
{ "name":"exact-path","input":"/path?", "result":true},
{ "name":"wild-path","input":"/path1", "result":true},
{ "name":"child-path","input":"/path1/path2", "result":true},
{ "name":"grand-child-path","input":"/path1/path2/path3", "result":true},
{ "name":"wild-path-mixed-case","input":"/PaTh1", "result":true},
{ "name":"child-path-upper-case","input":"/PATH1/PATH2", "result":true},
{ "name":"grand-child-path-camel-case","input":"/Path1/Path2/Path3", "result":true},
{ "name":"unmatched-path","input":"/path1a", "result":false},
{ "name":"unmatched-child-path","input":"/path1a/path2b", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=/public/*test; isRecursive=true; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/public/*test"],
"isRecursive":true
},
"tests":[
{ "name":"parent-path","input":"/", "result":false},
{ "name":"exact-path","input":"/public/*test", "result":true},
{ "name":"wild-path","input":"/public/first-test", "result":true},
{ "name":"wild-path","input":"/public/second-test", "result":true},
{ "name":"wild-path","input":"/public/last-test", "result":true},
{ "name":"child-path","input":"/public/new/first-test", "result":true},
{ "name":"grand-child-path","input":"/public/archive/2008/first-test", "result":true},
{ "name":"unmatched-path","input":"/pat1ha", "result":false},
{ "name":"unmatched-child-path","input":"/pat1ha/path2b", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=/public/*test/*result; isRecursive=true; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/public/*test/*result"],
"isRecursive":true
},
"tests":[
{ "name":"parent-path","input":"/", "result":false},
{ "name":"parent-path","input":"/public/*test", "result":false},
{ "name":"parent-path","input":"/public/first-test", "result":false},
{ "name":"parent-path","input":"/public/second-test", "result":false},
{ "name":"parent-path","input":"/public/last-test", "result":false},
{ "name":"grand-parent-branch-path","input":"/public/new/first-test", "result":false},
{ "name":"grand-parent-branch-path","input":"/public/new/first-test/result", "result":true},
{ "name":"grand-parent-branch-grand-child-path","input":"/public/archive/2008/first-test/result", "result":true},
{ "name":"exact-path","input":"/public/*test/*result", "result":true},
{ "name":"wild-path","input":"/public/first-test/good-result", "result":true},
{ "name":"wild-path","input":"/public/second-test/better-result", "result":true},
{ "name":"wild-path","input":"/public/last-test/best-result", "result":true},
{ "name":"child-path","input":"/public/first-test/good-result/details", "result":true},
{ "name":"grand-child-path","input":"/public/last-test/best-result/details", "result":true},
{ "name":"unmatched-path","input":"/pat1ha", "result":false},
{ "name":"unmatched-child-path","input":"/pat1ha/path2b", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=/public/*test/*result; isRecursive=false; wildCard=true; ignoreCase=true",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true}
},
"policyResource":{
"values": ["/public/*test/*result"],
"isRecursive":true
},
"tests":[
{ "name":"parent-path","input":"/", "result":false},
{ "name":"parent-path","input":"/public/*test", "result":false},
{ "name":"parent-path","input":"/public/first-test", "result":false},
{ "name":"parent-path","input":"/public/second-test", "result":false},
{ "name":"parent-path","input":"/public/last-test", "result":false},
{ "name":"grand-parent-branch-path","input":"/public/new/first-test", "result":false},
{ "name":"grand-parent-branch-path","input":"/public/new/first-test/result", "result":true},
{ "name":"grand-parent-branch-grand-child-path","input":"/public/archive/2008/first-test/result", "result":true},
{ "name":"exact-path","input":"/public/*test/*result", "result":true},
{ "name":"wild-path","input":"/public/first-test/good-result", "result":true},
{ "name":"wild-path","input":"/public/second-test/better-result", "result":true},
{ "name":"wild-path","input":"/public/last-test/best-result", "result":true},
{ "name":"child-path","input":"/public/first-test/good-result/details", "result":true}, # TODO: should this be false since isRecursive=false?
{ "name":"grand-child-path","input":"/public/last-test/best-result/details", "result":true}, # TODO: should this be false since isRecursive=false?
{ "name":"unmatched-path","input":"/pat1ha", "result":false},
{ "name":"unmatched-child-path","input":"/pat1ha/path2b", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=root; isRecursive=false; wildCard=true; ignoreCase=true; pathSeparatorChar=.",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true, "pathSeparatorChar":"."}
},
"policyResource":{
"values": ["root"],
"isRecursive":false
},
"tests":[
{ "name":"exact-path","input":"root", "result":true},
{ "name":"child-path","input":"root.default", "result":false},
{ "name":"grand-child-path","input":"root.default.mycompany", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=root.default.mycompany*; isRecursive=false; wildCard=true; ignoreCase=true; pathSeparatorChar=.",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true, "pathSeparatorChar":"."}
},
"policyResource":{
"values": ["root.default.mycompany*"],
"isRecursive":false
},
"tests":[
{ "name":"parent-path","input":"root", "result":false},
{ "name":"parent-path","input":"root.default", "result":false},
{ "name":"exact-path","input":"root.default.mycompany*", "result":true},
{ "name":"wild-path","input":"root.default.mycompany1", "result":true},
{ "name":"child-path","input":"root.default.mycompany1.test", "result":true}, # TODO: should this be false since isRecursive=false
{ "name":"child-path","input":"root.default.mycompany1.dev", "result":true}, # TODO: should this be false since isRecursive=false
{ "name":"sibling-path","input":"root.default.othercompany1.dev", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=root; isRecursive=true; wildCard=true; ignoreCase=true; pathSeparatorChar=.",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true, "pathSeparatorChar":"."}
},
"policyResource":{
"values": ["root"],
"isRecursive":true
},
"tests":[
{ "name":"exact-path","input":"root", "result":true},
{ "name":"child-path","input":"root.default", "result":true},
{ "name":"grand-child-path","input":"root.default.mycompany", "result":true},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
,
{
"name":"value=root.default.mycompany*; isRecursive=true; wildCard=true; ignoreCase=true; pathSeparatorChar=.",
"resourceDef":{
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerPathResourceMatcher",
"matcherOptions":{"wildCard":true, "ignoreCase":true, "pathSeparatorChar":"."}
},
"policyResource":{
"values": ["root.default.mycompany*"],
"isRecursive":true
},
"tests":[
{ "name":"parent-path","input":"root", "result":false},
{ "name":"parent-path","input":"root.default", "result":false},
{ "name":"exact-path","input":"root.default.mycompany*", "result":true},
{ "name":"wild-path","input":"root.default.mycompany1", "result":true},
{ "name":"child-path","input":"root.default.mycompany1.test", "result":true},
{ "name":"child-path","input":"root.default.mycompany1.dev", "result":true},
{ "name":"sibling-path","input":"root.default.othercompany1.dev", "result":false},
{ "name":"invalid-path","input":"path1", "result":false},
]
}
]
}