-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature read restriction #41
Changes from 8 commits
7124daf
dd01954
28456a9
5b4598f
42a5e14
392c55c
3626fbf
df90a3a
9b21d30
07156c2
9ef1910
e93254e
4d29a62
eb7da81
4303196
1de00ef
5e62841
b83d4c4
148624a
64dfca8
2c6cda0
0dd9b82
f4725ac
fc43cf0
dc2feb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,20 +66,15 @@ func (bh *BlobHandler) HandleListByPrefix(c echo.Context) error { | |
} | ||
|
||
delimiterParam := c.QueryParam("delimiter") | ||
var delimiter bool | ||
if delimiterParam == "true" || delimiterParam == "false" { | ||
delimiter := true | ||
if delimiterParam != "" { | ||
delimiter, err = strconv.ParseBool(delimiterParam) | ||
if err != nil { | ||
errMsg := fmt.Errorf("error parsing `delimiter` param: %s", err.Error()) | ||
log.Error(errMsg.Error()) | ||
return c.JSON(http.StatusUnprocessableEntity, errMsg.Error()) | ||
} | ||
|
||
} else { | ||
errMsg := fmt.Errorf("request must include a `delimiter`, options are `true` or `false`") | ||
log.Error(errMsg.Error()) | ||
return c.JSON(http.StatusUnprocessableEntity, errMsg.Error()) | ||
|
||
} | ||
if delimiter && !strings.HasSuffix(prefix, "/") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why dont you also need to do this in the detailed version of this function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was because of the root directory check but I just added a tertiary check to see if the prefix is empty we don't add a '/' and added it for both of them. Thanks! |
||
prefix = prefix + "/" | ||
|
@@ -143,6 +138,18 @@ func (bh *BlobHandler) HandleListByPrefixWithDetail(c echo.Context) error { | |
log.Error(errMsg) | ||
return c.JSON(statusCode, errMsg) | ||
} | ||
delimiterParam := c.QueryParam("delimiter") | ||
delimiter := true | ||
if delimiterParam != "" { | ||
delimiter, err = strconv.ParseBool(delimiterParam) | ||
if err != nil { | ||
errMsg := fmt.Errorf("error parsing `delimiter` param: %s", err.Error()) | ||
log.Error(errMsg.Error()) | ||
return c.JSON(http.StatusUnprocessableEntity, errMsg.Error()) | ||
} | ||
|
||
} | ||
|
||
prefix = adjustedPrefix | ||
|
||
var results []ListResult | ||
|
@@ -191,8 +198,8 @@ func (bh *BlobHandler) HandleListByPrefixWithDetail(c echo.Context) error { | |
} | ||
return nil | ||
} | ||
|
||
err = s3Ctrl.GetListWithCallBack(bucket, prefix, true, processPage) | ||
fmt.Println(delimiter) | ||
ShaneMPutnam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
err = s3Ctrl.GetListWithCallBack(bucket, prefix, delimiter, processPage) | ||
if err != nil { | ||
errMsg := fmt.Errorf("error processing objects: %s", err.Error()) | ||
log.Error(errMsg.Error()) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how this would ever be true? If initAuth == "0" then line 324 would have already returned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new init auth that will turn on and off auth in general, not the auth level which indicates whether we want FGAC or not. This is because when auth is turned off we can't get the user email from the claims which would break this endpoint.
I've just added checks to two other functions that are used in endpoints that require the claims.