-
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
7124daf
comment out deprecated folder presigned download
Akopti8 dd01954
add new checks that will retrieve accesible prefixes
Akopti8 28456a9
add restriction on read list
Akopti8 5b4598f
added bucket limitation
Akopti8 42a5e14
add limitation for list with no detail
Akopti8 392c55c
limit read access to endpoints with allUsers
Akopti8 3626fbf
remove deprecated prefix test
Akopti8 df90a3a
Merge remote-tracking branch 'origin/main' into feature-read-restriction
Akopti8 9b21d30
clean up and refactor permissions logic
Akopti8 07156c2
change isPermittedPrefix to a public function
Akopti8 9ef1910
readd counter
Akopti8 e93254e
Improve wording of error message
ShaneMPutnam 4d29a62
add AUTH_LIMITED_READER_ROLE to .example.env
Akopti8 eb7da81
disable check permisisons endpoint when auth is off
Akopti8 4303196
update postman
Akopti8 1de00ef
add delimiter option for list with detail
Akopti8 5e62841
make list buckets more efficient with FGAC
Akopti8 b83d4c4
consistent delimiter retrieval
Akopti8 148624a
update e2e for 422 checks
Akopti8 64dfca8
remove bucket from e2e for failure testing
Akopti8 2c6cda0
add checks for auth level to ensure claims exist
Akopti8 0dd9b82
add trailing / check to the detailed list endpoint
Akopti8 f4725ac
Merge remote-tracking branch 'origin/feature-read-restriction' into f…
Akopti8 fc43cf0
move adjusted prefix before the delimiter check
Akopti8 dc2feb9
Move variable inside if statement
ShaneMPutnam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,8 @@ func (bh *BlobHandler) HandleListByPrefix(c echo.Context) error { | |
} | ||
|
||
} | ||
if delimiter && !strings.HasSuffix(prefix, "/") { | ||
|
||
if delimiter && prefix != "" && !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. Shouldnt this be after CheckAndAdjustPrefix like in the HandleListByPrefixWithDetails? It doesnt make sense that they are in two different places within the function |
||
prefix = prefix + "/" | ||
} | ||
|
||
|
@@ -138,6 +139,8 @@ func (bh *BlobHandler) HandleListByPrefixWithDetail(c echo.Context) error { | |
log.Error(errMsg) | ||
return c.JSON(statusCode, errMsg) | ||
} | ||
prefix = adjustedPrefix | ||
|
||
delimiterParam := c.QueryParam("delimiter") | ||
delimiter := true | ||
if delimiterParam != "" { | ||
|
@@ -150,7 +153,9 @@ func (bh *BlobHandler) HandleListByPrefixWithDetail(c echo.Context) error { | |
|
||
} | ||
|
||
prefix = adjustedPrefix | ||
if delimiter && prefix != "" && !strings.HasSuffix(prefix, "/") { | ||
prefix = prefix + "/" | ||
} | ||
|
||
var results []ListResult | ||
var count int | ||
|
@@ -198,7 +203,6 @@ func (bh *BlobHandler) HandleListByPrefixWithDetail(c echo.Context) error { | |
} | ||
return nil | ||
} | ||
fmt.Println(delimiter) | ||
err = s3Ctrl.GetListWithCallBack(bucket, prefix, delimiter, processPage) | ||
if err != nil { | ||
errMsg := fmt.Errorf("error processing objects: %s", err.Error()) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.