Skip to content

Unit testing for bundled trust root getters#591

Merged
tetsuo-cpp merged 9 commits intosigstore:mainfrom
trail-of-forks:andrew/issue/580
Apr 10, 2023
Merged

Unit testing for bundled trust root getters#591
tetsuo-cpp merged 9 commits intosigstore:mainfrom
trail-of-forks:andrew/issue/580

Conversation

@tnytown
Copy link
Contributor

@tnytown tnytown commented Mar 30, 2023

This changeset exercises the bundled trusted root codepaths in get_rekor_keys, get_ctfe_keys, and get_fulcio_certs with new offline tests. We also yakshave the TUF module further.

Resolves #580.

@tnytown tnytown added safe to test component:tuf TUF related components component:tests Unit and integration tests labels Mar 30, 2023
@tnytown tnytown self-assigned this Mar 30, 2023
@tnytown
Copy link
Contributor Author

tnytown commented Mar 30, 2023

I was originally planning on using the staging root for this test, but sigstore/root-signing#756 is still inflight. We can cutover and update staging test assets whenever that lands.

@tnytown tnytown requested review from jleightcap and woodruffw March 30, 2023 21:18
@tnytown tnytown requested a review from tetsuo-cpp March 31, 2023 00:06
# The test should use the TUF path, so we stub out the legacy getter here.
monkeypatch.setattr(updater, "_get", lambda usage, statuses: [])

assert _der_keys(updater.get_ctfe_keys()) == _pem_keys([_contents("ctfe_2022.pub")])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just so I know what to expect. When there's a key rotation, we should expect these to begin failing right? And in that case, we should refresh the keys and certs under assets/prod-tuf.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! I could alternatively monkeypatch datetime.now to return a static time, if we think that would be better :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, i intend on removing assets/prod-tuf and switching to our staging assets once staging has bundled roots

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm not too bothered by it. If it becomes annoying then we can look into monkey patching the time, but for now I'd say we can switch to staging assets when it's ready and pull the trigger on this.

tnytown added a commit to trail-of-forks/sigstore-python that referenced this pull request Apr 4, 2023
These tests need to be updated for our new trusted root format. Testing
for that is landing in sigstore#591.

Signed-off-by: Andrew Pan <[email protected]>
woodruffw pushed a commit that referenced this pull request Apr 5, 2023
* Update staging-root.json

Change hardcoded root to the new root from sigstore/root-signing#756


Signed-off-by: Hayden B <[email protected]>

* wip: test: adjust local assets for staging update

Signed-off-by: Andrew Pan <[email protected]>

* test_tuf: skip failing getter tests

These tests need to be updated for our new trusted root format. Testing
for that is landing in #591.

Signed-off-by: Andrew Pan <[email protected]>

* fixup! test_tuf: skip failing getter tests

Signed-off-by: Andrew Pan <[email protected]>

* fixup! fixup! test_tuf: skip failing getter tests

Signed-off-by: Andrew Pan <[email protected]>

* fixup! fixup! fixup! test_tuf: skip failing getter tests

Signed-off-by: Andrew Pan <[email protected]>

* fixup! fixup! fixup! fixup! test_tuf: skip failing getter tests

Signed-off-by: Andrew Pan <[email protected]>

* test_tuf: doc

Signed-off-by: Andrew Pan <[email protected]>

* test: add staging-tuf targets

Signed-off-by: Andrew Pan <[email protected]>

---------

Signed-off-by: Hayden B <[email protected]>
Signed-off-by: Andrew Pan <[email protected]>
Co-authored-by: Hayden B <[email protected]>
@tnytown tnytown force-pushed the andrew/issue/580 branch from bbca128 to 9d4378b Compare April 5, 2023 16:56
@tnytown tnytown requested a review from tetsuo-cpp April 5, 2023 20:41
@tnytown tnytown marked this pull request as ready for review April 5, 2023 20:42
Copy link
Contributor

@tetsuo-cpp tetsuo-cpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

success[filepath] += 1
return BytesIO(filepath.read_bytes())
else:
print(f"POO {filepath}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

@tetsuo-cpp tetsuo-cpp enabled auto-merge (squash) April 10, 2023 04:44
@tetsuo-cpp tetsuo-cpp merged commit 6d63b6e into sigstore:main Apr 10, 2023
@tetsuo-cpp tetsuo-cpp deleted the andrew/issue/580 branch April 10, 2023 08:48
emilejbm pushed a commit to emilejbm/sigstore-python that referenced this pull request Apr 21, 2023
* Update staging-root.json

Change hardcoded root to the new root from sigstore/root-signing#756

Signed-off-by: Hayden B <[email protected]>

* wip: test: adjust local assets for staging update

Signed-off-by: Andrew Pan <[email protected]>

* test_tuf: skip failing getter tests

These tests need to be updated for our new trusted root format. Testing
for that is landing in sigstore#591.

Signed-off-by: Andrew Pan <[email protected]>

* fixup! test_tuf: skip failing getter tests

Signed-off-by: Andrew Pan <[email protected]>

* fixup! fixup! test_tuf: skip failing getter tests

Signed-off-by: Andrew Pan <[email protected]>

* fixup! fixup! fixup! test_tuf: skip failing getter tests

Signed-off-by: Andrew Pan <[email protected]>

* fixup! fixup! fixup! fixup! test_tuf: skip failing getter tests

Signed-off-by: Andrew Pan <[email protected]>

* test_tuf: doc

Signed-off-by: Andrew Pan <[email protected]>

* test: add staging-tuf targets

Signed-off-by: Andrew Pan <[email protected]>

---------

Signed-off-by: Hayden B <[email protected]>
Signed-off-by: Andrew Pan <[email protected]>
Co-authored-by: Hayden B <[email protected]>
Signed-off-by: Emile Baez <[email protected]>
emilejbm pushed a commit to emilejbm/sigstore-python that referenced this pull request Apr 21, 2023
* wip: test_tuf, tuf: basic bundled tests

Signed-off-by: Andrew Pan <[email protected]>

* tuf: use correct tlogs for rekor

Signed-off-by: Andrew Pan <[email protected]>

* test_tuf: test all bundled root getters

Signed-off-by: Andrew Pan <[email protected]>

* assets/prod-tuf: checkin

Signed-off-by: Andrew Pan <[email protected]>

* assets/prod-tuf: ajouter plus d'keys

Signed-off-by: Andrew Pan <[email protected]>

* test_tuf: reformat

Signed-off-by: Andrew Pan <[email protected]>

* test_tuf, conftest: staging bundled root changes

Signed-off-by: Andrew Pan <[email protected]>

* assets/prod-tuf: rm

Signed-off-by: Andrew Pan <[email protected]>

---------

Signed-off-by: Andrew Pan <[email protected]>
Co-authored-by: Alex Cameron <[email protected]>
Signed-off-by: Emile Baez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:tests Unit and integration tests component:tuf TUF related components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

More unit testing for bundled trust root changes

2 participants