Commit graph

1700 commits

Author SHA1 Message Date
Sebastien Awwad
847f20df9e
Update version to 0.11.2.dev3
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2019-01-10 11:52:42 -05:00
Walter Lee
1dabb0e046
fixed 404 in last Security link
should be https://github.com/theupdateframework/tuf/blob/develop/docs/SECURITY.md instead of
https://github.com/theupdateframework/tuf/blob/develop/SECURITY.md which is 404
2019-01-07 10:33:10 -05:00
Sebastien Awwad
3b4e0e6458
Fix unnecessary delegated role downloads w/ targets_of_role
If the role you're fetching the targets of is the 'targets' role,
do not download all delegated targets roles....

Continue to do that only if you're fetching the targets of a
delegated targets role, for historical reasons until this
deprecated function is removed / replaced.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-12-07 12:43:04 -05:00
Sebastien Awwad
42689d203f
DOC: loudly mark deprecations of all_targets and targets_of_role
in comments that explain a bit about why, in updater.py.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-12-07 12:42:12 -05:00
Sebastien Awwad
4fb4d73093
minor: satisfy new pylint version by removing pass in class defs...
in tuf/exceptions.py, since those class definitions have docstrings,
and that is apparently sufficient in a class definition to make a
'pass' statement unnecessary.  pylint version 2.2.0 complains about
unnecessary pass statements in this situation, so this resolves that.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-28 10:18:49 -05:00
Sebastien Awwad
ea224024d3
Merge pull request #796 from michizhou/develop
Added command-line option explanations and usage examples for CLI scripts
2018-11-19 11:07:03 -05:00
Sebastien Awwad
dab9a733e7
Merge pull request #792 from theupdateframework/clarify_updated_targets_docstring
DOC: Clarify docstring of updater.updated_targets
2018-11-14 11:42:38 -05:00
Sebastien Awwad
23cfcbe783
Bump version to 0.11.2.dev2 from 0.11.2.dev1
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:57:05 -05:00
Michael Zhou
bcbb213613 Added command-line option explanations and usage examples
Signed-off-by: Michael Zhou <myz227@nyu.edu>
2018-11-03 10:48:05 -04:00
Sebastien Awwad
61179ea32b
DOC: Clarify docstring of updater.updated_targets
It was somewhere between misleading and vague, potentially implying
that it contacts the repository and/or serves as an alternative to
get_one_valid_target_info().

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-16 11:30:08 -04:00
Sebastien Awwad
73f3289942
Bump version to 0.11.2.dev1 for PyPI dev release
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-03 11:59:56 -04:00
Sebastien Awwad
24a10b5527
Update dependencies and bump version to 0.11.2-alpha
for an alpha release.

