Skip to content

🐛 Bug: GovTool Metadata Hash Validation Ignores extra byte in the Manually Created Files #3591

@bosko-m

Description

@bosko-m

Area

Other

Domain

gov.tools

Which wallet were you using?

No response

Context

GovTool allows users to draft a proposal, collaborate with the community, and ultimately submit it on-chain as a Governance Action. Each Governance Action requires CIP-108-compliant metadata, which GovTool provides as a downloadable .jsonld file during submission.

Users can store this file on GitHub, typically via:

  • Option A: Add file → Upload files (file remains unchanged; validation passes)
  • Option B: Add file → Create new file (manual paste from clipboard; GitHub appends a byte 0x0A)

Currently, if the user chooses Option B, the resulting file has a 1-byte difference due to the extra byte 0x0A. In this case, GovTool is expected to fail metadata validation, as the hash should no longer match.

However, due to the JSON parsing library used by GovTool, the extra byte appears to be ignored when parsing the content and generating the hash. As a result, GovTool incorrectly validates the modified file as correct, allowing submission of a Governance Action with a hash that should be invalid.

Steps to reproduce

  1. Create a proposal and proceed to Governance Action submission.
  2. Download the metadata .jsonld file generated by GovTool.
  3. Open GitHub repository and use Add file → Create new file.
  4. Paste the content from the .jsonld file into the editor (GitHub appends extra byte 0x0A).
  5. Submit the Governance Action using the URL of this manually created file.

Actual behavior

  • GovTool accepts the metadata file with the extra byte 0x0A.
  • The resulting hash matches the original, despite the file being technically different.
  • Governance Action is successfully submitted with incorrect file integrity.

Expected behavior

  • GovTool should perform exact byte-level hashing of the metadata file.
  • Metadata with any deviation (e.g., trailing whitespace) should cause validation to fail.
  • Governance Action submission should be blocked if the metadata hash does not match exactly.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions