mirror of
https://github.com/ferdzo/fs.git
synced 2026-04-05 01:56:25 +00:00
skip S3 policy check for admin routes after signature verify
This commit is contained in:
@@ -171,18 +171,6 @@ func (s *Service) AuthenticateRequest(r *http.Request) (RequestContext, error) {
|
|||||||
return RequestContext{}, ErrSignatureDoesNotMatch
|
return RequestContext{}, ErrSignatureDoesNotMatch
|
||||||
}
|
}
|
||||||
|
|
||||||
policy, err := s.store.GetAuthPolicy(identity.AccessKeyID)
|
|
||||||
if err != nil {
|
|
||||||
return RequestContext{}, ErrAccessDenied
|
|
||||||
}
|
|
||||||
target := resolveTarget(r)
|
|
||||||
if target.Action == "" {
|
|
||||||
return RequestContext{}, ErrAccessDenied
|
|
||||||
}
|
|
||||||
if !isAllowed(policy, target) {
|
|
||||||
return RequestContext{}, ErrAccessDenied
|
|
||||||
}
|
|
||||||
|
|
||||||
authType := "sigv4-header"
|
authType := "sigv4-header"
|
||||||
if input.Presigned {
|
if input.Presigned {
|
||||||
authType = "sigv4-presign"
|
authType = "sigv4-presign"
|
||||||
@@ -198,6 +186,18 @@ func (s *Service) AuthenticateRequest(r *http.Request) (RequestContext, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
policy, err := s.store.GetAuthPolicy(identity.AccessKeyID)
|
||||||
|
if err != nil {
|
||||||
|
return RequestContext{}, ErrAccessDenied
|
||||||
|
}
|
||||||
|
target := resolveTarget(r)
|
||||||
|
if target.Action == "" {
|
||||||
|
return RequestContext{}, ErrAccessDenied
|
||||||
|
}
|
||||||
|
if !isAllowed(policy, target) {
|
||||||
|
return RequestContext{}, ErrAccessDenied
|
||||||
|
}
|
||||||
|
|
||||||
return RequestContext{
|
return RequestContext{
|
||||||
Authenticated: true,
|
Authenticated: true,
|
||||||
AccessKeyID: identity.AccessKeyID,
|
AccessKeyID: identity.AccessKeyID,
|
||||||
|
|||||||
Reference in New Issue
Block a user