-
Notifications
You must be signed in to change notification settings - Fork 502
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
Transaction details endpoint should validate hash parameter #2392
Comments
I can reproduce this with @tamirms did you stumble into this through unescaped URLs as well? |
yeah, this is the request which triggered the error earlier:
|
The URL parameter does already get validated as utf8 (i.e. 0x00 is a valid string, see https://play.golang.org/p/rkcxiep0rFO ). I think the problem is the leading 0 when passing the transaction ID on. Looking into it further ... |
I suspect there is a bug in Squirrel's parameter substitution (or the way we use it). When doing: go/services/horizon/internal/db2/history/transaction.go Lines 22 to 24 in 06b6a58
With a
(I think that the zero is injected after the I could simply fix the problem for transactions by ensuring transaction IDs only have hex chars. However, I think we should understand the Squirrel better and verify that it doesn't happen for other parameters, since it could potentially constitute a security problem. |
There is nothing wrong with Squirrel. It turns out that Postgres uses Security-wise, I don't think this is a problem, because we are using placeholders for the parameters. So, I will just parse the hash IDs as hex characters to validate them. |
Uhm, maybe this should be fixed when merging back to master? |
@2opremio we usually close issues when we have merged them into a release branch |
👍 It seems that GitHub's automatic closing of issues only works when merging onto master. I'll investigate. |
Yeah automatic closing doesn't work except to the chosen repo root branch. It sucks but there you go. |
The endpoint which processes
/transactions/{hash}
requests does not validate the hash parameter.If you use a hash which is not a valid utf8 sequence this will result in horizon responding with a 500 status. Here is an example of this error which was logged recently:
The text was updated successfully, but these errors were encountered: