Commit graph

3992 commits

Author SHA1 Message Date
Jussi Kukkonen
9e34c5fd9b MAINTAINERS: Add myself
I'd like to apply for this position, let me know if you need a CV :)

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2021-01-18 12:30:56 +02:00
lukpueh
322c096ef7
Merge pull request #1252 from lukpueh/gh-actions-coveralls
Reinstate publishing coverage on coveralls.io
2021-01-15 14:34:31 +01:00
Joshua Lock
d524412d56
Merge pull request #1259 from lukpueh/pin-idna
Configure dependabot to ignore 'idna'
2021-01-14 12:25:18 +00:00
Lukas Puehringer
d97c2872db Re-add coveralls.io badge
A recent commit reinstates publishing of coverage data to
coveralls.io. This commit re-adds the corresponding badge which
was temporarily removed in #1242.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2021-01-13 13:45:03 +01:00
Lukas Puehringer
8bb0187a69 Use py3 coveralls to publish coverage on py2
Prior to this commit our GitHub workflow would set up one Python
version only for each build, which means that the commands to run
the tests and publish coverage (tox and coveralls) were run with
the same Python version as tox runs the tests in.

Given that the coveralls CLI tool dropped py2 a couple of releases
ago, this commit sets up an additional service py3 to run coveralls
(and tox) on when building for py2.

To prevent tox from using the wrong Python version to run the tests
on, this commit changes the toxenv value from the generic 'py'
(uses default python on path) to 'py27'.

