Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

Policy Expired Hook, empty policy time gap #28

Closed
WindzCUHK opened this issue Jul 23, 2019 · 7 comments
Closed

Policy Expired Hook, empty policy time gap #28

WindzCUHK opened this issue Jul 23, 2019 · 7 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@WindzCUHK
Copy link
Contributor

WindzCUHK commented Jul 23, 2019

SetExpiredHook(func(ctx context.Context, key string) {
//key = <domain>:role.<role>
p.fetchAndCachePolicy(ctx, p.rolePolicies, strings.Split(key, ":role.")[0])
})

issue

  1. ExpiredHook is called after the policy is deleted from the cache, checking policy before fetch success will be same as checking empty policy.
  2. There is no retry or error handling inside the hook.
  3. If we need to rely on the periodical Update() call to keep the policy valid anyway, we don't need this logic here.
@WindzCUHK WindzCUHK added the bug Something isn't working label Jul 23, 2019
@WindzCUHK WindzCUHK added the wontfix This will not be worked on label Jul 30, 2019
@WindzCUHK
Copy link
Contributor Author

currently, the policy will keep on updating, the expire hook will not run at all.

@kevindiu
Copy link
Member

kevindiu commented Aug 7, 2019

policy cache should not depends about the expired hook, it should depends on the refresh mechanism.
expired hook is just for safety.

@WindzCUHK
Copy link
Contributor Author

we should not assume policy will not expire...
no solutions yet, just keep this open

@kevindiu
Copy link
Member

kevindiu commented Aug 8, 2019

I did not assume policy will not expire.... policy expiration is depends on Athenz server, we need to set it correctly anyway. I think user need to pay attention on policy refresh duration otherwise the policy cache maybe insecure enough for their use.

@WindzCUHK
Copy link
Contributor Author

WindzCUHK commented Aug 8, 2019

We even the expire hook runs, this will be a problem.
The user can only set the refresh duration, so that the expire hook never runs. But that also depends on Athenz server connectivity.

@kevindiu
Copy link
Member

kevindiu commented Aug 8, 2019

So it will keep retrying to refresh policy anyway.
Actually I want to get rid of expire hook and it makes no sense for me.

@WindzCUHK
Copy link
Contributor Author

continue in: AthenZ/athenz-authorizer#3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants