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

Should SignMessage guard against large metadata? #358

Closed
asraa opened this issue Aug 19, 2022 · 3 comments
Closed

Should SignMessage guard against large metadata? #358

asraa opened this issue Aug 19, 2022 · 3 comments

Comments

@asraa
Copy link
Contributor

asraa commented Aug 19, 2022

It's not likely to be a large metadata file, but should we watch out for it?

Originally posted by @trishankatdatadog in #357 (comment)

See here:

SignMessage(message []byte) ([]byte, error)

SignMessge takes in an arbitrary length message bytes and hashes it before signing. In my opinion, sining is never done by the client so it's not as much of a threat.

On the other hand, the general procedure of unmarshalling metadata should come with JSON size limits. Client fetchers may already do this.

@znewman01
Copy link
Contributor

👎 to adding length limits to SignMessage, you shouldn't be signing things you haven't validated or created yourself anyway

👍 to making SignMessage take in an io.Reader (which would enable using a LimitedReader if a caller cares)

On the other hand, the general procedure of unmarshalling metadata should come with JSON size limits. Client fetchers may already do this.

python-tuf has these limits. It enforces them at fetch-time (e.g., for root). I think that makes way more sense than doing it at SignMessage time.

@trishankatdatadog
Copy link
Member

👎 to adding length limits to SignMessage, you shouldn't be signing things you haven't validated or created yourself anyway

👍 to making SignMessage take in an io.Reader (which would enable using a LimitedReader if a caller cares)

I don't feel strongly either way, but defence-in-depth is always a good idea.

On the other hand, the general procedure of unmarshalling metadata should come with JSON size limits. Client fetchers may already do this.

python-tuf has these limits. It enforces them at fetch-time (e.g., for root). I think that makes way more sense than doing it at SignMessage time.

Agree, this is where it's more important: during verify, not signing.

@rdimitrov
Copy link
Contributor

Closing since the code base changed and this is no longer valid. Similar to python-tuf we do verify the length of the metadata when loading one.

Thanks for raising this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants