Commit graph

152 commits

Author SHA1 Message Date
Vladimir Diaz
a048ca1630 Merge branch 'tighten-preorder-dfs' of https://github.com/trishankkarthik/tuf into trishankkarthik-tighten-preorder-dfs 2016-06-09 10:49:11 -04:00
Vladimir Diaz
dd8a7eb0dd Review test_indefinite_freeze_attack.py and updater.py. Minor edits made 2016-03-17 11:36:11 -04:00
Sebastien Awwad
167af8dd65
comment wording: refresh docstring explanation 2016-03-16 12:25:33 -04:00
Sebastien Awwad
93aec83fd5
fixing bug with logger.exception called outside of an except block 2016-03-14 17:43:22 -04:00
Sebastien Awwad
fee25a44cd
sharing bug with Vlad 2016-03-14 17:39:04 -04:00
Sebastien Awwad
8adab689ff
Expanding and clarifying docstring for tuf.client.updater::refresh() 2016-03-14 12:40:06 -04:00
Sebastien Awwad
66f56271d2 This is a manual squash commit of detect_expiry_322, to avoid merge conflicts.
Comment lines from the individual commits include:
1. Fix #322 by detecting expiry of stale files. initial attempt
2. temp commit of files from Soma
3. removing freeze_attack_stale_expiry and leaving the test added to indefinite freeze attack
4. fixing indefinite freeze attack test: now incorporates old reject-freshly-downloaded-but-expired-timestamp test as well as reject-stale-already-present-but-expired-snapshot test
5. small refinements to indefinite freeze attack test
6. Pulled the recursion out of the except block in refresh() to avoid unprintable nested exceptions.
7. Added comments to the last commit (retry_once)
8. Merge pull request #1 from awwad/detect_expiry_322_temp (removing cruft in another branch)
2016-03-10 15:01:12 -05:00
Vladimir Diaz
05d0acafd5 Remove extra whitespace 2016-02-29 11:03:12 -05:00
Vladimir Diaz
605d119195 Relocate the extraction of 'expected_versioninfo' earlier in the function as well 2016-02-26 16:50:30 -05:00
Vladimir Diaz
1193b79a75 Relocate the check for compressed metadata in _update_metadata_if_changed() 2016-02-26 16:45:37 -05:00
Vladimir Diaz
21910083bf Fix comment to say that _update_metadata_if_changed() returns early if metadata has not been updated. 2016-02-26 15:54:38 -05:00
Vladimir Diaz
ddd06f6205 Clean up if-else clauses in _update_metadata_if_changed() 2016-02-26 14:27:15 -05:00
Vladimir Diaz
a1c4e76a50 Add note to previous comments for os.makedirs() OSError exceptions. 2016-02-26 12:59:07 -05:00
Vladimir Diaz
14843acc28 Expand comments related to os.makedirs() exception handling in download_target() 2016-02-26 12:47:12 -05:00
Vladimir Diaz
c270a1ed5a Fix typo in _versioninfo_has_been_updated() docstring 2016-02-26 12:11:13 -05:00
Vladimir Diaz
dd9d31bef9 Add and fix comments in download_target() related to OSError exceptions 2016-02-22 16:03:49 -05:00
Vladimir Diaz
f52a9c8eff Fix minor wording issue in _update_versioninfo() 2016-02-22 14:57:23 -05:00
Vladimir Diaz
7548163912 Change function name and update comments
_versioninfo_has_changed() --> _versioninfo_has_been_updated()
false --> False (typo)
Update comments to make it clear that metadata is considered updated when it's version number increases, rather than simply changed.
2016-02-22 14:46:54 -05:00
Trishank Karthik Kuppusamy
da0a9aa196 By default, limit visited number of delegations in preorder DFS. 2016-02-19 17:44:21 -05:00
Trishank Karthik Kuppusamy
03fbe320e1 Skip visited roles in preorder DFS. 2016-02-19 17:27:17 -05:00
Vladimir Diaz
2f77fbccb6 Merge branch 'develop' of github.com:theupdateframework/tuf into tuf1.0_version_numbers 2016-01-27 17:07:06 -05:00
David Halls
4172479d39 Fix Python 3 errors
- Signing data should be byte strings
- Don't log exception outside handler (#300)
2016-01-04 22:00:13 +00:00
Vladimir Diaz
cba763239f Review updater.py 2015-10-28 13:58:14 -04:00
Vladimir Diaz
4cb851ca0a Fix remaining issues with unit tests after implementing version numbers in snapshot.json 2015-10-27 16:11:11 -04:00
Vladimir Diaz
987411ff04 Resolve remaining issues with writing / loading the new changes 2015-10-20 09:16:39 -04:00
Vladimir Diaz
f9f44d7f04 Request the expected file lengths for the different metadata roles 2015-10-15 10:58:10 -04:00
Vladimir Diaz
ed1f217022 Implement changes for _update_metadata() 2015-10-15 09:49:32 -04:00
Vladimir Diaz
89dfda1f11 self.fileinfo ---> self.versioninfo 2015-09-24 10:52:14 -04:00
Vladimir Diaz
1c8f41b0c0 Update import statements of unvendored dependencies 2015-06-02 08:29:22 -04:00
Vladimir Diaz
230920f74e Minor code coverage improvement to updater.py 2015-04-27 18:30:55 -04:00
Vladimir Diaz
f649749e10 Add whitespace to logger strings in updater.py and keydb.py 2014-09-02 14:36:44 -04:00
Vladimir Diaz
25440ecd95 Fix white space in 'tuf/client/updater.py'. 2014-08-20 13:00:53 -04:00
Vladimir Diaz
f5588e4fa0 Disable 'iso8601' logger.
Disable 'iso8601' logger messages so that the log file only contain TUF-related messages.
2014-08-20 07:52:24 -04:00
vladdd
20d5a6b3e4 Fix self.assertTrue() conditions in test_updater.py
A few test conditions in test_updater.py incorrectly used self.assertTrue() instead of self.assertEqual().
Fix updater.remove_obsolete_targets(), where targets in the destination directory were not being removed because target paths were treated as absolute paths by os.path.join().
2014-07-06 22:25:20 -04:00
vladdd
9cf9a6a8b5 Review and update Pull Request #232.
Fix test conditions for updated_targets(), which incorrectly verified the expected number of updated targets with assertTrue().

