Skip to content

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

Merged
holiman merged 2 commits intoethereum:masterfrom
ngotchac:ngotchac/no-string-data
Nov 7, 2022
Merged

accounts/abi: properly quote untrusted data in error message#26110
holiman merged 2 commits intoethereum:masterfrom
ngotchac:ngotchac/no-string-data

Conversation

@ngotchac
Copy link
Copy Markdown
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
Copy Markdown
Contributor

holiman commented Nov 4, 2022 via email

@ngotchac ngotchac force-pushed the ngotchac/no-string-data branch from 0a255da to 1ed66b1 Compare November 5, 2022 05:02
@ngotchac
Copy link
Copy Markdown
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 :)

Comment thread accounts/abi/abi.go Outdated
@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>
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 24, 2025
…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