Commit graph

191 commits

Author SHA1 Message Date
Vladimir Diaz
5d766d3d6f Review and update docstrings and README. 2014-06-25 09:45:55 -04:00
Vladimir Diaz
528e33dd77 Add test condition for custom data in test_updater.py.
The updater client may reference target information (including 'custom') by accessing the dictionary returned by updater.py.

Example:
target = updater.target('LICENSE.txt')
target['filepath']
target['fileinfo']['length']
target['fileinfo']['hashes']
target['fileinfo']['custom']
2014-06-24 10:31:05 -04:00
Vladimir Diaz
337c9f9ffc Regenerate '/tests/repository_data/' to include example of custom data. 2014-06-24 10:17:14 -04:00
Vladimir Diaz
f6a9b7fc58 Verify that generated Targets metadata can contain custom data. 2014-06-24 09:38:47 -04:00
Vladimir Diaz
d5c56e550d Add test condition for repository_tool.Target().add_target() custom data. 2014-06-24 08:58:29 -04:00
vladdd
88d686b258 Initial implementation of custom FILEINFO 2014-06-23 13:33:01 -04:00
Vladimir Diaz
c0a61e14e0 Add test coverage for repository_lib._log_status_of_top_level_roles().
Verify that status() does not raise 'tuf.InsufficientKeysError' nor 'tuf.UnsignedMetadataError'.
2014-06-19 11:24:07 -04:00
Vladimir Diaz
b105c7853c Add test condition for repository_lib.create_tuf_client_directory().
Verify that non-OSError.EEXist exceptions are re-raised.
2014-06-19 09:50:20 -04:00
Vladimir Diaz
882871ccfc Add missing test case for remove_target_from_bin(). 2014-06-18 12:39:39 -04:00
Vladimir Diaz
49a3a4990b Fix comment / typo in unsafe_download() test condition 2014-06-18 09:06:49 -04:00
Vladimir Diaz
a57c97749a Fix test_download.py comments for the test case dealing with incorrect file lengths. 2014-06-17 13:45:42 -04:00
Vladimir Diaz
6dafddc10f Add test case for https connection. 2014-06-17 10:28:56 -04:00
Vladimir Diaz
9d087389a9 Add the simple https server module. 2014-06-17 10:25:16 -04:00
Vladimir Diaz
e83045f162 Add self-signed certificates to be used by simple_https_server.py 2014-06-17 10:20:57 -04:00
vladdd
f0ac659110 Move optparse import statement.
Organize import statements of standard Python and TUF modules into separate blocks.
2014-06-16 13:11:35 -04:00
Santiago Torres
5a097faaf8 Added switches to the generate script
Added two switches to the generate script:

  -k (or --keys), which forces the creation of new keys.
  -d (or --dry-run), which skips the actual writing or copying phases

The second option might be useful in the future, and helped me debug the
optparse module, so I left it there.
2014-06-13 15:33:07 -04:00
Vladimir Diaz
e4c98d38ba Add missing test cases for download.py and and updater.py. 2014-06-12 09:33:12 -04:00
Vladimir Diaz
0c6b360952 Add missing test conditions for test_repository_lib.py and minor edits to modules. 2014-06-11 11:29:00 -04:00
Vladimir Diaz
74c0120ed4 Increase sleep time after starting simple server in integration tests. 2014-06-10 09:26:09 -04:00
vladdd
9e0392bb80 Add missing test coverage for pycrypto_keys.py. 2014-06-08 22:16:43 -04:00
vladdd
744be00cbc Initial implementation of authoritative delegations. 2014-06-07 20:29:18 -04:00
vladdd
19c69487b0 Merge branch 'develop' of https://github.com/vladimir-v-diaz/tuf into develop 2014-06-06 18:57:32 -04:00
vladdd
17b230abdd Support Python 2.6. 2014-06-06 18:57:23 -04:00
Vladimir Diaz
1c1cd0f192 Update / fix remaining Python 2 + 3 doctests.
Remove test_slow_retrieval_attack.py print statements.
2014-06-06 08:37:31 -04:00
Vladimir Diaz
0e9a1de4b1 Merge branch 'develop' of https://github.com/vladimir-v-diaz/tuf into develop 2014-06-06 07:33:11 -04:00
Vladimir Diaz
091cfe9aeb Increase sleep time after starting simple server in affected tests. 2014-06-06 07:32:03 -04:00
vladdd
21bbbedbb8 Fix test_util.py test case failure in py2.7. 2014-06-05 19:09:45 -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
Vladimir Diaz
66f4b88ef2 Update repository tool diagram and coverage.
Fix text box alignment in diagram.
Omit coverage of repository tool prompt and getpass.
Minor coverage update.
2014-06-03 14:59:56 -04:00
Vladimir Diaz
fbb10a36c9 Refactor repository_tool.py and improve test coverage.
Created repository_lib.py.
2014-06-03 14:32:44 -04:00
Vladimir Diaz
80ad012bc3 Re-generate repository data. 2014-06-03 14:28:46 -04:00
Vladimir Diaz
65f30a7bd8 Improve test coverage.
Update unit tests for pycrypto_keys, schema, ed25519_keys, and affected modules.
2014-05-30 12:47:33 -04:00
Vladimir Diaz
dc167e4a27 Address Python 3.2 byte-string compatibility issues. 2014-05-29 12:59:36 -04:00
Vladimir Diaz
71b1d38c1b Update slow retrieval server and fix integration tests.
Update the slow retrieval server, integration tests, and the download module to address issues with unexpected exceptions and bytes.
2014-05-28 12:11:31 -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
vladdd
bc99524e2b Finish initial refactor of slow retrieval attack. 2014-05-13 12:53:50 -04:00
vladdd
e4bd9a7ba2 [WIP] Refactor download.py 2014-05-11 22:59:42 -04:00
vladdd
c5fd17ab3e Merge branch 'develop' of https://github.com/theupdateframework/tuf into develop
Conflicts:
	tests/test_hash.py
	tests/test_keydb.py
	tuf/formats.py
	tuf/keydb.py
	tuf/repository_tool.py
2014-05-10 20:26:06 -04:00
Vladimir Diaz
8684253675 [WIP] Python 2+3.
Mostly unicode-related changes for crypto modules.
2014-05-06 15:24:39 -04:00
Santiago Torres
84d676192f Updated test case for the expiration setter (microseconds truncation)
The new test tries to make the fact that the datetime object given will
contain microseconds. It also tests for the fact that the microseconds
value is truncated after being set.
2014-05-05 11:10:40 -04:00
Santiago Torres
1d5c9a00f6 Updated test case for the expiration setter
The test case for the expiration setter now includes a set case in which
the microseconds value is forced to be one. This is likely to happen
when users try to set expirations using datetime.datetime.today() or
functions that return the actual clock, which have microsecond
resolution.
2014-05-03 12:11:10 -04:00
Vladimir Diaz
718b3df8b6 Improve test coverage.
Add missing 'test_log.py' [WIP]
2014-05-01 13:00:43 -04:00
Vladimir Diaz
d831187949 Improve test coverage. 2014-05-01 12:59:34 -04:00
Vladimir Diaz
a8406604d7 Implement add_target_to_bin(), outlined in Issue #180. 2014-04-30 12:46:37 -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
vladdd
5d3664e5a4 [WIP] Python 2+3 support.
maxint and minor additions.
2014-04-28 23:21:16 -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
7843bdd272 [WIP] Python 2+3 support.
Add six, convert PY <=2.5 exception handling, dictionary iteration, libraries, remaining 7/8 test modules.
2014-04-23 12:50:05 -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