Spec nitpicking #293
Replies: 3 comments
-
One more thing that I just noticed: The spec does not place an upper bound on the number of stanzas that may be contained in a header. While this keeps age as flexible as possible, it does open the possibility for DOS since a recipient has to verify all stanzas in turn as for every stanza the recipient has to potentially calculate a computationally fairly expensive X25519 point multiplication. On my laptop using a recent AMD Ryzen CPU, I get about 1 MB/s of unwrapping pure X25519 age stanzas (about 10 kStanza/s). I think on more resource-constrained systems, this could become an issue. I think a possible fix could be to have something in the spec like "a compliant implementation MUST support at least [insert large but not astronomical number here, e.g. 256] stanzas of the same type" This would give application developers an useful value to refer to. Similarly, maximums on the length of a header and of a single stanza would be useful for an implementation to error out quicker than after parsing the entire file. An age payload may legitimately be several gigabytes in size. While it's hard to agree on a single maximum header size that will fit all possible use cases and all future developments, I think it should be possible to set an order of magnitude limit. Even if age goes post-quantum at some point and stanza sizes massively increase, I think something like 10 MB per stanza and say, 512MB for the whole header should be a sane limit. |
Beta Was this translation helpful? Give feedback.
-
Another minor observation from #284 on ephemeral secrets: The go implementation will generate a new ephemeral secret for every stanza, so this recipient will obviously be able to decrypt all of their stanzas but nothing unexpected will happen. However, the spec only requires a new ephemeral secret per file key. This leads to the interesting case where if an implementation actually did that and shared the same ephemeral secret e.g. for all X25519 stanzas, any recipient can check for a public key they know if it matches any other stanza. While this probably isn't a problem, the property if recipients are secret or not towards other recipients should not depend on an implementation detail like this. |
Beta Was this translation helpful? Give feedback.
-
I made similar comments in another discussion myself, as I'm writing my own implementation as well. We should swap notes. |
Beta Was this translation helpful? Give feedback.
-
Hey there,
writing a compatible, embedded (µC) decryption-only POC implementation of age, I noticed that in a few places, the spec is not explicit in what it expects, and I had to look at age's code to figure out details. I know the spec currently is not a formal spec, but I thought listing the underspecified details will be useful if at some point someone wants to create a (more) formal spec from it.
Thank you for the great work,
Jan
Beta Was this translation helpful? Give feedback.
All reactions