Update dependencies:
bandit, py, pycparser, pynacl, securesystemslib, tox

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-02 22:24:14 -04:00
Sebastien Awwad
ec27630a48
minor: PR tweaks based on review: doc, casing, typos, updates
- two reversions to unnecessary changes
- some typo fixes
- capitalization of HTTP/S where reasonable
- commenting out code section with ''' rather than #

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-02 15:01:38 -04:00
Sebastien Awwad
264186fa51
Session index: hostname-indexed --> scheme+hostname-indexed
In order to avoid re-using session data from an HTTPS connection
in an HTTP connection. Some cookies may not be HTTP-safe.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-10 16:56:02 -04:00
Sebastien Awwad
4595ab839a
Remove unused os import in tuf.download
It is not longer used, and pylint complains if it's left in.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-10 16:30:32 -04:00
Sebastien Awwad
a5416d4baa
Raise helpful error in download.py if cannot parse URL
to extract hostname. After commit
"use a different session per hostname",
the code no longer raises MissingSchema if a URL is malformed in
certain cases. Since it parses URLs to extract the hostname and
would have raised securesystemslib.exceptions.FormatError, so the
test would have to check for that error instead of requests's
MissingSchema.

However, it's best to use a different error type, since while that
would be, true enough, a formatting error, FormatError is customarily
reserved for the automatic detection based on schemas in formats.py
(using <SCHEMA>.check_match()), and in any case it is not a
securesystemslib error.

So this commit adds error type tuf.exceptions.URLParsingError and
raises it if the hostname cannot be isolated in a URL, and checks
for it in test_download.py.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-10 16:30:32 -04:00
Sebastien Awwad
d199610f94
DOC: Clarify and correct comments on download timeouts
and call out need for more testing in a comment.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-10 16:30:32 -04:00
Sebastien Awwad
8951e8b9a8
Style fixes in download.py within PR 781 changes
- Remove trailing whitespace
- Fix indent sizes (4 if continuing line, else 2)
- Fix line continuation to match PEP 8 and lab code guidelines

Also fixes one minor typo.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-10 16:30:32 -04:00
Sebastien Awwad
cc4628735a
Raise ReadTimeoutError from requests as TUF SlowRetrievalError
so as to preserve 'API' of expected errors.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-10 16:30:32 -04:00
Trishank K Kuppusamy
f29622b2c6
add debug statements
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-10 16:30:27 -04:00
Trishank K Kuppusamy
c25ce7c3be
use a different session per hostname
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-10 16:30:06 -04:00
Sebastien Awwad
314f6e71b9
Remove partial single-source version; add comments explaining
Previous commit isn't going to work: read wasn't defined. Code
provided was from here:
https://packaging.python.org/guides/single-sourcing-package-version/

and is a little more complicated than is ideal. It'll also match
comment lines if they exist. Single-sourcing version number isn't
necessary for this pull request, but if I was going to do it, I'd
probably add a VERSION file and have tuf/__init__.py and setup.py
each read that in. There could be problems with that, too. I'm
going to punt on this and keep the version in two places and we
can fix that less urgently. (Also, the user agent reporting a
version seems less critical in any case than the rest of the PR.)

Version info will now be in two locations and require update in
tandem.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-10 16:29:59 -04:00
Trishank K Kuppusamy
34e0ec7c62
Add TUF version number, and user agent
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-10 16:29:48 -04:00
Sebastien Awwad
1e97275b9a
minor: undo some import/dependency re-ordering
(sorry -- just to keep things simple)

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-08-31 13:28:43 -04:00
Trishank K Kuppusamy
b9bc8602c2
Update TUF to handle HTTPS proxies
Signed-off-by: Trishank K Kuppusamy <trishank.kuppusamy@datadoghq.com>
2018-08-31 13:18:35 -04:00
Sebastien Awwad
d98152bc9d
Remove some unnecessary try-reraise constructions; thanks, pylint!
These changes simplify logic, removing some try/except structures
that were unnecessary and potentially confusing, and get us back
to passing pylint's test.

pylint 2.0.0 adds try-except-raise tests, to catch immediate
re-raising after catching an exception, outside of some special
cases. See this GitHub comment for more info:
https://github.com/theupdateframework/tuf/pull/770#issuecomment-412993992

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-08-21 14:59:29 -04:00
Sebastien Awwad
85c9c3aeee
Have repository_tool.get_filepaths_in_directory use absolute paths
as its docstring says that it does. I'm not sure if this changed through
some accident along the way, but in any case, before this commit, the
docstring said that it yielded a list of absolute paths, but it did not.

Now it does.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-08-20 13:29:09 -04:00
Vladimir Diaz
e42874db46
Catch tuf.exceptions.Error in client.py to prevent printing exception trace
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-28 12:38:55 -04:00
Vladimir Diaz
a300122978
Reorder the parsed command-line arguments and add missing options to docstring
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-28 12:37:54 -04:00
Vladimir Diaz
d24f826009
Condense the code that sets the logging level
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-28 11:51:19 -04:00
Vladimir Diaz
56aa91239b
Use guard clause and comment on expected exceptions raised by try block
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-28 11:34:59 -04:00
Vladimir Diaz
839c646204
Convert lists to sets, use == instead of membership operator, remove unneeded write()
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-28 11:02:36 -04:00
Vladimir Diaz
16071e0421
Use set() instead list() for supported key types, and revise comment
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-27 17:58:38 -04:00
Vladimir Diaz
609889fa24
Use guard clause and set a constant for the list of supported CLI key types
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-27 17:44:28 -04:00
Vladimir Diaz
5e94dd3f08
Use consistent number of blank lines between functions
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-27 17:28:47 -04:00
Vladimir Diaz
8a7e0fc4b0
Add constants for the keytypes specified on the command line
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-27 16:54:32 -04:00
Vladimir Diaz
52ed7a2a04
Add note about using multile options in invocation, and add TODO
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-27 16:06:10 -04:00
Vladimir Diaz
725d809c65
Rename process_arguments() and revise docstring, remove TODO, minor changes
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-27 15:42:03 -04:00
Vladimir Diaz
97021b4e16
Revise help description for --init
It should mention the files/directories that are created.

Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-26 17:20:33 -04:00
Vladimir Diaz
4ee3537d6d
Prompt for password if one isn't given and the key file is encrypted
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-21 14:58:36 -04:00
Vladimir Diaz
1197ab9cf8
Make sure importing a private key follows the behavior covered in TUTORIAL.md
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-21 13:58:19 -04:00
Vladimir Diaz
31f8f0566d
Add/revise entries in docstrings
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-18 10:41:05 -04:00
Vladimir Diaz
75f95391a4
Verify the format of the log_filename argument to enable_file_logging()
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-15 16:03:03 -04:00
Vladimir Diaz
203fb11815
Revise exception message in enable_file_loggin()
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-15 15:49:40 -04:00
Vladimir Diaz
57b9cb4620
Raise an exception if a user tries to changer an unset filehandler's log level
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-15 14:58:07 -04:00
Vladimir Diaz
9b35d2c1e6
Add a file handler if one hasn't already been added
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-15 14:45:40 -04:00
Vladimir Diaz
6291b35ca8
Add disable_file_logging()
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-14 17:32:29 -04:00
Vladimir Diaz
fd23a54082
Add enable_file_logging() to log.py
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-14 11:50:41 -04:00
Vladimir Diaz
14f795db57
Disable file logging, by default, in settings.py
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-14 11:46:09 -04:00
Vladimir Diaz
1d0f863ef3
Edit README in tuf/client/
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-06-12 13:59:45 -04:00