Skip to content

Hash algorithm transition plan #68

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

Closed
mnm678 opened this issue Nov 14, 2019 · 11 comments
Closed

Hash algorithm transition plan #68

mnm678 opened this issue Nov 14, 2019 · 11 comments
Milestone

Comments

@mnm678
Copy link
Collaborator

mnm678 commented Nov 14, 2019

dstufft

In the future if/when an attack against the current hash, we'll need a plan to transition to a new hash (which I think we need documented anyways, even with 2 hashes because the weakness could affect both of them).

@lukpueh
Copy link
Member

lukpueh commented Nov 15, 2019

This might be as simple as having the repository code changing the hash algorithm key in the HASHES dictionary in tuf metadata from e.g. "shaNOW-CONSIDER-WEAK" to "shaMOMENTARLY-STRONG", and to henceforth use that algorithm to hash metadata and/or target files?

If the server code does not yet support that algorithm, it needs to be updated.
If the client code does not yet support it, it should fail with an "unsupported hash algorithm error" and recommend to the user to update the client.

To me, two questions remain:

  • Should old metadata be re-generated with the new hash algorithm?

    I lean towards yes. In the worst case a migration from shaNOW-CONSIDER-WEAK to shaMOMENTARLY-STRONG is as critical as a key rotation after a compromise, in which case we also recommend renewing all metadata. And we only need to renew non-root metadata there. So no offline key handling. Still, the client has to re-download things. But I think that’s fair.

  • How does the client update itself, if it does not support the new hash algorithm?

    Simple answer: Out of band. However, to avoid that, support for new algorithms should be pushed to clients before migrating the metadata.

UPDATE on 28/12/19: Adding answers to my questions.

@lukpueh
Copy link
Member

lukpueh commented Nov 15, 2019

Btw and IIUC, Donald's comment only regarded the hash algorithms used to hash other metadata files and target files, do we also need to discuss keyid hash algorithm migration here?

There's already a half-lively discussion about the scope and algorithms for keyids, and the keyid_hash_algorithms feature, which is available in python-tuf but not mentioned in the tuf specification. See theupdateframework/python-tuf#848.

@trishankatdatadog
Copy link
Collaborator

@lukpueh I agree, this is not as straightforward as it sounds like to fix

@brainwane
Copy link

Here is a rough plan for transitioning hashes:

  1. get consensus that we need to turn off support for an old hash algorithm, by rough consensus of PyPI maintainers, announced to https://discuss.python.org/c/packaging
  2. email out an announcement to https://mail.python.org/mailman3/lists/pypi-announce.python.org/ and put it in various other announcement media (like conference talks, Twitter, documentation, etc.)
  3. put a deprecation notice in Warehouse's API output for people uploading/downloading stuff having to do with the old hash
    2a. assuming we have a package preview feature https://wiki.python.org/psf/Fundable%20Packaging%20Improvements#Package_preview_feature_for_PyPI , use that to start warning uploaders in the browser UI
  4. look at analytics and see how the curve is going
  5. do another announcement
  6. stop supporting the old algorithm and only support the new algorithm(s)

@mnm678
Copy link
Collaborator Author

mnm678 commented Nov 27, 2019

As part of the transition plan, would it make sense to have some amount of time where both algorithms are supported? Maybe we can add a note about how clients can chose the hash algorithm they will use during that transition time (the most recent supported one)

@brainwane
Copy link

Right! I had been assuming that we'd STARTED the transition plan with both algorithms being supported.

Also, I'm remembering now:

This PEP does not prescribe how package managers, such as pip, should be adapted to install or update projects from PyPI with TUF metadata.

That's a job for the TUF docs, and then detailed specification regarding the upload tooling side is going to be in PEP 480. PEP 458 is just going to be about Warehouse.

So actually a fuller plan goes like:

  1. Implement new algorithm in Warehouse, and have APIs include support for old + new.
  2. Announce new feature. Advise official download clients (pip and bandersnatch, let's say) and official upload tooling (probably twine, setuptools, distutils) to implement support for new hashing algorithm.
  3. Once key clients have support for new hash algorithm, start defaulting to the new one.
  4. get consensus that we need to turn off support for an old hash algorithm, by rough consensus of PyPI maintainers, announced to https://discuss.python.org/c/packaging
  5. email out an announcement to https://mail.python.org/mailman3/lists/pypi-announce.python.org/ and put it in various other announcement media (like conference talks, Twitter, documentation, etc.)
  6. Put a deprecation notice in Warehouse's API output for people uploading/downloading stuff having to do with the old hash. Assuming we have a package preview feature https://wiki.python.org/psf/Fundable%20Packaging%20Improvements#Package_preview_feature_for_PyPI , use that to start warning uploaders in the browser UI
  7. Look at analytics and see how the curve is going
  8. Make another announcement
  9. Remove Warehouse support for the old algorithm and only support the new algorithm(s).

@lukpueh
Copy link
Member

lukpueh commented Nov 28, 2019

#76 is a first stab of getting the gist of the discussion here into the pep.

Feel free to throw rocks at it. Above all, @brainwane, let me know if you think I should add more of the details you provided (i.e. which channels to use for communication, how to assess if the adoption of the new algorithm is sufficient, etc.).

My rationale for keeping it that brief was that client and uploader workflows are not actually in the scope of PEP 458.

@brainwane
Copy link

@lukpueh I think your reasoning is good and I'm fine with the draft you wrote. Thanks.

@lukpueh
Copy link
Member

lukpueh commented Dec 2, 2019

Thanks for the review, @brainwane.

@brainwane
Copy link

Since the related PR has been merged, can we now close this?

@mnm678
Copy link
Collaborator Author

mnm678 commented Jan 8, 2020

Yes, resolved via python#1253

@mnm678 mnm678 closed this as completed Jan 8, 2020
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

No branches or pull requests

4 participants