atls: move validators into dedicated package #2483
Open
burgerdev wants to merge 3 commits into
Open
Conversation
The only user of this struct does not call any of its methods. Add a local fake in the recovery_test and remove the fake from atls.
It's only used by internal tests.
This sets the stage for adding validator helper methods.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My overall plan is to consolidate the attestation validation logic into one package. We currently construct validators (at least) here:
contrast/sdk/common.go
Lines 27 to 29 in 41ae00c
contrast/coordinator/internal/stateguard/credentials.go
Line 74 in 41ae00c
contrast/e2e/atls/atls_test.go
Lines 153 to 156 in 41ae00c
Since the manifest is the authoritative source for admission policy, I would like to move all of this into the manifest package.
Such a refactoring is currently hard to do, because what were supposed to be validation internals leak throughout the code base.
reportSetteris a special purpose implementation for aTLS only, but leaves its traces in validator constructors and duplicated implementations. If validators returned a report struct it would not be necessary, as the Coordinator could just wrap the validator.Getterdesign only makes sense in this particular loop over validators:contrast/internal/atls/atls.go
Lines 249 to 254 in 41ae00c
contrast/internal/atls/atls.go
Lines 399 to 404 in 41ae00c
validatorspackage.That being said, this PR takes an initial step into this direction.
Validatorinto its own package.No functional change, but this paves the way for above plan.