Skip to content

Conversation

@nikooo777
Copy link

Currently, arbundles implementations don't correctly implement the ANS-104 spec.

Specifically: https://github.com/ArweaveTeam/arweave-standards/blob/master/ans/ANS-104.md#21-verifying-a-dataitem

A DataItem is valid iff.1:

id matches the signature (via SHA-256 of the signature)
signature matches the owner's public key
tags are all valid
an anchor isn't more than 32 bytes

A tag object is valid iff.:

there are <= 128 tags
each key is <= 1024 bytes
each value is <= 3072 bytes
only contains a key and value
both the key and value are non-empty strings

This PR aims at successfully verifying dataitems with tags together exceeding 4092 bytes in size but remaining within the per-tag threshold.
It also adds anchor validation.

As bonus point, a couple of vulnerable dependencies are updated.

add anchor validation
update vulnerable dependencies
update arweave dep
Comment on lines +247 to +252
if (nameLen === 0 || nameLen > MAX_TAG_KEY_LENGTH) {
return false;
}
if (valueLen === 0 || valueLen > MAX_TAG_VALUE_LENGTH) {
return false;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this does respect the documented spec, there are existing apps and integrations using empty strings on name and value through Turbo

Suggested change
if (nameLen === 0 || nameLen > MAX_TAG_KEY_LENGTH) {
return false;
}
if (valueLen === 0 || valueLen > MAX_TAG_VALUE_LENGTH) {
return false;
}
if nameLen > MAX_TAG_KEY_LENGTH) {
return false;
}
if (valueLen > MAX_TAG_VALUE_LENGTH) {
return false;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the input.
Apparently there are more instances of other projects violating the spec, so I think the only real change that stands a chance of getting eventually merged is going to be one where we simply check that there are at most 128 tags and each tag (name+val) is 4KB at most.

@nikooo777
Copy link
Author

closed in favor of #6

@nikooo777 nikooo777 closed this Aug 7, 2025
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.

2 participants