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

Fix GSNSignatureBouncer signature bug #67

Closed
wants to merge 1 commit into from

Conversation

crazyrabbitLTC
Copy link
Contributor

@crazyrabbitLTC crazyrabbitLTC commented Sep 17, 2019

The GSNSignatureBouncer currently accepts a zero address as a trusted signer. Even more unexpected however, is that the failure to initialize the GSNSignatureBouncer will allow the bouncer to accept no signature at all.

When uninitialized, _getTrustedSigner() will resolve a zero address for unset values. For people who deploy and fail to initialize their bouncer, their GSN contract will simply "magically" work for anyone who does not provide a signature, but they won't know that even though their valid provided signatures will always fail.

I've added a catch so that the trustedSigner can not be set to 0x0, and a check so that it will not relay transactions when no trustedSigner has been set at all.

Fixes #

As noted above, the GSNSignatureBouncer allows for Zero addresses for trustedSigners as well unexpectedly approving GSN transactions when no signature is provided at all.

The GSNSignatureBouncer currently accepts a zero address as a trusted signer. Even more unexpectedly however, is the failure to initialize the GSNSignatureBouncer: In this case the bouncer will accept no signature at all, as _getTrustedSigner() will resolve a zero address for unset values. For people who deploy and fail to initialize their bouncer, their GSN contract will simply "magically" work for anyone who does not provide a signature, but they won't know that because their valid provided signatures will always fail.

I've added a catch so that the trustedSigner can not be set to 0x0, and a check so that it will not relay transactions when no `trustedSigner` has been set at all.
@crazyrabbitLTC
Copy link
Contributor Author

Also interesting is that the test suite does not catch this error, as it always assumes the contract has been properly initialized.

crazyrabbitLTC added a commit to OpenZeppelin/openzeppelin-contracts that referenced this pull request Sep 17, 2019
Ref: OpenZeppelin/openzeppelin-contracts-upgradeable#67

Current version of the code means the GSNSignatureBouncer will accept Zero Addresses as a trusted signer. The result is that unexpectedly the contract will accept the absence of a signature as a valid signature. The added check prevents the constructor being called with a zero address.
@crazyrabbitLTC
Copy link
Contributor Author

I have closed this PR in favor of a more complete PR that includes tests.

@nventuro nventuro deleted the crazyrabbitLTC-patch-1 branch September 17, 2019 17:38
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.

1 participant