Skip to content

Commit

Permalink
add Policy Schema to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahoo-Wang committed Jan 2, 2023
1 parent ae16562 commit 1a944f4
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 3 deletions.
97 changes: 97 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,103 @@ RBAC-based And Policy-based Multi-Tenant Reactive Security Framework.

![Gateway](document/design/assets/Gateway.svg)

## Policy Schema

[Policy Schema](document/cosec-policy.schema.json)

```json
{
"id": "2",
"name": "auth",
"category": "auth",
"description": "",
"type": "global",
"tenantId": "1",
"statements": [
{
"effect": "allow",
"actions": [
{
"type": "all"
},
{
"type": "none"
},
{
"type": "path",
"methods": [
"GET",
"POST",
"PUT",
"DELETE"
],
"pattern": "/user/{userId}/*"
}
],
"conditions": [
{
"type": "authenticated"
},
{
"type": "in",
"part": "context.principal.id",
"in": [
"userId"
]
}
]
},
{
"effect": "deny",
"actions": [
{
"type": "all",
"methods": [
"GET"
]
},
{
"type": "none"
},
{
"type": "path",
"pattern": ".*"
},
{
"type": "path",
"pattern": "#{principal.id}.*"
},
{
"type": "reg",
"pattern": ".*"
},
{
"type": "reg",
"pattern": "#{principal.id}.*"
}
],
"conditions": [
{
"type": "all"
},
{
"type": "none"
},
{
"type": "spel",
"pattern": "context.principal.id=='1'"
},
{
"type": "ognl",
"pattern": "path == \"auth/login\""
}
]
}
]
}

```

## Thanks

CoSec permission policy design refers to [AWS IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html) .
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ coverage:
threshold: 1%
project:
default:
target: 60%
target: 80%
threshold: 1%
ignore:
- "document/.*"
Expand Down
34 changes: 32 additions & 2 deletions cosec-core/src/test/resources/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,41 @@
"name": "auth",
"category": "auth",
"description": "",
"type": "system",
"type": "global",
"tenantId": "1",
"statements": [
{
"effect": "allow"
"effect": "allow",
"actions": [
{
"type": "all"
},
{
"type": "none"
},
{
"type": "path",
"methods": [
"GET",
"POST",
"PUT",
"DELETE"
],
"pattern": "/user/{userId}/*"
}
],
"conditions": [
{
"type": "authenticated"
},
{
"type": "in",
"part": "context.principal.id",
"in": [
"userId"
]
}
]
},
{
"effect": "deny",
Expand Down

0 comments on commit 1a944f4

Please sign in to comment.