-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUG][SEC]: Fixes AuthN server-side providers (#2099)
## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - Added random jitter to mitigate timing attacks on early exist conditions - Added generic AuthError for early exist conditions - Added checks for missing headers(as this was throwing key error) - Made it possible to use the TokenTransportHeader Enum when defining client-side auth(docs also updated) - Improved validation of wrong Token transport headers with a friendlier user message - Broader exception handling now logs only exception type and line number to prevent unintentional information disclosure(A02: 2021-Cryptographic Failures - owasp top10) - Aligned both token and basic auth logic flow with exist conditions - Fixed an issue with replacement of auth headers Basic and Bearer with regex which aligns well with case-insensitivity of http headers as well as properly checking that the respective string is at the beginning of the header value - Basic auth username check is not early exit case - this simplifies the logic for pwd check - Basic auth splitting on ':' is now works for only the first split this will prevent unexpected exceptions in case the user adds more than a single ':' in the base64-encoded header value - Basic auth - decoded username and password are converted to string to prevent http header injections ## Test plan *How are these changes tested?* - [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes Docs PR TBD
- Loading branch information
Showing
7 changed files
with
120 additions
and
38 deletions.
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 |
---|---|---|
|
@@ -24,6 +24,10 @@ | |
S = TypeVar("S") | ||
|
||
|
||
class AuthError(Exception): | ||
pass | ||
|
||
|
||
ClientAuthHeaders = Dict[str, SecretStr] | ||
|
||
|
||
|
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
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