generated from TrueCloudLab/basic
Initial implementation #2
No reviewers
TrueCloudLab/storage-core-developers
TrueCloudLab/storage-services-developers
Labels
No labels
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/policy-engine#2
Loading…
Reference in a new issue
No description provided.
Delete branch "fyrchik/policy-engine:init"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
f95aac7b36
to839b694a89
839b694a89
to3970569602
[#xx] Initial implementationto Initial implementationdkirillov referenced this pull request2023-10-20 07:53:21 +00:00
@ -0,0 +151,4 @@
return NoRuleFound, false
}
for i := range r.Action {
if globMatch(r.Action[i], req.Operation()) {
Should the args be in reverse order?
if globMatch(req.Operation(), r.Action[i]) {
Fixed
Did you push the fix into
init
branch in the main repoif globMatch(req.Operation(), r.Action[i]) {
and not to the branch from which this PR is opened https://git.frostfs.info/fyrchik/policy-engine/src/commit/3970569602d100fc47b9b0e51f55586820652f8b/chain.go#L154 ?
Yes, probably, fixed
@ -0,0 +20,4 @@
func init() {
// FIXME #1 (@fyrchik): Introduce more optimal serialization format.
gob.Register(Chain{})
As far as i remember
gob
requires to register every type, but Chain contains interfaces. Is simple json not good enough?true, replaced
@ -0,0 +110,4 @@
CondArnNotLike ConditionType = "ArnNotLike"
)
func (c *Condition) Match(obj Request) bool {
obj Request -> req Request
fixed
@ -0,0 +118,4 @@
case ObjectRequest:
val = obj.Property(c.Key)
default:
return false
Explain please why unknown Object leads to false, but unknown Op leads to panic?
Made panic for both. Panic is for the development stage, to avoid long debugging sessions after silent misbehaviour.
@ -0,0 +3,4 @@
// Request represents generic named resource (bucket, container etc.).
// Name is resource depenent but should be globally unique for any given
// type of resource.
type Request interface {
I think interface can be replaced with struct, because Request looks like data-holder, not behavior.
But it is up to you.
It is an interfarce because of 2 reasons:
Maybe I don't understand, what is the exact struct you have in mind?
Something like that:
I belive that both of s3-gw and node will go to the same implementation of this interface.
It is not required to copy everything
I wanted to avoid allocating
Properties
map as much as possible. Let's see the prototypes and figure out whether is is better.This is not a final implementation.
@ -0,0 +176,4 @@
func (r *Rule) matchAll(obj Request) (status Status, matched bool) {
for i := range r.Condition {
if !r.Condition[i].Match(obj) {
return NoRuleFound, false
NoRuleFound -> AccessDenied:
There are multiple rules in the chain,
AccessDenied
implies one of the conditions has matched.Ah, ok
@ -0,0 +171,4 @@
return r.Status, true
}
}
return NoRuleFound, false
NoRuleFound -> AccessDenied
Agree here, I have postponed having default DENY values for future, to make the result more explicit.
3970569602
toc1ac4ad957
c1ac4ad957
to9fe3e55d6f
It seems we need fix link to the PR in commit message
9fe3e55d6f
to5ebb2e694c