Commit graph

3260 commits

Author SHA1 Message Date
Sebastien Awwad
1fda798d40
ASN.1: deal with empty private values in public key dicts
by removing them. This is potentially problematic as it might change
the keyid when converting to ASN.1 and back, but it'll have to do for
now, and we shouldn't have these things in there in the first place.
It's an edge case, and this is a compromise.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:36:20 -05:00
Sebastien Awwad
da726fed76
ASN.1: RSA key compat: key vals OctetString -> VisibleString
Switch to using VisibleString to encode key values, since RSA keys
are ASCII-prefixed Base64, while ed25519 key values are hex strings.
This is inefficient, but this reference implementation profits from
being simple. May reconsider later and add specialized code. :/

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:36:20 -05:00
Sebastien Awwad
427dac3f55
WIP: Revise me. Draft ASN.1 conversion and testing
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:36:19 -05:00
Sebastien Awwad
365aeb9c68
ASN.1: add question about optional field Custom
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:35:30 -05:00
Sebastien Awwad
c4b27ccf01
ASN.1: Use Set instead of Sequence for some unordered lists:
Note that the natural translation of a Python dictionary (which has no implicit
order of elements) into ASN.1 is to a Set (unordered) of objects, and not a
Sequence (ordered). For example, you can think of {'key_a': ..., 'key_b': ...}
as (key_a_obj, key_b_obj), where the order is irrelevant.
Despite this natural interpretation, there are some cases where we impose an
order here in the translation to ASN.1. We do this when the dictionary is
essentially a translation of an object/struct that contains disparate
conceptual types. For example: {'keyid': ..., 'sig': ...} is translated as
[keyid_object, sig_object], not (keyid_object, sig_object). This is to make the
structure of objects in the wire format predictable. RootMetadata below is a
good example: in the ASN.1/DER wire format, root metadata will always begin
with a 'type' element, followed by 'expires', then 'version', etc.

Already-ordered components like lists are, of course, always retained as
ordered lists (Sequence). (e.g. the 'signatures' element of metadata is always
ordered in both ASN.1 and the JSON-compatible metadata format.)

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:35:30 -05:00
Sebastien Awwad
0d26e37300
ASN.1: add necessary import for optional named types
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:35:29 -05:00
Sebastien Awwad
eb728881f3
ASN.1: Remove small, unnecessary custom types per Joey
Definitions like 'Filename' that are just renames of VisibleString
etc. are removed for simplicity. This may be slightly harder to read.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:35:29 -05:00
Sebastien Awwad
2d8070cd75
ASN.1 Correctly reorder root metadata type definitions
so that TopLevelDelegation class declaration appears before the
RootMetadata class definition that uses it.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:35:29 -05:00
Sebastien Awwad
9ba9eea8e5
ASN.1 rename role hash fields to match spec ('meta')
even though 'meta' is not a particularly expressive name, it's what
the spec uses, and looking like the JSON-compatible metadata is
important for the ASN.1 metadata.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:35:29 -05:00
Sebastien Awwad
aadf0add41
ASN.1 minor bugfix: fix name of element in TimestampMetadata
RoleHash() does not exist; it's named HashOfSnapshot currently.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:35:29 -05:00
Sebastien Awwad
f3a39cec17
ASN.1: correct definition of Custom field in Targets
It had an additional layer of structure unnecessarily.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:35:29 -05:00
Sebastien Awwad
79703abae3
ASN.1: Add TAP 5 metadata placeholder (urls in root)
Once TAP 5 is accepted and implemented,	root role metadata will
allow for an optional URL list element for each top-level role.
See TAP 5 for more details.

The placeholders here are commented-out.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:35:29 -05:00
Sebastien Awwad
ce066f26d9
ASN.1: Initial commit of asn1 metadata definitions
both in abstract ASN.1 definition language and a format compatible
with pyasn1.

These will be used for conversion of TUF metadata between the
JSON-compatible internal TUF metadata format and ASN.1/DER.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-08 16:35:29 -05:00
Sebastien Awwad
dad9f9f11b
test: extend sleep in testing after spawning server processes
This adds to PR #799; please see that for details.  In short,
tests sometimes fail on slow test systems (primarily on AppVeyor)
if we don't have long enough delays.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-06 09:59:24 -05:00
Sebastien Awwad
e99ff85b2c
test: extend a delay in testing after spawning server processes
This adds to PR #799; please see that for details.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 16:28:59 -05:00
Sebastien Awwad
0380b652bd
Merge pull request #799 from theupdateframework/longer_testing_delays_for_appveyor
test: Delay more when spawning test servers to avoid rare failures
2018-11-05 16:18:53 -05:00
Sebastien Awwad
375ef4bd0d
test: Delay more when spawning test servers to avoid rare failures
on AppVeyor during automatic testing.  Also explains a bit better
the reason for those delays, in the comments adjacent to them.

AppVeyor was occasionally laggy enough that spawning a separate
server process didn't happen fast enough for the included delays,
so connection attempts in the tests occasionally failed.

