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

fix: check header object and reject invalid headers & versions #28

Merged
merged 1 commit into from
Jun 3, 2021

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Jun 3, 2021

Current version doesn't really check the header object is valid and it doesn't look at the version, but it should be strict, as per spec.

Also included in this is an explicit check for 0aa16776657273696f6e02 (<length>{version:2}) as per ipld/specs#248 (comment) so it can be used as a CARv2 escape - if we end up using this string as a modifier for CARv2 we can at least get proper errors out of this if it encounters a newer format.

Doing this as a semver-patch since we're within spec and I doubt there are any CARs out there without a proper {version:1, roots:[...]} header.

rvagg added a commit to ipld/go-car that referenced this pull request Jun 3, 2021
Ref: ipld/js-car#28

the primary difference with js-car is that go-car requires a non-empty roots
array whereas js-car is fine with empty roots array, hence the test fixture
differences
rvagg added a commit to ipld/go-car that referenced this pull request Jun 3, 2021
Ref: ipld/js-car#28

the primary difference with js-car is that go-car requires a non-empty roots
array whereas js-car is fine with empty roots array, hence the test fixture
differences
rvagg added a commit to ipld/go-car that referenced this pull request Jun 3, 2021
Ref: ipld/js-car#28

the primary difference with js-car is that go-car requires a non-empty roots
array whereas js-car is fine with empty roots array, hence the test fixture
differences
@rvagg rvagg merged commit e7d9300 into master Jun 3, 2021
@rvagg rvagg deleted the rvagg/check-header branch June 3, 2021 11:58
Jorropo pushed a commit to ipfs/boxo that referenced this pull request Mar 22, 2023
Ref: ipld/js-car#28

the primary difference with js-car is that go-car requires a non-empty roots
array whereas js-car is fine with empty roots array, hence the test fixture
differences


This commit was moved from ipld/go-car@2876c18
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.

1 participant