Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A simple, per-file metadata CRUD API #1060

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
83d6d07
WIP
trishankatdatadog Jun 26, 2020
2e3ceb7
tuf.api: set consistent_snapshot during read_from_json
joshuagl Jun 30, 2020
721def4
tuf.api: add helpers to bump version and expiration
joshuagl Jun 30, 2020
5ef60ca
tuf.api: implement update_signatures()
joshuagl Jun 30, 2020
92f97a4
tuf.api: implement metadata.Snapshot
joshuagl Jun 30, 2020
eb9c56b
tuf.api: fix missing ':' in keys
joshuagl Jul 1, 2020
d58a944
tuf.api: fix imports in metadata
joshuagl Jul 1, 2020
2758f48
tuf.api: fix version check in metadata
joshuagl Jul 1, 2020
bc1134f
tuf.api: fix loading expiration
joshuagl Jul 1, 2020
57c98d4
WIP tests for tuf.api.metadata
joshuagl Jul 1, 2020
11d76e7
tuf.api: WIP implement Timestamp
joshuagl Jul 1, 2020
f2861bf
much simpler keys
trishankatdatadog Jul 1, 2020
37a235f
tuf.api: implement metadata.Targtes.read_from_json()
sechkova Jul 2, 2020
db0f8a7
tuf.api: implement metadata.Targets.update()
sechkova Jul 2, 2020
46977f9
tux.api: implement metadata.Targets.signable()
sechkova Jul 2, 2020
3e022aa
Skip an optional keyword in the schema
sechkova Jul 2, 2020
916055a
tuf.api: simplify metadata.Targets.signable()
sechkova Jul 2, 2020
1fbff55
tuf.api: add basic schema checks in read_from_json
sechkova Jul 2, 2020
0ca471e
tuf.api: use StorageBackendInterface
sechkova Jul 2, 2020
eb93fe1
tuf.api: make expires a property
joshuagl Jul 2, 2020
f8d8bb5
tuf.api: convert keys.Algorithm to dict
joshuagl Jul 3, 2020
3cc98ae
tuf.api: make signed & signatures properties of Metadata
joshuagl Jul 2, 2020
1daefa4
tuf.api: instantiate objects from the JSON
joshuagl Jul 2, 2020
0ecdfba
tuf.api: shuffle up signed/signatures/signable interface
joshuagl Jul 3, 2020
34a0680
More tests tuf.api and verify data!
joshuagl Jul 2, 2020
3c5e312
WIP added tuf.api keys tests
sechkova Jul 3, 2020
fd5732a
tuf.api: treat all datetime's as UTC
joshuagl Jul 6, 2020
54e1f9c
tuf.api: drop use of dateutil
joshuagl Jul 6, 2020
4237287
Test Metadata.bump_expiration() with relativedelta
joshuagl Jul 7, 2020
76cb560
minor edits
trishankatdatadog Jul 8, 2020
565768e
Quick-fix programming errors in api.keys module
lukpueh Jul 10, 2020
3e249f5
Make Metadata a container class (WIP)
lukpueh Jul 10, 2020
1a8a0e7
fix badly translated assertions
trishankatdatadog Jul 17, 2020
41c0241
Not all Keys read from files
trishankatdatadog Jul 17, 2020
9285727
sign/verify w/ Vault
trishankatdatadog Jul 17, 2020
1703c6b
fix oversight in test
trishankatdatadog Jul 18, 2020
e034618
update and automate requirements
trishankatdatadog Jul 18, 2020
f8b33f0
add P-384 and RSA-3072
trishankatdatadog Jul 20, 2020
f5eb59b
Python verification of signatures from Go
trishankatdatadog Jul 21, 2020
b9a9050
minor comments
trishankatdatadog Jul 21, 2020
3c0cc24
update hvac
trishankatdatadog Jul 31, 2020
495e10f
update how salt lengths are computed
trishankatdatadog Aug 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,13 @@
# - Python version support is changed
# - CI/CD build breaks due to updates (e.g. transitive dependency conflicts)
#
# 1. Use this script to create a pinned requirements file for each Python
# version
# ```
# for v in 2.7 3.5 3.6 3.7 3.8; do
# mkvirtualenv tuf-env-${v} -p python${v};
# pip install pip-tools;
# pip-compile --no-header -o requirements-${v}.txt requirements.txt;
# deactivate;
# rmvirtualenv tuf-env-${v};
# done;
#
# ```
# 2. Use this command to merge per-version files
# `sort -o requirements-pinned.txt -u requirements-?.?.txt`
# 2. Manually add environment markers to requirements-pinned.txt
# 3. Use this command to remove per-version files
# `rm requirements-?.?.txt`
# ./update-requirements.sh
#
securesystemslib[colors, crypto, pynacl]
requests
six
enum34; python_version < '3'
# https://github.com/hvac/hvac/releases/tag/v0.10.5
hvac>=0.10.5
ipaddress; python_version < '3'
iso8601
requests
securesystemslib[colors, crypto, pynacl]
six
20 changes: 10 additions & 10 deletions tests/proxy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,22 +374,22 @@ def parse_qsl(s):
req_header_text = "%s %s %s\n%s" % (req.command, req.path, req.request_version, req.headers)
res_header_text = "%s %d %s\n%s" % (res.response_version, res.status, res.reason, res.headers)

