Commit graph

3793 commits

Author SHA1 Message Date
Joshua Lock
7cc41c6fee
Merge pull request #1122 from joshuagl/joshuagl/release-0.14.0
Prepare 0.14.0 release
2020-09-10 09:51:37 +01:00
Joshua Lock
37b5d404c8
Merge pull request #1121 from joshuagl/joshuagl/rm-keyid-hash-algorithms
Remove accidentally introduced uses of keyid_hash_algorithms
2020-09-10 09:51:15 +01:00
Joshua Lock
3e68b3a07e Prepare 0.14.0 release
Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-09-09 11:11:48 +01:00
Joshua Lock
fcc6841247 More consistent formatting in RELEASE.md
Consistently enclose filenames referred to througout the release process in
backticks to ensure they are rendered in the code style.

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-09-09 11:07:25 +01:00
Joshua Lock
7c18cbbbfb Remove uses of keyid_hash_algorithms
PR #1014 removed uses of keyid_hash_algorithms in favour of using the calculated
keyid values from the metadata. A few instances of this removal were
unintentionally reintroduced in PR #1016, when changing to explicitly passing
a list of hash algorithms rather than changing securesystemslib settings
values.

This change removes uneccessary uses of keyid_hash_algorithms.

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-09-09 10:51:46 +01:00
Joshua Lock
c4617ff55f
Merge pull request #1102 from MVrachev/1080
Add a way to disable hash prefix when using consistent_snapshot
2020-09-02 16:28:31 +01:00
lukpueh
11a743c7fa
Merge pull request #1117 from theupdateframework/dependabot/pip/cryptography-3.1
build(deps): bump cryptography from 3.0 to 3.1
2020-09-02 13:11:13 +02:00
dependabot-preview[bot]
598e7a181b
build(deps): bump cryptography from 3.0 to 3.1
Bumps [cryptography](https://github.com/pyca/cryptography) from 3.0 to 3.1.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/3.0...3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-27 10:26:19 +00:00
Joshua Lock
7b7a14ab42
Merge pull request #1074 from sechkova/delegations-update
Update targets delegations in generate_targets_metadata
2020-08-26 15:54:45 +01:00
Joshua Lock
28f0b676a1
Merge pull request #1016 from MVrachev/refactor-format-metadata-to-key
Refactor to use changed format metadata to key
2020-08-26 15:05:36 +01:00
Teodora Sechkova
b6307ddf6d
Fix typo in comment section
Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2020-08-26 13:53:52 +03:00
Teodora Sechkova
b3b0c041fe
Add test for delegations update
Add a new test case in test_generate_targets_metadata
to check if targets metadata is up-to-date with its delegated
roles.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2020-08-26 13:53:51 +03:00
Teodora Sechkova
05a70085b2
Update failing tests for generate_targets_metadata
Tests logic is modified to accommodate for the update of the
delegations during generate_targets_metadata().

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2020-08-26 13:53:51 +03:00
Teodora Sechkova
8f05420e68
Load delegated roles 'keyids' and 'threshold'
Use the delegation graph traversal during load_repository()
to load delegated roles' 'keyids' and 'threshold' by reading it
from the delegating role metadata.

If more than one delegation to the same role exists, only the first
one is loaded in roledb for this role.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2020-08-26 13:53:50 +03:00
Teodora Sechkova
f7c9fcb460
Update delegations in generate_targets_metadata()
Collect keys and threshold of delegated roles and update
delegations in generate_targets_metadata in a similar manner
as generate_root_metadata() does for top-level roles.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2020-08-26 13:53:50 +03:00
Teodora Sechkova
8f396a70eb
Move _keys_to_keydict() to repository_lib
Use _keys_to_keydict() for the  key dictionary generation in
generate_root_metadata().
Rename it as a public function keys_to_keydict().

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2020-08-26 13:53:46 +03:00
lukpueh
f54bbf5bd0
Merge pull request #1116 from sechkova/raise-missing-from
Re-raise exceptions explicitly using the 'from' keyword
2020-08-24 14:49:45 +02:00
Teodora Sechkova
0ebe226fb6
Re-raise exceptions explicitly using the 'from' keyword
Versions 2.6.0 and later of pylint adhere to PEP 3134
and trigger a 'raise-missing-from' warning (W0707) when
chained exceptions are raised implicitly.

The 'from' keyword is a Python3.x feature, that is why
six.raise_from is used for Python2.x compatibility.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2020-08-24 13:44:09 +03:00
Joshua Lock
e3ff011575
Merge pull request #1101 from joshuagl/joshuagl/updater-verify-root
Fix updater workflow
2020-08-18 23:02:07 +01:00
Joshua Lock
2fc25adfad updater: verify newly downloaded root metadata with its signatures
Per the detailed client workflow in the specification step 1.2

"Version N+1 of the root metadata file MUST have been signed by:
(1) a threshold of keys specified in the trusted root metadata file
(version N), and
(2) a threshold of keys specified in the new root metadata file being
validated (version N+1)."

Number 2 is implemented here as this step was not being performed by the
Updater. Unfortunately we can't use existing signature verification
methods in tuf.sig, because tuf.sig.signature_status() does not verify
signatures for keys which are not listed in keydb (and tuf.sig.verify
uses tuf.sig.signature_status)

Therefore this patch introduces a method for verifying signatures with
root keys listed in the signable being verified.

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-08-18 21:50:46 +01:00
Joshua Lock
902a025918 updater: remove redundant __verify_root_chain_link method
This method is duplicating verification steps which have already been
completed before the file was written to disk.

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-08-18 21:50:46 +01:00
Joshua Lock
9332e8209c updater: rename _verify_uncompressed_metadata_file
We no longer handle compressed metadata files, so rename this method to be
shorter and less confusing:
_verify_uncompressed_metadata_file -> _verify_metadata_file

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-08-18 21:50:46 +01:00
Teodora Sechkova
efea88e337 Add updater tests for root signed with current keys
Co-authored-by: Joshua Lock <jlock@vmware.com>
Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-08-18 21:48:39 +01:00
Martin Vrachev
060d41e114 Test way to disable hash prefixes when download
Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2020-08-18 17:52:17 +03:00
Martin Vrachev
7a828ea716 Bump securesyslib to 0.16.0 in setup.py
Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2020-08-18 17:42:30 +03:00
Martin Vrachev
71016d7d74 Refactor to use changed format metadata to key
In commit b7a15fdee7dee899c098b01fe64d604635b2b132
or pr https://github.com/secure-systems-lab/securesystemslib/pull/227
in securesystemslib I change the function arguments of the
format_metadata_to_key function in securesystemslib/keys.py
to add the opportunity to use custom keyid hash algorithms without
chainging the securesystemslib.settings.HASH_ALGORITHMS variable.

With this commit, I make use of the above changes in tuf.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2020-08-18 17:40:49 +03:00
Joshua Lock
be9944ba8e
Merge pull request #1097 from MVrachev/optimize-length-hashes
Optimize the calculation of length and hashes
2020-08-18 14:35:15 +01:00
Joshua Lock
7b4ffe3d07
Merge pull request #1014 from mnm678/remove-keyid_hash_algorithms
Remove uses of keyid_hash_algorithms
2020-08-18 14:00:22 +01:00
Martin Vrachev
dc1168d0cb Way to disable hash prefix for consistent_snapshot
Currently, if the repository is consistent_snapshot,
Updater will prefix the target filename with the hash
when constructing the download URL.
For some adopters of TUF (like Warehouse) this is not wanted
(warehouse target file paths are "consistent",
even if the filenames are not).

For example, Warehouse doesn't follow what tuf
(the reference implementation and specification) advice for naming
consistent filenames, which is to prefix the filename with the hash
of the files contents.
However, the target filenames it does use are consistent,
only the hash is part of the target's file path
not the target's file name.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2020-08-17 19:07:19 +03:00
lukpueh
328e8e758d
Merge pull request #1110 from theupdateframework/dependabot/pip/cffi-1.14.2
build(deps): bump cffi from 1.14.1 to 1.14.2
2020-08-17 15:11:53 +02:00
Martin Vrachev
ba87454d02 Optimize the calculation of length and hashes
After we had given the option to use or not hashes and length
for timestamp and snapshot roles, it's good to make sure we are
calculating them only when they are needed.

This optimization could be important for the bigger tuf adopters.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2020-08-17 16:07:36 +03:00
Joshua Lock
85770390e8
Merge pull request #1096 from jku/test-perf-and-reliability-fixes
Test performance and reliability fixes
2020-08-17 11:55:23 +01:00
dependabot-preview[bot]
914f44d878
build(deps): bump cffi from 1.14.1 to 1.14.2
Bumps [cffi](https://github.com/python-cffi/release-doc) from 1.14.1 to 1.14.2.
- [Release notes](https://github.com/python-cffi/release-doc/releases)
- [Commits](https://github.com/python-cffi/release-doc/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-17 10:53:07 +00:00
Joshua Lock
6c8235b9da
Merge pull request #1107 from theupdateframework/dependabot/pip/securesystemslib-colorscryptopynacl--0.16.0
build(deps): bump securesystemslib[colors,crypto,pynacl] from 0.15.0 to 0.16.0
2020-08-17 11:51:58 +01:00
dependabot-preview[bot]
358a40b8e7
build(deps): bump securesystemslib[colors,crypto,pynacl]
Bumps [securesystemslib[colors,crypto,pynacl]](https://github.com/secure-systems-lab/securesystemslib) from 0.15.0 to 0.16.0.
- [Release notes](https://github.com/secure-systems-lab/securesystemslib/releases)
- [Changelog](https://github.com/secure-systems-lab/securesystemslib/blob/master/CHANGELOG.md)
- [Commits](https://github.com/secure-systems-lab/securesystemslib/compare/v0.15.0...v0.16.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-12 10:24:52 +00:00
Jussi Kukkonen
b6661e024a tests: Remove unused imports
Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-08-10 16:11:33 +03:00
Jussi Kukkonen
c7425bec13 test_proxy_use: Error out early if using Python3
proxy_server.py is python2 only, don't try to setup the class as it
leads to a confusing TimeoutError.

This may prevent me from debugging this apparent test failure a third
time.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-08-10 16:11:33 +03:00
Jussi Kukkonen
fc44652b93 tests: Use localhost consistently
Our tests already expect localhost lookup to work to find test servers:
use it consistently instead of sometimes using 127.0.0.1

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-08-10 16:11:33 +03:00
Jussi Kukkonen
a22f6182dd tests: increase wait_for_server() default timeout
Travis managed to still timeout with 5 seconds: increasing the timeout
(now that it's not a sleep) doesn't really hurt normal non-VM use cases
so let's bump it to 10 seconds.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-08-10 16:11:33 +03:00
Jussi Kukkonen
6b1011d748 log: Close the file handler when it's removed
Silences "ResourceWarning: unclosed file"

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-08-10 16:11:33 +03:00
Jussi Kukkonen
0dfa17038e tests: Remember to close file objects
This silences "ResourceWarning: unclosed file"

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-08-10 16:11:33 +03:00
Jussi Kukkonen
f468007acd test_download: Use logger for output
Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-08-10 16:11:33 +03:00
Jussi Kukkonen
740be9cdb6 tests: Avoid sleep(): make sure servers really start
* Add utility function to wait on a socket until it responds
* Use the function instead of sleeping in tests that need to wait for
  the server to start
* Increase the max timeout to 5 seconds by default (as appveyor builds
  still seem to hit the 3 second mark sometimes)

wait_for_server() functions quite differently depending on OS: Windows
can take 2 seconds to respond with ECONNREFUSED whereas Linux is almost
instant. There might be tricks to be faster on Windows (like setting
a shorter socket timeout) but this was not done here.

This makes a full Linux test run almost 40% faster and should be more
reproducible on every platform.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-08-10 16:11:33 +03:00
lukpueh
a088b68fa7
Merge pull request #1088 from theupdateframework/dependabot/pip/cryptography-3.0
build(deps): bump cryptography from 2.9.2 to 3.0
2020-08-07 11:31:41 +02:00
Trishank Karthik Kuppusamy
3c946e2f98
Merge pull request #1098 from joshuagl/joshuagl/release-fixes
Fix release related documentation
2020-08-04 16:27:28 -04:00
Joshua Lock
96c00f319a Add tag pushing to RELEASE.md
Ensure someone following the release process pushes the tag they create
and include a tag message matching the common form, rather than requiring
somebody following the steps to figure out what to enter into their editor

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-08-04 15:11:21 +01:00
Joshua Lock
32ba3bbcad Fix CHANGELOG formatting
For some reason the first level 3 heading 'Added' was not rendering
correctly. The level 2 heading for 'Fixed' should be level 3.

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-08-04 15:10:03 +01:00
lukpueh
7a418a219c
Merge pull request #1094 from joshuagl/joshuagl/v0.13.0
Prepare for a 0.13.0 release
2020-08-04 15:39:52 +02:00
Jussi Kukkonen
1367b79f38 tests: Wait for subprocess kill() to happen
This avoids the need to sleep() before removing the temporary
directories used, and makes sure we don't get
    ResourceWarning: subprocess N is still running
messages. Use subprocess.communicate() instead of wait() if the process
has a pipe (currently the return values are just dropped though).

Practical results should be more reliability and a slightly reduced
test runtime.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-08-04 16:15:05 +03:00
Joshua Lock
eb1c8d0845 setup.py: add project_urls links
These additional URLs will be displayed on PyPI:
https://packaging.python.org/guides/distributing-packages-using-setuptools/#project-urls

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-08-04 11:47:47 +01:00