-
Notifications
You must be signed in to change notification settings - Fork 99
feat: Add CAWG validation to Reader
#1370
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
Open
scouten-adobe
wants to merge
16
commits into
main
Choose a base branch
from
scouten/cai-9212-add-cawg-to-reader
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
41d19ae
TDD: Test that expects a success code for identity assertion but does…
scouten-adobe ac8acc1
Sketch in proposed changes for CAWG validation in Reader interface
scouten-adobe 61c2ced
Merge branch 'scouten/cai-9212-identity-assertion-in-reader' into sco…
scouten-adobe adc1715
Merge branch 'main' into scouten/cai-9212-add-cawg-to-reader
scouten-adobe 650d954
Merge branch 'main' into scouten/cai-9212-add-cawg-to-reader
scouten-adobe d8c04e3
Remove unused import
scouten-adobe faf671b
Getting back into this project; a little more clarity on what is need…
scouten-adobe 0f90e21
Clean up test noise now that I know where I need to place updates
scouten-adobe 5270494
Hmmm … maybe this doesn't need to be so complicated
scouten-adobe c7928b8
"Fix" WASI build errors
scouten-adobe ccb6038
Merge branch 'main' into scouten/cai-9212-add-cawg-to-reader
gpeacock 25d029f
feat: cawg in native Reader
gpeacock c87e7f5
Merge branch 'main' into scouten/cai-9212-add-cawg-to-reader
scouten-adobe aeab1bc
Reader::from_stream_async should use Store::from_store_async
scouten-adobe 13523aa
Merge branch 'main' into scouten/cai-9212-add-cawg-to-reader
scouten-adobe a612b45
Plan to resolve compatibility issues for `IdentityAssertion::from_man…
scouten-adobe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,6 @@ mod cawg { | |
crypto::raw_signature, | ||
identity::{ | ||
builder::{AsyncIdentityAssertionBuilder, AsyncIdentityAssertionSigner}, | ||
validator::CawgValidator, | ||
x509::AsyncX509CredentialHolder, | ||
}, | ||
AsyncSigner, Builder, Reader, SigningAlg, | ||
|
@@ -125,9 +124,7 @@ mod cawg { | |
|
||
builder.sign_file_async(&signer, source, &dest).await?; | ||
|
||
let mut reader = Reader::from_file(dest)?; | ||
|
||
reader.post_validate_async(&CawgValidator {}).await?; | ||
let reader = Reader::from_file_async(dest).await?; | ||
|
||
|
||
println!("{reader}"); | ||
Ok(()) | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,7 +136,22 @@ impl Reader { | |
Store::from_stream_async(format, &mut stream, verify, &mut validation_log).await | ||
}?; | ||
|
||
Self::from_store(store, &validation_log) | ||
#[allow(unused_mut)] // TEMPORARY until I figure out the synchronous path. | ||
let mut result = Self::from_store(store, &validation_log)?; | ||
if _sync { | ||
// TO DO: Figure out how to handle synchronous validation with | ||
// identity assertions? Just report an error (needs async)? | ||
if false { | ||
todo!("Add identity assertion validation here"); | ||
} | ||
} else { | ||
use crate::identity::validator::CawgValidator; | ||
result | ||
.post_validate_internal_async(&CawgValidator {}) | ||
.await?; | ||
} | ||
|
||
Ok(result) | ||
} | ||
|
||
#[async_generic()] | ||
|
@@ -151,7 +166,11 @@ impl Reader { | |
Store::from_stream_async(format, &mut stream, verify, &mut validation_log).await | ||
}?; | ||
|
||
Self::from_store(store, &validation_log) | ||
let mut result = Self::from_store(store, &validation_log)?; | ||
if false { | ||
todo!("Add identity assertion validation here"); | ||
} | ||
Ok(result) | ||
} | ||
|
||
#[cfg(feature = "file_io")] | ||
|
@@ -735,6 +754,24 @@ impl Reader { | |
validator: &impl AsyncPostValidator | ||
))] | ||
pub fn post_validate(&mut self, validator: &impl PostValidator) -> Result<()> { | ||
if false { | ||
// CONSIDER BEFORE MERGING ... | ||
todo!("Remove me?"); | ||
} | ||
|
||
if _sync { | ||
self.post_validate_internal(validator) | ||
} else { | ||
self.post_validate_internal_async(validator).await | ||
} | ||
} | ||
|
||
#[async_generic(async_signature( | ||
&mut self, | ||
validator: &impl AsyncPostValidator | ||
))] | ||
fn post_validate_internal(&mut self, validator: &impl PostValidator) -> Result<()> { | ||
// TEMPORARY: Make this available while I sort out new code path. | ||
let mut validation_log = StatusTracker::default(); | ||
let mut validation_results = self.validation_results.take().unwrap_or_default(); | ||
let mut assertion_values = HashMap::new(); | ||
|
@@ -997,6 +1034,10 @@ pub mod tests { | |
|
||
#[test] | ||
fn test_reader_post_validate() -> Result<()> { | ||
if false { | ||
|
||
// CONSIDER BEFORE MERGING ... | ||
todo!("Remove me?"); | ||
} | ||
use crate::{log_item, status_tracker::StatusTracker}; | ||
|
||
let mut reader = | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PostValidate could be useful for validating and formatting any 3rd party assertions we don't have in the SDK.
Ideally there would be some way to integrate this into the definition of an Assertion such that you would just need to add an assertion handler to the SDK, but that's a problem for tomorrow.