print with_color(33, req_header_text)
print(with_color(33, req_header_text))

u = urlparse.urlsplit(req.path)
if u.query:
query_text = parse_qsl(u.query)
print with_color(32, "==== QUERY PARAMETERS ====\n%s\n" % query_text)
print(with_color(32, "==== QUERY PARAMETERS ====\n%s\n" % query_text))

cookie = req.headers.get('Cookie', '')
if cookie:
cookie = parse_qsl(re.sub(r';\s*', '&', cookie))
print with_color(32, "==== COOKIE ====\n%s\n" % cookie)
print(with_color(32, "==== COOKIE ====\n%s\n" % cookie))

auth = req.headers.get('Authorization', '')
if auth.lower().startswith('basic'):
token = auth.split()[1].decode('base64')
print with_color(31, "==== BASIC AUTH ====\n%s\n" % token)
print(with_color(31, "==== BASIC AUTH ====\n%s\n" % token))

if req_body is not None:
req_body_text = None
Expand All @@ -412,14 +412,14 @@ def parse_qsl(s):
req_body_text = req_body

if req_body_text:
print with_color(32, "==== REQUEST BODY ====\n%s\n" % req_body_text)
print(with_color(32, "==== REQUEST BODY ====\n%s\n" % req_body_text))

print with_color(36, res_header_text)
print(with_color(36, res_header_text))

cookies = res.headers.getheaders('Set-Cookie')
if cookies:
cookies = '\n'.join(cookies)
print with_color(31, "==== SET-COOKIE ====\n%s\n" % cookies)
print(with_color(31, "==== SET-COOKIE ====\n%s\n" % cookies))

if res_body is not None:
res_body_text = None
Expand All @@ -440,12 +440,12 @@ def parse_qsl(s):
m = re.search(r'<title[^>]*>\s*([^<]+?)\s*</title>', res_body, re.I)
if m:
h = HTMLParser()
print with_color(32, "==== HTML TITLE ====\n%s\n" % h.unescape(m.group(1).decode('utf-8')))
print(with_color(32, "==== HTML TITLE ====\n%s\n" % h.unescape(m.group(1).decode('utf-8'))))
elif content_type.startswith('text/') and len(res_body) < 1024:
res_body_text = res_body

if res_body_text:
print with_color(32, "==== RESPONSE BODY ====\n%s\n" % res_body_text)
print(with_color(32, "==== RESPONSE BODY ====\n%s\n" % res_body_text))

def request_handler(self, req, req_body):
pass
Expand Down Expand Up @@ -492,7 +492,7 @@ def test(HandlerClass=ProxyRequestHandler, ServerClass=ThreadingHTTPServer, prot
httpd = ServerClass(server_address, HandlerClass)

sa = httpd.socket.getsockname()
print "Serving HTTP Proxy on", sa[0], "port", sa[1], "..."
print("Serving HTTP Proxy on", sa[0], "port", sa[1], "...")
httpd.serve_forever()


Expand Down
Loading