Update comment for PR fix to clarify os.path.join() behavior and the expected file paths.
2014-07-04 17:50:22 -04:00
Ruben Pollan
d437964c42 Fix indentation
Indentation is with 2 spaces
2014-07-04 13:38:16 -05:00
Ruben Pollan
a74a14186b Remove '/' from target filepath
os.path.join ignore previous parameters if one starts with '/'. All
targets start with '/', making updated_targets to try to open a file in
the root folder in case of a unix system.
2014-06-30 14:13:40 -05:00
Vladimir Diaz
e4c98d38ba Add missing test cases for download.py and and updater.py. 2014-06-12 09:33:12 -04:00
vladdd
744be00cbc Initial implementation of authoritative delegations. 2014-06-07 20:29:18 -04:00
Vladimir Diaz
797bab5ddc Fix Python 2 + 3 JSON consistency issue and re-generate repository data.
Explicitly specify the JSON separators for Python 2 + 3 consistency.
2014-06-05 11:17:30 -04:00
vladdd
6b8b2399a2 Finish unit tests for Python2 + 3 support.
All unit tests updated / running for Python 2 + 3.
TODO: Fix non-Python 3 issue with util.py.
2014-05-27 13:55:48 -04:00
Vladimir Diaz
ab95a4b3aa [WIP] Python 2+3 support.
Python 2+3 unicode.
libraries.
The following modules (and their tests) work in PY2.7+3.3:
keydb, hash, formats, mirrors
2014-04-29 14:27:34 -04:00
Vladimir Diaz
e23b4e5eae Merge branch 'develop' of https://github.com/theupdateframework/tuf into develop
Conflicts:
	tuf/__init__.py
	tuf/client/updater.py
2014-04-29 08:31:29 -04:00
Vladimir Diaz
91480c8628 Edit updater.refresh() and install of compressed metadata.
1. Raise an exception for clients that do not wish to automatically fetch a Root file when an expired version is loaded from disk.

2. Properly 'install' compressed metadata downloaded.  The compressed version of the rolename was added to the fileinfo store, which prevented detection of changed metadata and would unintentionally cause compressed metadata to always refresh (only the fileinfo of uncompressed metadata is stored and compared.)

3. Rename unsafely_verify_compressed_metadata_file() variable names, so that they match the other verify functions.
2014-04-29 08:15:18 -04:00
vladdd
1e360846bf Reject expired metadata without loading.
Reject downloaded metadata as early as possible.  The top-level roles were all downloaded as a group and then their
expiration inspected.  All metadata provided by a mirror that has already expired is discarded immediately and the next mirror tried.  The update process stops if a requested role cannot be successfully validated, or one of its parents.

[2014-04-29 02:00:32,308 UTC] [tuf.download] [INFO] [_download_file:745@download.py]
Downloading: http://localhost:8001/metadata/timestamp.json

[2014-04-29 02:00:32,324 UTC] [tuf.download] [INFO] [_check_downloaded_length:676@download.py]
Downloaded 544 bytes out of an upper limit of 16384 bytes.

[2014-04-29 02:00:32,324 UTC] [tuf.client.updater] [INFO] [_get_file:1189@updater.py]
Not decompressing http://localhost:8001/metadata/timestamp.json

[2014-04-29 02:00:32,331 UTC] [tuf.download] [INFO] [_download_file:745@download.py]
Downloading: http://localhost:8001/metadata/snapshot.json

[2014-04-29 02:00:32,333 UTC] [tuf.download] [INFO] [_check_downloaded_length:654@download.py]
Downloaded 1003 bytes out of the expected 1003 bytes.

[2014-04-29 02:00:32,334 UTC] [tuf.client.updater] [INFO] [_get_file:1189@updater.py]
Not decompressing http://localhost:8001/metadata/snapshot.json

[2014-04-29 02:00:32,334 UTC] [tuf.client.updater] [INFO] [_check_hashes:696@updater.py]
The file's sha256 hash is correct: 5b3aec7cf295a25e4b39d875c7474511da9645bc6d27f9e86fb7e439c82e0ec7

[2014-04-29 02:00:32,335 UTC] [tuf.client.updater] [ERROR] [_ensure_not_expired:1789@updater.py]
Metadata 'snapshot' expired on Tue Apr 29 01:59:01 2014 (UTC).

Do not request, download, and install top-level roles if the root of trust has already expired after the inital load. If requested, update an expired root role:

[2014-04-29 01:18:02,457 UTC] [tuf.client.updater] [ERROR] [_ensure_not_expired:1789@updater.py]
Metadata 'root' expired on Mon Apr 28 23:23:57 2014 (UTC).

[2014-04-29 01:18:02,458 UTC] [tuf.client.updater] [INFO] [refresh:628@updater.py]
Expired Root metadata was loaded from disk.  Try to update it now.

[2014-04-29 01:18:02,458 UTC] [tuf.download] [INFO] [_download_file:745@download.py]
Downloading: http://localhost:8001/metadata/root.json

[2014-04-29 01:18:02,461 UTC] [tuf.download] [INFO] [_check_downloaded_length:676@download.py]
Downloaded 1198 bytes out of an upper limit of 512000 bytes.

[2014-04-29 01:18:02,461 UTC] [tuf.client.updater] [INFO] [_get_file:1189@updater.py]
Not decompressing http://localhost:8001/metadata/root.json

[2014-04-29 01:18:02,462 UTC] [tuf.client.updater] [ERROR] [_ensure_not_expired:1789@updater.py]
Metadata 'root' expired on Mon Apr 28 23:23:57 2014 (UTC).

Note: An expired 'root' was provided by the server.  The requested root must also be signed by keys trusted by the client.
2014-04-28 22:31:42 -04:00
Vladimir Diaz
a7f28b9af4 [WIP] Python 2+3 support.
Add six, convert PY <=2.5 exception handling, dictionary iteration, libraries, 1/2 the tests.
2014-04-22 15:03:42 -04:00
vladdd
5f94d5be0d Support ISO 8601, vendor iso8601, clean codebase. 2014-04-19 14:27:53 -04:00
Vladimir Diaz
919fb0ff8f Log warning if top-level metadata expires soon. 2014-04-17 12:27:28 -04:00
Vladimir Diaz
1935b1de2b Update TUF modules affected by the change to the 'expires' format. 2014-04-15 12:52:35 -04:00
vladdd
ef9922ebe9 Finish refactor of test_updater.py.
test_updater.py now uses repository_tool.py to update the remote repository as needed, and no longer depends on mocking and repository_setup.py.
2014-03-18 12:59:03 -04:00