Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add policy bundles for defining max-grant-duration #5

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions max-grant-duration/1d/.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "roots": ["policy"] }
8 changes: 8 additions & 0 deletions max-grant-duration/1d/policy.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package time

import data.abbey.functions

allow[msg] {
functions.expire_after("24h")
msg := "granting access for 1 day"
}
1 change: 1 addition & 0 deletions max-grant-duration/1h/.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "roots": ["policy"] }
8 changes: 8 additions & 0 deletions max-grant-duration/1h/policy.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package time

import data.abbey.functions

allow[msg] {
functions.expire_after("1h")
msg := "granting access for 1 hour"
}
1 change: 1 addition & 0 deletions max-grant-duration/1w/.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "roots": ["policy"] }
8 changes: 8 additions & 0 deletions max-grant-duration/1w/policy.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package time

import data.abbey.functions

allow[msg] {
functions.expire_after("168h")
msg := "granting access for 1 week"
}
1 change: 1 addition & 0 deletions max-grant-duration/8h/.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "roots": ["policy"] }
8 changes: 8 additions & 0 deletions max-grant-duration/8h/policy.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package time

import data.abbey.functions

allow[msg] {
functions.expire_after("8h")
msg := "granting access for 8 hours"
}
2 changes: 1 addition & 1 deletion src/abbey/functions/expire_after.rego
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package abbey.functions

import future.keywords.if
import rego.v1

# METADATA
# title: Expire After
Expand Down
2 changes: 1 addition & 1 deletion src/abbey/functions/expire_after_test.rego
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package abbey.functions_test

import data.abbey.functions
import future.keywords.if
import rego.v1

test_after_expired_duration if {
not functions.expire_after("1m") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z"
Expand Down
2 changes: 1 addition & 1 deletion src/abbey/functions/expire_at.rego
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package abbey.functions

import future.keywords.if
import rego.v1

# METADATA
# title: Expire At
Expand Down
2 changes: 1 addition & 1 deletion src/abbey/functions/expire_at_test.rego
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package abbey.functions_test

import data.abbey.functions
import future.keywords.if
import rego.v1

test_after_expired_at_threshold if {
not functions.expire_at("2023-01-01T02:00:00Z") with data.system.abbey.target.grant.approved_at as "2023-01-01T01:00:00Z"
Expand Down
3 changes: 1 addition & 2 deletions src/abbey/functions/member_of.rego
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package abbey.functions

import future.keywords.if
import future.keywords.in
import rego.v1

apps := [
"googleworkspace",
Expand Down
2 changes: 1 addition & 1 deletion src/abbey/functions/member_of_test.rego
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package abbey.functions_test

import data.abbey.functions
import future.keywords.if
import rego.v1

fixture := {
"googleworkspace": {"groups": [
Expand Down
Loading