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

accounts/abi: properly quote untrusted data in error message #26110

Merged
merged 2 commits into from
Nov 7, 2022

Conversation

ngotchac
Copy link
Contributor

@ngotchac ngotchac commented Nov 4, 2022

Printing some bytes as string(...) can create some non UTF-8 characters, which can mess up some log parsers (eg. Loki/Promtail/Grafana combo). I think a hex-string should be sufficient, which can easily be converted to string by the end user if needed.

@holiman
Copy link
Contributor

holiman commented Nov 4, 2022 via email

@ngotchac
Copy link
Contributor Author

ngotchac commented Nov 5, 2022

If you want hex, use the formatter %x. Another option might be %q, which is quoted printable.

Oh right, thanks! Updated it :)

accounts/abi/abi.go Outdated Show resolved Hide resolved
@holiman holiman added this to the 1.11.0 milestone Nov 5, 2022
@holiman holiman changed the title abi: Format bytes as hex-string instead of string(data) abi: properly quote untrusted data in error message Nov 7, 2022
@holiman holiman changed the title abi: properly quote untrusted data in error message accounts/abi: properly quote untrusted data in error message Nov 7, 2022
@holiman holiman merged commit 111ed1a into ethereum:master Nov 7, 2022
@ngotchac ngotchac deleted the ngotchac/no-string-data branch January 2, 2023 14:38
shekhirin pushed a commit to shekhirin/go-ethereum that referenced this pull request Jun 6, 2023
…m#26110)

* abi: Format data as hex-string instead of string(data)

* Update accounts/abi/abi.go

Co-authored-by: Martin Holst Swende <martin@swende.se>
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.

3 participants