-
Notifications
You must be signed in to change notification settings - Fork 718
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
[2.19] Document content-hashing in pubspec.lock #4361
Comments
Filed link in #4362 |
The feature was implemented here: dart-lang/pub#3482 |
Ensuring that the link doesn't go to 404, instead it'll go to the bug that we should write the page. See #4361 Hopefully, this helps us not forget to write the page, and helps users highlight it if we do. It's certainly better than having a 404.
Without the new We don't really have great centralized documentation of |
From a user perspective, how do you use this feature to verify the integrity of downloaded packages? |
That seems like the only decent place to put it at the moment. It might be a little too high level/conceptual if we want to document the "how" in @johnpryan's question (@jonasfj or @sigurdm it'd be wonderful to get that info to fill out the docs!) Another option: An aside: |
Maybe... I'm inclined to keep the "pubspec page" being just reference documentation. It's the closest thing to a specification we have for We could also mention
@johnpryan, when calling |
@sigurdm Question about these two statements that seem to be conflicting: Here in (I'm assuming) the API docs:
And here in the feature PR:
Does this mean that
If I'm wrong, could you explain what each of these points mean in reference to each other? Thank you |
I can try: The version-listing API optionally can serve the hash of the archive. This can be used to verify the downloaded archive is correct. pub.dev implements this. No matter if the hash is in the version listing or not it will be computed after download of the archive, and stored in the pub cache for later reference. (I think this is what you were missing). Now a hash in an existing pubspec.lock will first be verified against the corresponding one in the pub cache (if it exists). And if there's a mis-match the package will get redownloaded (under the assumption that the pub cache is wrong) If redownloading doesn't help (the locked hash is actually wrong) the pubspec.lock will be updated (under the assumption that the pubspec.lock was outdated or that the server was updated, but in a benign way) - a warning is written, as this should happen very rarely if ever. We could have chosen to give an error here - but that would leave the user with no other real choice than hand-editing or deleting the lockfile. But sometimes you really want to be sure that you get exactly what you ask for, and that is what
No - it will always compute it and store in the cache. Only if it is missing from the version-listing response it cannot validate the download.
No it is stored in the pub cache alongside the extracted package. |
Thank you @sigurdm that makes much more sense, really appreciate your time! |
Fixes #4361 Changes: - Added a best practices entry about `--enforce-lockfile` to [pub/dependencies](https://dart.dev/tools/pub/dependencies#best-practices) page (per @jonasfj suggestion [here](#4361 (comment))) - Added `--enforce-lockfile` to [pub-get#options](https://dart.dev/tools/pub/cmd/pub-get#options) section - Adjusted the [pub/glossary#lockfile](https://dart.dev/tools/pub/glossary#lockfile) section to discuss content hashing - Adjusted the [pub/versioning#lockfiles](https://dart.dev/tools/pub/versioning#lockfiles) section to discuss content hashing (per @parlough suggestion [here](#4361 (comment))) I'm fairly confident these are the right _places_ to add info on these new features, but am not confident in the accuracy/quality of the information I added. I think I might've conflated what content hashes actually do vs what the `--enforce-lockfile` flag does. Looking forward to reviews to get this right! Co-authored-by: Sigurd Meldgaard <sigurdm@google.com> Co-authored-by: Parker Lougheed <parlough@gmail.com>
Fixing PRs merged into v2.19 |
Fixes #4361 Changes: - Added a best practices entry about `--enforce-lockfile` to [pub/dependencies](https://dart.dev/tools/pub/dependencies#best-practices) page (per @jonasfj suggestion [here](#4361 (comment))) - Added `--enforce-lockfile` to [pub-get#options](https://dart.dev/tools/pub/cmd/pub-get#options) section - Adjusted the [pub/glossary#lockfile](https://dart.dev/tools/pub/glossary#lockfile) section to discuss content hashing - Adjusted the [pub/versioning#lockfiles](https://dart.dev/tools/pub/versioning#lockfiles) section to discuss content hashing (per @parlough suggestion [here](#4361 (comment))) I'm fairly confident these are the right _places_ to add info on these new features, but am not confident in the accuracy/quality of the information I added. I think I might've conflated what content hashes actually do vs what the `--enforce-lockfile` flag does. Looking forward to reviews to get this right! Co-authored-by: Sigurd Meldgaard <sigurdm@google.com> Co-authored-by: Parker Lougheed <parlough@gmail.com>
Fixes #4361 Changes: - Added a best practices entry about `--enforce-lockfile` to [pub/dependencies](https://dart.dev/tools/pub/dependencies#best-practices) page - Added `--enforce-lockfile` to [pub-get#options](https://dart.dev/tools/pub/cmd/pub-get#options) section - Adjusted the [pub/glossary#lockfile](https://dart.dev/tools/pub/glossary#lockfile) section to discuss content hashing - Adjusted the [pub/versioning#lockfiles](https://dart.dev/tools/pub/versioning#lockfiles) section to discuss content hashing Co-authored-by: Sigurd Meldgaard <sigurdm@google.com> Co-authored-by: Parker Lougheed <parlough@gmail.com>
Fixes #4361 Changes: - Added a best practices entry about `--enforce-lockfile` to [pub/dependencies](https://dart.dev/tools/pub/dependencies#best-practices) page - Added `--enforce-lockfile` to [pub-get#options](https://dart.dev/tools/pub/cmd/pub-get#options) section - Adjusted the [pub/glossary#lockfile](https://dart.dev/tools/pub/glossary#lockfile) section to discuss content hashing - Adjusted the [pub/versioning#lockfiles](https://dart.dev/tools/pub/versioning#lockfiles) section to discuss content hashing Co-authored-by: Sigurd Meldgaard <sigurdm@google.com> Co-authored-by: Parker Lougheed <parlough@gmail.com>
Starting Dart 2.19 we're embedding a sha256 content-hashes in
pubspec.lock
.We should document this, and create a link
dart.dev/go/content-hashes
pointing to the documentation. This link have already been added to messages in the pub tool and sdk CHANGELOG.The text was updated successfully, but these errors were encountered: