Commit graph

3274 commits

Author SHA1 Message Date
vladdd
c9e3b6046e Address Issue #214.
Allow validation of specific libraries rather than checking all of them in check_crypto_libraries().
Log warning if the repository tool is imported but has not been properly installed: $ pip install tuf[tools].
Modify format string of console log messages.
2014-05-03 18:03:25 -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
Santiago Torres
46fbfb3bc2 Fixes wrong schema when adding an expiration that contains microseconds
In the case we want a different expiration date on any role, we are
adviced to do this:

  repo.role.expiration = datetime.datetime(some value).

In the case we want to use a date somewhere in the future, a normal
approach would be to use time deltas:

  repo.role.expiration = datetime.today() + timedelta(weeks=x)

If we use this method we won't be able to set the value since we are
most probably producing a datetime object that contains *microseconds*.
According to the python specification, the timestamp produced will
contain the microseconds value unless it is 0.

The simple fix for this issue is to force the microseconds value to be 0
before working with the datetime object.
2014-05-02 19:30:02 -04:00
Santiago Torres
cc7f69ea30 Merge branch 'develop' of github.com:theupdateframework/tuf into developer-tools 2014-05-02 16:29:12 -04:00
vladdd
c16b1fdd80 Undo previous commit change to tox.ini 2014-05-01 14:15:49 -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
zanefisher
be320acf30 Expand Delegations section. 2014-04-30 16:44:15 -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
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
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
Santiago Torres
f50955ee79 Added import statements for constant definitions
Metadata and targets directory names were redeclared in a local
variable. They are now imported from the repository_tool.

I also removed an unnecessary declaration for the targets.json file
expiration since it didn't have anything to do with the developer tools
2014-04-25 23:55:00 -04:00
Santiago Torres
36c3f2c1d2 Added schema check and project.cfg schema
There is a new entry in tuf.formats.py that represents the layout of the
project.cfg file. This new schema will be used to check for sanity upon
loading the .cfg file in the load_project function
2014-04-24 18:51:35 -04:00
Santiago Torres
559f8d796d Updated config.cfg file structure
The public key for the whole project used to be stored in a non-standard
way (this means, not as a keydict schema). I migrated the data structure
to a valid keydict schema with the aim of improving code-consistency in
the developer tools.

This will also make schema checks easier
2014-04-24 18:49:34 -04:00
Santiago Torres
7153c34eed Added roledb and keydb clear statements upon load
To avoid conflicts in the load_project function, we clear the roledb and
the keydb modules. This ensures that there are no repeated entries from
previous runs.
2014-04-24 18:48:20 -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
Santiago Torres
c29b362df7 Updated function import for get_metadata_fileinfo
get_metadata_fileinfo was originally called get_metadata_file_info. This
was fixed to match the new repository tool.
2014-04-22 14:24:13 -04:00
Santiago Torres
f4ae002816 Merge branch 'develop' of github.com:theupdateframework/tuf into developer-tools 2014-04-22 14:21:37 -04:00
Vladimir Diaz
f48c69d4a0 Update README.md
Add Coverage Status.
2014-04-21 06:00:51 -04:00
Vladimir Diaz
ae18f63c9e Merge pull request #208 from vladimir-v-diaz/develop
Trigger coveralls and update slow retrieval server and attack
2014-04-21 05:51:11 -04:00
vladdd
e0864ee3ab Update slow retrieval server and attack.
Ensure the target file used in the slow retrieval attack is larger than tuf.conf.SLOW_START_GRACE_PERIOD.  The previous size of the test file might have led to inconsistent triggering of a slow retrieval error.
2014-04-21 05:34:16 -04:00
vladdd
77d3bb77a7 Merge branch 'develop' of https://github.com/theupdateframework/tuf into develop 2014-04-20 18:11:20 -04:00
vladdd
ba20022e54 Add missing hyphens to .travis.yml 2014-04-20 18:09:26 -04:00
vladdd
ab823ce811 Read .coverage file in the tests directory. 2014-04-20 18:07:39 -04:00
Vladimir Diaz
7f72edc410 Update README.md
Add Travis CI Badge
2014-04-20 17:21:21 -04:00
Vladimir Diaz
678d4458c8 Merge pull request #207 from vladimir-v-diaz/develop
Update .gitignore.
2014-04-20 17:12:06 -04:00
vladdd
49c2c2db2a Update .gitignore. 2014-04-20 16:54:44 -04:00
Vladimir Diaz
d200437f12 Merge pull request #206 from vladimir-v-diaz/develop
Add Travis CI, coveralls, and coverage-related updates to modules.
2014-04-20 16:30:20 -04:00
vladdd
60cfb7e054 Edit aggregate_tests.py comment. 2014-04-20 16:19:56 -04:00
vladdd
08a2bad2c0 Add Travis CI, coveralls, and coverage-related updates. 2014-04-20 16:15:19 -04:00
Vladimir Diaz
ddb8b00948 Merge pull request #205 from vladimir-v-diaz/develop
Address Issue #146.  Replace custom datetime format with ISO 8601.
2014-04-19 14:47:35 -04:00
vladdd
7b4c3218e1 Remove extraneous example files. 2014-04-19 14:39:47 -04:00
vladdd
5f94d5be0d Support ISO 8601, vendor iso8601, clean codebase. 2014-04-19 14:27:53 -04:00
zanefisher
a4c483f5c6 Add headers for sections to be added. 2014-04-17 16:19:20 -04:00
zanefisher
b89bb02730 remove whitespace and empty lines from examples 2014-04-17 15:51:26 -04:00
SantiagoTorres
58d5f1f103 Merge pull request #1 from zanefisher/patch-1
fixes to headers and links
2014-04-17 15:45:40 -04:00
zanefisher
69c88e2328 fixes to headers and links 2014-04-17 15:43:43 -04:00
Vladimir Diaz
919fb0ff8f Log warning if top-level metadata expires soon. 2014-04-17 12:27:28 -04:00
Vladimir Diaz
b147ff788a Merge branch 'develop' of https://github.com/vladimir-v-diaz/tuf into develop 2014-04-15 13:26:25 -04:00
Vladimir Diaz
62f5b0689b Update UNIX_TIMESTAMP_SCHEMA comment. 2014-04-15 13:25:33 -04:00
Vladimir Diaz
0f86447eac Update tuf-spec.txt
Update time format.
2014-04-15 13:23:41 -04:00
Vladimir Diaz
f497f19998 Update README.md
Update the expiration object expected by Targets().expiration
2014-04-15 13:00:34 -04:00
Vladimir Diaz
fa37cffd54 Update the integration tests affected by the change to the 'expires' format. 2014-04-15 12:54:27 -04:00
Vladimir Diaz
b6cd82d75c Update the unit tests affected by the change to the 'expires' format. 2014-04-15 12:53:46 -04:00
Vladimir Diaz
1935b1de2b Update TUF modules affected by the change to the 'expires' format. 2014-04-15 12:52:35 -04:00
Vladimir Diaz
91242ec6ab Modify the expiration date format included metadata.
Convert the 'expires' field of metadata to a Unix/POSIX timestamp (previously a custom string format.)
Replace tuf.formats.py functions 'format_time()' and 'parse_time()' with unix_timestamp_to_datetime() and datetime_to_unix_timestamp().
Update affected schemas.
2014-04-15 12:50:40 -04:00