For convenience and readability we use the environment variable
TOXENV instead of the tox -e option.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2021-01-13 13:43:46 +01:00
Lukas Puehringer
32452c4142 Configure GitHub workflow to publish coverage
Re-add coverage publishing on coveralls.io, formerly performed by
Travis CI (prior to #1242), using the coveralls cli tool according
to the documentation:
https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-gotcha

**Considered alternatives:**
- Official coveralls GitHub action, which does not seem to work
  well for Python:
  https://github.com/coverallsapp/github-action/issues/4
  https://github.com/coverallsapp/github-action/issues/30

- Inofficial fork of that action, which seems to work better
  but had issues finding the coverage data in the tests folder,
  or the covered code respectively.
  https://github.com/AndreMiras/coveralls-python-action

Besides aforementioned issues of these actions the use of cli tools
from curated package managers seems slightly preferable over
actions from the GitHub Marketplace (see #1246).

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2021-01-13 13:43:39 +01:00
Lukas Puehringer
cb164ec1f7 Configure dependabot to ignore 'idna'
New releases of the transitive (via 'requests') dependency 'idna'
break Python 2.7 builds. To fix this we configure dependabot to not
bump 'idna' in requirements-pinned.txt, which lists and
auto-updates all immediate and transitive dependencies for CI/CD
testing.

An alternative would be to add and restrict 'idna' in
'requirements.txt' but this is less preferable because
'requirements.txt' should only have direct dependencies.

For consulted dependabot config docs see:
https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/enabling-and-disabling-version-updates#disabling-dependabot-version-updates

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2021-01-12 13:47:36 +01:00
lukpueh
b5f5e3f77c
Merge pull request #1258 from theupdateframework/dependabot/add-v2-config-file
Create Dependabot config file
2021-01-11 17:42:17 +01:00
dependabot-preview[bot]
e364e7f582
Create Dependabot config file 2021-01-11 16:33:11 +00:00
Joshua Lock
c872797f46
Merge pull request #1239 from theupdateframework/dependabot/pip/chardet-4.0.0
build(deps): bump chardet from 3.0.4 to 4.0.0
2021-01-08 12:42:52 +00:00
dependabot-preview[bot]
019d3a90bc
build(deps): bump chardet from 3.0.4 to 4.0.0
Bumps [chardet](https://github.com/chardet/chardet) from 3.0.4 to 4.0.0.
- [Release notes](https://github.com/chardet/chardet/releases)
- [Commits](https://github.com/chardet/chardet/compare/3.0.4...4.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-08 12:17:58 +00:00
lukpueh
9fdbcd5b4b
Merge pull request #1245 from theupdateframework/dependabot/pip/requests-2.25.1
build(deps): bump requests from 2.25.0 to 2.25.1
2020-12-18 09:19:42 +01:00
dependabot-preview[bot]
56655f8adb
build(deps): bump requests from 2.25.0 to 2.25.1
Bumps [requests](https://github.com/psf/requests) from 2.25.0 to 2.25.1.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.25.0...v2.25.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-17 10:39:05 +00:00
lukpueh
f7695dace8
Merge pull request #1242 from lukpueh/gh-actions
Replace Travis/Appveyor CI with GitHub Action Workflow
2020-12-17 10:50:01 +01:00
Lukas Puehringer
0ab9ee7617 Temporarily remove coveralls + fossa badges
The newly add GitHub workflow, which replaces Travis and Appveyor
does not support publishing coverage (coveralls) and license
(fossa) data yet (formerly done by Travis).

This commit removes the corresponding badges from README. It shall
be reverted once coveralls and fossa are re-enabled.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-17 10:29:06 +01:00
Lukas Puehringer
61cffeea95 Remove travis/appveyor config in favor of actions
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-17 10:29:06 +01:00
Lukas Puehringer
9ec845cbc1 Adopt CI change in TUF docs
Replace mentions of travis/appveyor with GitHub Actions in
governance (contribution) and readme (badges) documents.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-17 10:28:38 +01:00
Lukas Puehringer
36b8d43bd8 Add basic GitHub workflow to run tests and linters
Configure workflow to run all tox environments, where each 'py' env
runs on linux, macos and windows, and sslib master and lint builds
run only Linux/Python3.x only.

The workflow also configures pip caching.

TODO: Adopt publishing of coverage (coveralls) and license (fossa)
data from .travis.yml.

Co-authored-by: Jussi Kukkonen <jkukkonen@vmware.com>
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-17 10:28:31 +01:00
Lukas Puehringer
e36d181241 Work around pypa/pip#9215 with old resolver
Configure tox to use legacy resolver as a temporary workaround
for pypa/pip#9215, which results in huge unnecessary downloads.

Co-authored-by: Jussi Kukkonen <jkukkonen@vmware.com>
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-16 17:39:36 +01:00
Lukas Puehringer
ad8bb8a7a0 Fix failing tests on GitHub windows runners
The GitHub action windows runners (added in a subsequent commit)
choke on a test that runs os.makedirs with a too long directory
name, and expects an OSError with error numbers ENAMETOOLONG or
ENOENT. However, this particular runner returns EINVAL in Python 3,
which according to bugs.python.org/msg295851 is not unlikely.

This commit simply adds EINVAL to the expected error numbers.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-16 17:37:57 +01:00
lukpueh
c4d4362a3e
Merge pull request #1238 from lukpueh/drop-py35
Drop support for Python 3.5
2020-12-11 15:47:22 +01:00
lukpueh
b2e3c83988
Merge pull request #1235 from joshuagl/joshuagl/expiration-check
client: update expiration check to match spec
2020-12-11 15:04:11 +01:00
Lukas Puehringer
1339210917 Remove breaking python3.9 appveyor build
We recently enabled support for Python 3.9 and also added
3.9 builds on appveyor, but they don't work out of the box.

Instead of troubleshooting this I suggest we soon switch to
GitHub actions:
https://github.com/theupdateframework/tuf/issues/1195.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-11 11:40:54 +01:00
Lukas Puehringer
bc77ed1c7e Update pinned dependencies for testing
requirements-pinned.txt lists all immediate and transitive
dependencies combined for all supported Python versions.

This commit semi-automatically updates the pinned dependencies
using the instructions in requirements.txt:

Updated dependencies are:
- cryptography (supersedes dependabot's #1237)
- certifi (supersedes dependabot's #1233)
- enum34 (oddly not detected by dependabot)

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-10 18:21:01 +01:00
Lukas Puehringer
4f40764de4 Adopt removal of Python 3.5 support in test config
Also enables windows builds for the recently added Python 3.9.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-10 18:20:29 +01:00
Lukas Puehringer
a78da1558a Update setup.py to drop support for Python 3.5
Python 3.5 has now reached its end-of-life and has been retired.
https://www.python.org/dev/peps/pep-0478/

The optional (but highly recommended) 'cryptography' dependency
has also just dropped support for 3.5. Continuing support for 3.5
in TUF does not seem worth the effort.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-10 18:14:55 +01:00
Joshua Lock
fccd078634 Update tests for client expiration check
Add a test to ensure that metadata expires at the expiration time, not
after it.
This tests the change to the updater introduced in 4bcd703

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-12-09 22:08:58 +00:00
Joshua Lock
4bcd703462 client: update expiration check to match spec
The specification, as of 1.0.16, describes an update expiration check as:

> The expiration timestamp in the trusted $ROLE metadata file MUST be
  higher than the fixed update expiration time.

Having done some research into how other security providers are comparing
expiration equivalents (i.e. OpenSSL x509 certificate checking code, and
GnuPG expiration checks), and how other TUF implementations are performing
the same check (rust-tuf, go-tuf), we came to a consensus that the correct
way to implement expiration comparisons is:

    expiration <= now

Where:
  expiration: is the metadata's expiration datetime
  now: is the current system time, or the fixed notion of time in the
       detailed client workflow (introduced in 1.0.16 of the spec)

Fixes #1231

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-12-08 14:05:44 +00:00
Joshua Lock
cdf069a8a9
Merge pull request #1234 from lukpueh/drop-bandit-py2
Add >=Py3.5 constraint for bandit test dependency
2020-12-07 14:29:36 +00:00
Lukas Puehringer
855a8d0b54 Add >=Py3.5 constraint for bandit test dependency
Bandit just dropped support for Python <3.5. This commit adds
a corresponding constraint to requirements-test.txt.

Note, we run bandit in a dedicated 'lint' tox environment, which
uses Python3.8 on Travis.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-07 14:16:07 +01:00
lukpueh
771592a342
Merge pull request #1232 from lukpueh/adr0005
ADR0005: Decide on python code style guide
2020-12-04 11:24:09 +01:00
Lukas Puehringer
2385ebe7b0 Add style guide usage instructions to ADR0005
Similar instructions are in the style guide preamble, but we repeat
it here for emphasis.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-12-04 10:50:36 +01:00
Lukas Puehringer
b5252fed65 ADR0005: Decide on python code style guide
Use Google style guide with refinements, because the Google style
guide is a comprehensive, well-established style guide that is
mostly based on PEP-8 and was accepted by everyone on the TUF team.

There is no need to replicate these recommendations. However, we do
provide a very slim document with additional refinements, in order
to emphasize on items the we consider especially important, want to
be handled differently, or in one specific way, where the Google
guide would allow multiple.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
Co-authored-by: Joshua Lock <jlock@vmware.com>
2020-12-04 10:39:24 +01:00
lukpueh
d3cd0cd0cd
Merge pull request #1229 from lukpueh/adr0004
ADR0004: Justify extent of OOP in metadata model
2020-12-01 08:56:01 +01:00
Lukas Puehringer
229e9df630 ADR0004: Justify extent of OOP in metadata model
Add MADR that justifies why we want to add custom classes for
complex tuf metadata attributes.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-11-30 14:59:56 +01:00
lukpueh
2a376ae7a7
Merge pull request #1228 from MVrachev/fix-ci
TOX: Install securesystemslib in non-editable mode
2020-11-27 16:20:29 +01:00
Martin Vrachev
0b0e5c3aab TOX: Install securesystemslib in non-editable mode
Installing securesystemslib in editable mode leads to a problem
in sys.path where we have two "tests" packages.
By not installing securesystemslib in an editable mode we are not
adding the securesystemslib tests to sys.path.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2020-11-27 16:39:30 +02:00
lukpueh
fc4b77f92c
Merge pull request #1226 from jku/updater-close-file-object
Updater: close file object
2020-11-27 12:29:08 +01:00
lukpueh
901496dd46
Merge pull request #1220 from sechkova/adr0003
ADR0003: where to develop TUF 1.0.0
2020-11-27 12:05:58 +01:00
Teodora Sechkova
3370005e7d
ADR003: Add pros and cons of the options
Describe pros of developing TUF 1.0.0 in a subdirectory
of the current implementation against the rest of the options.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2020-11-27 12:26:52 +02:00
Teodora Sechkova
1e24977677
ADR003: describe transition to stand-alone TUF
Describe the steps for transitioning from TUF 1.0.0
in a subdirectory to stand-alone TUF 1.0.0

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2020-11-27 12:26:52 +02:00
Teodora Sechkova
3a1ec87d52
ADR0003: where to develop TUF 1.0.0
Document the outcome of #1126 to develop TUF 1.0.0
in a subdirectory of the current TUF implementation.

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
2020-11-27 12:26:48 +02:00
Jussi Kukkonen
6101817b4c Updater: Close temp file in exception cases
If during updater.download_target() the download succeeds but a later
check fails (e.g. BadHashError), remember to close the tempfile.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-11-27 12:19:01 +02:00
Jussi Kukkonen
e54869c98c Tests: Fix first line of test server output
Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2020-11-27 12:18:44 +02:00
Joshua Lock
2302f0dc57
Merge pull request #1225 from joshuagl/joshuagl/release-0.16
Prepare 0.16.0 release
2020-11-26 13:42:57 +00:00
Joshua Lock
7ff26717a1 Prepare 0.16.0 release
Update docs/CHANGELOG.md and bump version number for a 0.16.0 release

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-11-26 13:15:14 +00:00
lukpueh
e061bc6ebb
Merge pull request #1202 from joshuagl/joshuagl/updater-simplify
Simplify updater logic for downloading and verifying target files
2020-11-26 13:48:35 +01:00
Joshua Lock
372e2184e0 client: simplify loop exit logic
Simplify the loop exit logic in _get_target_file() to simply return a
verified file_object, once we have it, rather than breaking from the loop
and then returning the file_object.

This converts a use of a try/except/else to a try/except and is a little
easier to read.

Signed-off-by: Joshua Lock <jlock@vmware.com>
2020-11-26 10:01:14 +00:00
Joshua Lock
e005801891
Merge pull request #1216 from MVrachev/fix-imports-and-default
Fix imports and default value for function arg
2020-11-25 16:19:09 +00:00
Joshua Lock
481496ca6d
Merge pull request #1201 from theupdateframework/dependabot/pip/certifi-2020.11.8
build(deps): bump certifi from 2020.6.20 to 2020.11.8
2020-11-25 14:37:11 +00:00