Skip to content
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

secured api_key against timing attacks #1111

Merged

Conversation

wadeking98
Copy link
Contributor

Signed-off-by: wadeking98 wkingnumber2@gmail.com
@andrewwhitehead
comparing user input to secrets and then responding makes this application vulnerable to timing attacks. See resource here: https://blog.sqreen.com/developer-security-best-practices-protecting-against-timing-attacks/

While an attacker isn’t likely to be able to exploit this from somewhere over the internet due to network jitter, they might be able to pull it off if the agent ever supports TOR, HTTP/2 (timeless timing attack), or if they get access to a pod inside the same openshift cluster that can send requests to the agent (ie: the api pod)

Signed-off-by: wadeking98 <wkingnumber2@gmail.com>
Signed-off-by: wadeking98 <wkingnumber2@gmail.com>
Signed-off-by: wadeking98 <wkingnumber2@gmail.com>
@codecov-commenter
Copy link

Codecov Report

Merging #1111 (2825b26) into main (daff06a) will increase coverage by 0.00%.
The diff coverage is 75.00%.

@@           Coverage Diff           @@
##             main    #1111   +/-   ##
=======================================
  Coverage   99.36%   99.36%           
=======================================
  Files         381      381           
  Lines       21897    21898    +1     
=======================================
+ Hits        21759    21760    +1     
  Misses        138      138           

@@ -66,7 +67,7 @@ async def send_message(transport, payload, endpoint, api_key):
send_message(transport, "{}", endpoint=server_addr, api_key=api_key), 5.0
)
assert self.message_results == [{}]
assert self.headers.get("x-api-key") == api_key
assert api_key and compare_digest(self.headers.get("x-api-key"), api_key)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's any need to use this comparison method in the test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I'll remove it

Signed-off-by: wadeking98 <wkingnumber2@gmail.com>
@andrewwhitehead andrewwhitehead merged commit 1d95c65 into hyperledger:main Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants