Commit graph

4784 commits

Author SHA1 Message Date
lukpueh
fa15eeae81
Merge pull request #1776 from kairoaraujo/issue#1739/relative_links_404
docs: fix relative to absolute links on README.md
2022-01-19 09:54:53 +01:00
Kairo de Araujo
0a4d88a8ab docs: fix relative to absolute links on README.md
This commit fixes the relatives links on README.md, adding absolute
links.
The PyPI renders the README.md as an HTML page on the landing page
of the python-tuf package. If the links are not absolute links to
the files in git repository, they will fail.

Fixes: #1739

Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
2022-01-18 12:06:42 +01:00
lukpueh
2b0776cfbe
Merge pull request #1777 from kairoaraujo/fix_typo_fast_forward_tests
Fix typo on fast forward test functions
2022-01-18 10:10:27 +01:00
Kairo de Araujo
480ab2d05d Fix typo on fast forward test functions
Fix typo on fast forward test functions name.

Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
2022-01-17 18:00:05 +01:00
Jussi Kukkonen
8ccbd63470
Merge pull request #1759 from kairoaraujo/issue#1634/encode_role_names
Explicit encode role names
2022-01-17 15:55:49 +02:00
Kairo de Araujo
aa6d28fbc3 explicit encode role names
This commit explicitly encodes role names. Mostly this encoding is already
happening in ``requests`` for what is not a URL.
The "/" in a role name will now be encoded.

Also, a slight change in the RepositorySimulator will align with the tests.

This commit partially covers issue #1634

Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
2022-01-17 12:12:43 +01:00
lukpueh
ecc1cb08b8
Merge pull request #1773 from lukpueh/rm-spec-fwd
doc: remove spec "forwarder" docs
2022-01-17 09:26:55 +01:00
Lukas Puehringer
798383f88f doc: remove spec "forwarder" docs
Remove old doc/tuf-spec* documents, which are merely pointers to
the theupdateframework/specification repo (created in late 2017).

They were likely kept in place to avoid 404s of old links, but the
up-to-date TUF specification location should be discoverable enough
to get rid of the pointers.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2022-01-14 13:10:32 +01:00
lukpueh
059bfda391
Merge pull request #1771 from kairoaraujo/remove_white_trailing_spaces_docs
doc: Remove trailing whitespaces from docs files
2022-01-14 10:14:10 +01:00
lukpueh
4f6e617bc6
Merge pull request #1769 from lukpueh/rm-duplicate-docs
doc: remove duplicate outdated docs
2022-01-14 10:10:41 +01:00
lukpueh
8ae05b3e2b
Merge pull request #1768 from lukpueh/rm-deprecated-docs
doc: remove deprecated tuf/server client docs
2022-01-14 10:02:51 +01:00
Jussi Kukkonen
551a43b892
Merge pull request #1767 from lukpueh/rm-fossa-config
Remove obsolete fossa license scan config
2022-01-14 09:18:45 +02:00
Kairo de Araujo
e6492112d8 doc: Remove trailing whitespaces from docs files
This commit is a simple trailing whitespaces cleanup from the files
inside the docs folder.
The files on docs sub-directories are not part of this commit.
The docs/SECURITY.md will be removed on PR #1769

Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
2022-01-14 07:40:17 +01:00
Lukas Puehringer
3533d8aa98 doc: remove duplicate outdated docs
These documents are also hosted on our website and in a better
shape too (kudos to @jhdalek55!). There is no need to maintain
outdated duplicates.

This patch removes the documents and updates references as needed.

Note, the full history of these docs can be tracked in the old
archived website repo and in the new one (filenames may vary in
case and extension):
old: https://github.com/theupdateframework/theupdateframework.github.io
new: https://github.com/theupdateframework/theupdateframework.io/tree/master/content

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2022-01-13 17:02:53 +01:00
Lukas Puehringer
4cc0b9c2f0 Remove deprecated tuf/server client docs
These documents describe TUF server (mostly key management) and
client (mostly targets delegation) operations referring to a long
outdated TUF specification and suggesting the use of long gone
python-tuf tooling.

A deprecation disclaimer was added to the document headers already
in 2014 (see b84225f3e7).

I think it is safe to remove them.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2022-01-13 16:00:40 +01:00
Lukas Puehringer
bd630449c6 Remove obsolete fossa license scan config
fossa.com integration for automated license compliance scans was
discontinued with #1242. There has been no initiative to
re-enable it in over a year.

This patch removes a since then obsolete config file. Let's re-add
when needed.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2022-01-13 15:29:09 +01:00
Jussi Kukkonen
f172972f72
Merge pull request #1765 from lukpueh/metadata-api-fix-2-err-msgs
Metadata API: Add missing space in 2 err messages
2022-01-11 17:34:58 +02:00
Jussi Kukkonen
40c97376de
Merge pull request #1757 from MVrachev/persistent-tmp-file-cleaning
ngclient updater: clean temp file if write fails
2022-01-11 17:33:27 +02:00
Lukas Puehringer
fe318be693 Metadata API: Add missing space in 2 err messages
Just came across two instances where line-continued strings missed
a separating whitespace and fixed them.

Note: I also checked the entire repo for more such cases using the
regex `[^ ]["']\n *f?["'][^ ]` but didn't find any.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2022-01-11 15:15:41 +01:00
Martin Vrachev
6f91da61ad ngclient: clean temp file if write fails
When calling updater._persist_metadata() there is a possibility that
writing the temporary file to storage can succeed, but moving it with
os.replace could fail with OSError.
Make sure we are removing the newly created temporary file in that case.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2022-01-11 13:43:11 +02:00
Jussi Kukkonen
5809ec51e9
Merge pull request #1754 from jku/role-keyids-order-fix
Metadata API: Make Role.keyids ordered
2022-01-11 13:00:44 +02:00
lukpueh
3766903dbf
Merge pull request #1740 from lukpueh/rm-metadata-api-bump_version
Metadata API: Remove Signed.bump_version() method
2022-01-11 11:04:28 +01:00
Lukas Puehringer
8620f389a8 Metadata API: Remove Signed.bump_version() method
Remove `bump_version()` method, which is just an alias for "+= 1"
on the version attribute. For a slim low-level API it seems okay to
just directly access/modify the attribute.

