Commit graph

30 commits

Author SHA1 Message Date
Vladimir Diaz
1c8f41b0c0 Update import statements of unvendored dependencies 2015-06-02 08:29:22 -04:00
Vladimir Diaz
2f49561aa4 Protect against timing attacks when comparing digests
Thank you Marcin W. for spotting this.
2015-05-04 23:07:52 -04:00
Vladimir Diaz
f6b5927238 Improve code coverage for util.py 2015-04-02 16:34:52 -04:00
Vladimir Diaz
419b1ca85e Log debug message for roles that are skipped in util.find_delegated_role(). 2014-08-20 12:27:06 -04:00
vladdd
b8578cfd37 Minor cosmetic edits to sig.py and util.py. 2014-06-14 20:31:21 -04:00
vladdd
21bbbedbb8 Fix test_util.py test case failure in py2.7. 2014-06-05 19:09:45 -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
8684253675 [WIP] Python 2+3.
Mostly unicode-related changes for crypto modules.
2014-05-06 15:24:39 -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
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
0f3cdd9f61 Continue updating test_repository_tool.py.
Add test cases for the crypto funtions (e.g., generate_and_write_ed25519_keypair()).
Add test case for get_metadata_filenames().
Add test case for get_metadata_fileinfo().
Add setUpClass() and tearDownClass().
Update affected functions that failed testing, and any that needed modifying (such as util.py).
2014-04-07 20:21:39 -04:00
vladdd
dfa19b221e Add missing test cases to test_util.py.
Add missing test cases for the following functions:
get_target_hash()
find_delegated_role()
paths_are_consistent_with_hash_prefixes()
ensure_all_targets_allowed()

Add test condition to test_B6_load_json_string().
2014-03-22 14:47:24 -04:00
vladdd
1a17ac9db2 Update repository_tool.py and util.py.
Rename the unused 'json_object' variable in util.py.

Roles are allowed to share verification keys.  Update repository_tool.py so that the targets role can successfully load an already recognized key when loading a repository.  Reported by Santiago.
2014-03-03 14:53:21 -05:00
vladdd
784b3bcf46 Update modules reviewed by Monzur.
Update keys.py and pycrypto_keys.py following Monzur's code review.
Update affected modules.
2014-02-25 20:33:48 -05:00
Vladimir Diaz
2c55b94a8b Modify the extension of rolename files.
rolename.txt -> rolename.json.
2014-01-27 11:35:38 -05:00
Vladimir Diaz
8712099953 Verify delegated target paths in repository_tool.py.
repository_tool.py verified that valid metadata was written, properly signed, hashes all matched, and required roles created.  The only check missing was verification of delegated target paths according the parent's delegations.  Now, target paths are validated before write() is called for both 'path' and 'path_hash_prefixes'.  updater.py has always properly verified paths, only repository_tool.py needed the support.  If any of the delegated paths are not allowed, write()
raises the following exception:
tuf.ForbiddenTargetError: Role 'targets/unclaimed' specifies target '/simple/bad_file.txt', which is not an allowed path according to the delegations set by its parent role.
2014-01-27 10:55:14 -05:00
Vladimir Diaz
a9d90e7ce0 Finish initial implementation of Issue #151 and reading consistent snapshots.
Support multiple hash algorithms, where the generated digests of metadata and
target files is included in metadata (and filenames if 'consistent_snapshots'
is True).  Previously, only a single hash algorithm was supported, and it was
set by default to 'sha256' in code.  Repository maintainers may now choose any,
and/or multiple, hash algorithms from those supported by TUF.  By default,
'sha256' is used when generating digests.

Support the recent change to the TUF specification, where writing consistent
snapshots may include N versions of identical metadata and targets, if N hash
algorithms is used by the repository when generating metadata.

Update code affected by the recent changes to the specification, such as
targets that may include digests in their filename.

Support consistent snapshots of compressed metadata, including repositories
that provide multiple versions of metadata with different digests included
in their filenames.

The repository tools can now load repositories that include consistent snapshots
of metadata and targets, including those with multiple (i.e., multiple digests
prepended to filenames) consistent snapshots of files.

The client code may now read repositories with 'consistent_snapshots': true in
Root metadata, and properly request and update files with digests included.
2014-01-17 11:05:40 -05:00
Vladimir Diaz
6de2fdca5c Initial re-implementation of compressed metadata verification in updater.py 2013-12-04 09:14:06 -05:00
vladdd
01deddfd18 Initial implementation of the repository tools.
Delegations and repository loading now implemented.  Updates to comments, docstrings, and a unit test needed.
2013-11-12 15:00:26 -05:00
dachshund
f026a998a9 Fix #102. 2013-09-11 17:46:29 -04:00
dachshund
f72f5751d1 Redundantly verify file length in updater.
You may argue that the redundancy is unnecessary (pun intended), but it
is there because redundancy means one safety check will work where
another fails. I introduced this redundant file length check because the
updater unit test is mocking the download functions, which means that
file length checks in the download functions are being bypassed.
Redundancy is a good thing for safety.
2013-09-09 21:21:32 -04:00
dachshund
6273120e47 Merge branch 'refactor-download-update' into demo2
Conflicts:
	tuf/client/updater.py
2013-09-05 17:57:47 -04:00
dachshund
2d58aeee43 Merge with updater/download refactoring from @zanefisher.
Update download unit test to work after refactoring, but it is a little
incomplete (in particular, the unsafe_download function needs more testing).
2013-09-04 23:45:08 -04:00
dachshund
4ab867efda Merge branch 'develop' into path_hash_prefix 2013-08-27 14:52:24 -04:00
vladdd
3537917015 Update the unit tests affected by the design change to log.py 2013-08-15 14:33:35 -04:00
dachshund
d9c10c3eed Try decompressing alleged JSON files with gzip in some cases. 2013-08-08 17:41:46 -04:00
dachshund
eefc1ecf14 Fix #54. 2013-04-08 23:43:05 -04:00
vladdd
d2a799f73f Update affected module following review of util.py and test_util.py. 2013-02-13 10:57:01 -05:00
vladdd
789639f342 Merge branch 'master' of https://github.com/akonst/tuf 2013-02-10 21:40:15 -05:00
vladdd
abf0349b05 Move all files up one directory from 'src/'. 2013-02-10 21:38:06 -05:00
Renamed from src/tuf/util.py (Browse further)