This lengthens a few 0.3s delays that I've seen pop up in test
failures to 2s delays, along with a few others for good measure.
Sadly, this slows testing a bit.... I'll keep an eye out for more
of these.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 16:14:33 -05:00
Justin Cappos
a372410944
Adopters update. 2018-11-05 16:14:30 -05:00
Sebastien Awwad
5fe0a8312f
Merge pull request #798 from theupdateframework/dependencies_update
Dependencies update
2018-11-05 16:11:16 -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
pyup-bot
4c7ee1d5ab
Update urllib3 from 1.23 to 1.24.1
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:52:20 -05:00
pyup-bot
32f1acfa5b
Update certifi from 2018.8.24 to 2018.10.15
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:52:17 -05:00
pyup-bot
8e5c2a1567
Update virtualenv from 16.0.0 to 16.1.0
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:52:13 -05:00
pyup-bot
dde55697a8
Update tox from 3.4.0 to 3.5.3
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:52:08 -05:00
pyup-bot
fd9b225e2a
Update stevedore from 1.29.0 to 1.30.0
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:52:04 -05:00
pyup-bot
496d3dccb5
Update smmap2 from 2.0.4 to 2.0.5
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:52:00 -05:00
pyup-bot
d8d7e50500
Update requests from 2.19.1 to 2.20.0
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:51:42 -05:00
pyup-bot
98a491ef5e
Update py from 1.6.0 to 1.7.0
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:51:40 -05:00
pyup-bot
a14ea7c8dc
Update pluggy from 0.7.1 to 0.8.0
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:51:36 -05:00
pyup-bot
fa2414c348
Update pbr from 4.2.0 to 5.1.0
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:51:32 -05:00
pyup-bot
3f3a90e785
Update ipaddress from 1.0.21 to 1.0.22
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:51:28 -05:00
pyup-bot
5a7c14ea69
Update gitdb2 from 2.0.4 to 2.0.5
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:51:18 -05:00
pyup-bot
3171f00615
Update colorama from 0.3.9 to 0.4.0
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-11-05 15:50:58 -05:00
Justin Cappos
7e0c4cc29f
Update ADOPTERS.md 2018-10-16 15:10:06 -04:00
Justin Cappos
5d58ea7a81
Explaining GOVERNANCE structure to better match CNCF graduation ask 2018-10-11 10:50:47 -04:00
Sebastien Awwad
4923a888ac
Merge branch 'bump_version_0_11_2_dev1' into develop
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-03 12:04:31 -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
8db7f045f9
Merge branch 'bump_version_0_11_2_dev' into develop
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-02 22:42:27 -04:00
Sebastien Awwad
cdc0e4dc91
Add updated Python2 dependencies to requirements.txt
(instead of just Python3 dependencies)

Indirect dependencies differ slightly in Python2 and Python3.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-02 22:41:24 -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
9cd2d3a0ab
Merge branch 'trishankatdatadog/fix-for-https-proxies' into develop
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-02 17:24:19 -04:00
Sebastien Awwad
01d8d9e780
Test: tighten test-skip conditions and lengthen a subprocess sleep
After seeing some AppVeyor failures, I've increased the wait after
starting test HTTP, HTTPS, and proxy servers from 0.5s to 1s, to make
it less likely that tests will fail because the servers weren't done
starting up yet.

After some review comments by @aaaaalbert, I've tightened the logic
in aggregate_tests.py around which tests to skip unless a certain
Python version is running, and added some consistency checks.
This also involved a bit of clarification of comments and variable
names.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-02 17:06:20 -04:00
Sebastien Awwad
ebcb17bbef
Test: clear requests sessions when updating expected ssl certs
to make sure that the test uses the intended certificate. (There's some
indirect indication that the updated environment variable might not always
have been used.)

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-02 15:49:39 -04:00
Sebastien Awwad
e8a1ab1395
Test: simplify env variable overwrite/restore code in test_proxy_use
Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-02 15:31:55 -04:00
Sebastien Awwad
15b33b8277
Test: modularize: add func that spawns Python intepreter process
that draws from sys.executable (the currently running Python interpreter)
instead of assuming 'python' is correct. Use this function instead of having
many individual subprocess calls written out. Slightly simplifies code, too.

This should eventually be moved to a common test module instead of appearing
in two places in the test code.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-10-02 15:31:51 -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
b163caa29b
Test: add https test with expired server certificate
in test_download.py. In the process, added another test cert
and generalized the server process killer in test_download.py.

Additionally, I added another expected-to-be-good certificate
that was generated in the same way as the new bad certificates
(but for their individual flaws of course). This is because
the new certs aren't exactly like the old good cert, so that
we have another cert to test against in case the way the
certs were generated turns out to matter at some point in the
future.

Also slightly increased a start-servers delay in the test
in response to one test system taking too long and seeing
connection issues. Probably not helped by the number of
processes. Clarified a related comment in the test code.

Also made a note that environment variable cleanup would be
good to add to test_download.py, either copied from or moved
somewhere accessible from test_proxy_use.py

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-26 14:15:36 -04:00
Sebastien Awwad
2b97c0e59c
Test: adjust proxy_server.py argument handling:
- if it is provided, don't require the certificate filename to be
  provided as an absolute path
- raise an error if the provided certificate filename does not
  point to an existing file, rather than just printing and
  ignoring (to avoid possible future diagnostic headaches)

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-26 13:10:17 -04:00
Sebastien Awwad
d69f9a2160
Test: changed target server cert checking in test proxy script
Added Python version checking and changed behavior
in Python2.7.9+ to use custom certificate for target server
inherited from command line argument.

In Python versions < 2.7.9, proxy_server.py does not perform certificate
validation of the target server. As that is not part of what the current
tests using this script require, that is currently OK. In Python
versions > 2.7.9 (SSLContext was added in 2.7.9), the same code actually does
check the certificate, using the system's trusted CAs. As a result, since we
are using custom certificates, we need to either disable certificate
checking in 2.7.9 or load the specific CA for target test server, using the
SSLContext and create_default_context functionality also added in 2.7.9. It
is easier to do the latter, so the behavior in 2.7.9+ is to check the cert
and below 2.7.9 is not to. Note that we do not support Python < 2.7.
SSLContext is also available in all Python3 versions that we support.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-26 12:46:14 -04:00
Sebastien Awwad
5312703fc7
Test: remove no-longer-used simple_proxy.py
as that set of tests is now redundant, and depended on Twisted,
which we need not depend on.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
2018-09-25 15:36:54 -04:00