Python reference implementation of The Update Framework (TUF)
Find a file
Lukas Puehringer a0397c7c82 Fix signature threshold verification
Prior to this commit metadadata signature verification as provided
by `tuf.sig.verify()` and used e.g. in `tuf.client.updater` counted
multiple signatures with identical authorized keyids each
separately towards the threshold. This behavior practically
subverts the signature thresholds check.

This commit fixes the issue by counting identical authorized keyids
only once towards the threshold.

The commit further clarifies the behavior of the relevant functions
in the `sig` module, i.e. `get_signature_status` and `verify` in
their respective docstrings. And adds tests for those functions and
also for the client updater.

---

NOTE: With this commit signatures with different authorized keyids
still each count separately towards the threshold, even if the
keyids identify the same key. If this behavior is not desired, I
propose the following fix instead. It verifies uniqueness of keys
(and not keyids):

```
diff --git a/tuf/sig.py b/tuf/sig.py
index ae9bae15..5392e596 100755
--- a/tuf/sig.py
+++ b/tuf/sig.py
@@ -303,7 +303,14 @@ def verify(signable, role, repository_name='default', threshold=None,
   if threshold is None or threshold <= 0: #pragma: no cover
     raise securesystemslib.exceptions.Error("Invalid threshold: " + repr(threshold))

-  return len(good_sigs) >= threshold
+  # Different keyids might point to the same key
+  # To be safe, check against unique public key values
+  unique_good_sig_keys = set()
+  for keyid in good_sigs:
+    key = tuf.keydb.get_key(keyid, repository_name)
+    unique_good_sig_keys.add(key["keyval"]["public"])
+
+  return len(unique_good_sig_keys) >= threshold

```

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-01-09 18:54:47 +01:00
.github Add issue and pull request templates 2017-09-28 17:01:56 -04:00
docs Fix typo in section "Release Verification" 2019-12-20 10:06:44 +01:00
tests Fix signature threshold verification 2020-01-09 18:54:47 +01:00
tuf Fix signature threshold verification 2020-01-09 18:54:47 +01:00
.fossa.yml Switch to fossa requirements analysis strategy 2019-09-17 12:52:22 +02:00
.gitignore Ignore virtualenv and pyenv files 2017-10-11 11:34:07 -04:00
.gitmodules Remove ssl_commons and ssl_crypto submodules 2017-01-09 13:00:25 -05:00
.pyup.yml Fix .pyup.yml 2018-03-29 11:09:24 -04:00
.travis.yml Update tested and supported Python versions 2019-12-13 09:46:18 +01:00
appveyor.yml test: Install mock in appveyor on Python 2.7 2019-12-16 15:16:24 +01:00
ci-requirements.txt test: Add mock test dependency for Py <3.3 2019-12-16 15:16:24 +01:00
dev-requirements.txt test: Add mock test dependency for Py <3.3 2019-12-16 15:16:24 +01:00
LICENSE Move license files to root directory 2018-02-05 10:27:04 -05:00
LICENSE-MIT Move license files to root directory 2018-02-05 10:27:04 -05:00
MANIFEST.in Include correct README in MANIFEST.in 2018-06-20 17:50:41 -04:00
pylintrc Add _repository_name and _targets_directory to Pylint's exclude-protected 2018-04-18 11:04:57 -04:00
README.md Clarified location 2020-01-07 10:40:46 -08:00
requirements.in minor: undo some import/dependency re-ordering 2018-08-31 13:28:43 -04:00
requirements.txt Update dependencies 2019-11-12 12:34:55 +01:00
setup.cfg Update release files. 2014-07-16 12:51:35 -04:00
setup.py test: Add mock test dependency for Py <3.3 2019-12-16 15:16:24 +01:00
tox.ini Update tested and supported Python versions 2019-12-13 09:46:18 +01:00

TUF A Framework for Securing Software Update Systems

Travis-CI Coveralls PyUp Python 3 FOSSA Status CII PyPI


This repository is the reference implementation of The Update Framework (TUF). It is written in Python and intended to conform to version 1.0 of the TUF specification. This implementation is in use in production systems, but is also intended to be a readable guide and demonstration for those working on implementing TUF in their own languages, environments, or update systems.

About The Update Framework

The Update Framework (TUF) design helps developers maintain the security of a software update system, even against attackers that compromise the repository or signing keys. TUF provides a flexible specification defining functionality that developers can use in any software update system or re-implement to fit their needs.

TUF is hosted by the Linux Foundation as part of the Cloud Native Computing Foundation (CNCF) and its design is used in production by companies such as Cloudflare, Datadog, DigitalOcean, Docker, Flynn, IBM, Kolide, LEAP, Microsoft, RedHat, and VMware. A variant of TUF called Uptane is widely used to secure over-the-air updates in automobiles.

Please see the TUF Introduction and TUF's website for more information about TUF!

Documentation

Contact

Please contact us via our mailing list. Questions, feedback, and suggestions are welcomed on this low volume mailing list.

We strive to make the specification easy to implement, so if you come across any inconsistencies or experience any difficulty, do let us know by sending an email, or by reporting an issue in the GitHub specification repo.

Security Issues and Bugs

Security issues can be reported by emailing jcappos@nyu.edu.

At a minimum, the report must contain the following:

  • Description of the vulnerability.
  • Steps to reproduce the issue.

Optionally, reports that are emailed can be encrypted with PGP. You should use PGP key fingerprint E9C0 59EC 0D32 64FA B35F 94AD 465B F9F6 F8EB 475A.

Please do not use the GitHub issue tracker to submit vulnerability reports. The issue tracker is intended for bug reports and to make feature requests. Major feature requests, such as design changes to the specification, should be proposed via a TUF Augmentation Proposal (TAP).

Limitations

The reference implementation may behave unexpectedly when concurrently downloading the same target files with the same TUF client.

License

This work is dual-licensed and distributed under the (1) MIT License and (2) Apache License, Version 2.0. Please see LICENSE-MIT and LICENSE.

Acknowledgements

This project is hosted by the Linux Foundation under the Cloud Native Computing Foundation. TUF's early development was managed by members of the Secure Systems Lab at New York University. We appreciate the efforts of Konstantin Andrianov, Geremy Condra, Vladimir Diaz, Yuyu Zheng, Sebastien Awwad, Santiago Torres-Arias, Trishank Kuppusamy, Zane Fisher, Pankhuri Goyal, Tian Tian, Konstantin Andrianov, and Justin Samuel who are among those who helped significantly with TUF's reference implementation. Contributors and maintainers are governed by the CNCF Community Code of Conduct.

This material is based upon work supported by the National Science Foundation under Grant Nos. CNS-1345049 and CNS-0959138. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.