The extra level of abstraction of "bumping a version" is more
appropriate for a repository library (see #1136).

This patch also removes a related unit test and updates another one
to directly do `(...).version +=`.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2022-01-11 10:56:41 +01:00
lukpueh
2840ff7c1a
Merge pull request #1750 from jku/targetfile-doc-fix
docs: Make it clear what is hashed
2022-01-11 10:47:40 +01:00
Jussi Kukkonen
a842ebfef6
Merge pull request #1760 from kairoaraujo/issue#1598/automated_issue_spec_version
Add to CI check for specification version.
2022-01-11 11:30:13 +02:00
Kairo de Araujo
2f93e9d0a2 Add workflows permissions
read the contents and write (open) issues

Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
2022-01-11 10:11:56 +01:00
Kairo de Araujo
852bd02bbe Improve the logs output
Minor changes to the console logs add versioning and simplify when
they are logged.

Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
2022-01-11 09:35:49 +01:00
Kairo de Araujo
93f7dc0a76 Fix query syntax
Fix query syntax that was missing the repository parameter

Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
2022-01-11 08:51:40 +01:00
Kairo de Araujo
2f4565e100 Add to CI check for specification version.
This commit adds to the CI an automatic check for the TUF
specification version and compares it with the python-tuf metadata
API version.

If the version does not match and there is not a issue already open,
a new issue is opened.

Closes #1598

Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
2022-01-11 08:51:40 +01:00
Jussi Kukkonen
61ffc9ff81
Merge pull request #1762 from MVrachev/fix-pylint-warning
Fix two new pylint warnings
2022-01-11 09:08:12 +02:00
Martin Vrachev
b47ef92833 Fix pylint warnings
New pylint warnings appeared related to changes
in urlib3:
- tests/test_fetcher_ng.py:128: error: Argument 1 to "ReadTimeoutError"
has incompatible type "None"; expected "ConnectionPool"  [arg-type]
- tests/test_fetcher_ng.py:128: error: Argument 2 to "ReadTimeoutError"
has incompatible type "None"; expected "str"  [arg-type]
I noticed these error in this CI run:
https://github.com/theupdateframework/python-tuf/runs/4764931441?check_suite_focus=true

I fixed them by creating a urllib3.HTTPConnectionPool() instance as
the first argument and replaced the second argument with an empty
string.
This seems to do the job.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2022-01-10 19:56:29 +02:00
Jussi Kukkonen
45cf6076e3
Merge pull request #1703 from ivanayov/test_loading_of_cached_metadata
Test loading of cached metadata in ngclient
2022-01-07 16:13:01 +02:00
Ivana Atanasova
d27c0fd585 Test loading of cached metadata in ngclient
After making a successful update of valid metadata which stores it
in cache and performing a second update with a new updater while
the metadata is already stored in cache, this test verifies that
timestamp, snaphot and targets are loaded from cache and not
downloaded

Fixes #1681

Signed-off-by: Ivana Atanasova <iyovcheva@vmware.com>
2022-01-07 16:02:55 +02:00
Jussi Kukkonen
3d4df876c2
Merge pull request #1741 from sechkova/remove-updater-with-sim
Remove test_updater_with_simulator.py
2022-01-07 12:54:43 +02:00
Jussi Kukkonen
d8591e78a9
Merge pull request #1742 from kairoaraujo/issue#1713/test_fast-forward_recovery_targets
test targets fast-forward attack recovery
2022-01-07 11:23:40 +02:00
Jussi Kukkonen
4917a5c134
Merge pull request #1749 from MVrachev/custom-doc
Add TargetFile.custom() documentation when building readthedocs
2022-01-07 10:47:45 +02:00
Jussi Kukkonen
f0f58386d6
Merge pull request #1755 from jku/trivial-doc-fix
docs: Fix Updater.find_cached_target() docstring
2022-01-07 10:44:11 +02:00
Jussi Kukkonen
b12a67c047
Merge pull request #1738 from kairoaraujo/issue#1713/test_fast-forward_recovery_snapshot
test snapshot fast-forward attack recovery
2022-01-07 10:43:55 +02:00
Martin Vrachev
0c9764925d Make make TargetFile.custom() visible in the docs
By adding a docstring to the property RTD noticed custom and
documented it.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2022-01-05 16:45:25 +02:00
Martin Vrachev
79df859078 Metadata API simplify dictionary.get() call
Dictionary.get() by default will return "None" if the key is not
found as documented in:
https://docs.python.org/3/library/stdtypes.html#dict.get
This means we don't get anything by passing the default type.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2022-01-05 16:21:04 +02:00
Jussi Kukkonen
80d3fcf56b Metadata API: Make Role.keyids ordered
keyids are ordered in the data we deserialize: Not preserving that order
breaks canonicalization. Set does not preserve order.

Change Role.keyids type from Set to List. This is strictly speaking
an API change but a minor one: keyids are supposed to be changed
via add_key()/remove_key().

Add tests for this for both Role and DelegatedRole. Shorten a related
exception message.

Fix #1752

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2022-01-05 14:28:17 +02:00
Joshua Lock
537a0198b4
Merge pull request #1743 from lukpueh/rm-metadata-api-bump_expiration
Metadata API: Remove Signed.bump_expiration() method
2022-01-05 12:08:24 +00:00
Jussi Kukkonen
c46ee17f70 docs: Fix Updater.find_cached_target() docstring
This fixes broken layout on RTD.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2022-01-05 13:04:56 +02:00
Kairo de Araujo
5b4a47a067 test targets fast-forward attack recovery
This test simulates the targets fast-forward attack recovery.
It simulates that the targets keys were compromised, the attacker
generated a new high version of the targets.

The repository generates new key for snapshot to rollback the
targets version to the initial version.

Signed-off-by: Kairo de Araujo <kdearaujo@vmware.com>
2022-01-04 15:14:16 +01:00
Jussi Kukkonen
cbf1e45572 docs: Make it clear what is hashed
TUF uses file name hashes elsewhere so make it clear when hashes are for
file _contents_.

Fixes #1737.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2022-01-03 11:55:23 +02:00
lukpueh
d51b19f4a2
Merge pull request #1744 from lukpueh/fix-1.0.0-announcement-links
doc: fix broken links in 1.0.0-ANNOUNCEMENT.md
2021-12-22 12:44:08 +01:00
Lukas Puehringer
d3ef746f7c doc: fix broken links in 1.0.0-ANNOUNCEMENT.md
The recent move of 1.0.0-ANNOUNCEMENT.md (#1732) broke the
relative links in the document.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2021-12-22 12:28:25 +01:00
Teodora Sechkova
672df74ce8
Remove test_updater_with_simulator.py
Move the remaining
test_snapshot_rollback_with_local_snapshot_hash_mismatch
to test_updater_top_level_update.py and remove the file.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2021-12-22 13:23:36 +02:00
Teodora Sechkova
aadc6fdc70
Remove test_keys_and_signatures
Key rotations and metadata update are now extesively tested in:
- test_updater_key_rotations.py
- test_updater_top_level_update.py

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2021-12-22 13:23:35 +02:00
Teodora Sechkova
1cfa249dea
Move test_not_loading_targets_twice
Move test_not_loading_targets_twice to
test_updater_top_level_update.py.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2021-12-22 13:23:35 +02:00