Add validating reader - #133
Open
mikeminutillo wants to merge 4 commits into
Open
Conversation
PhilBastian
approved these changes
Aug 28, 2026
| var reportId = Convert.ToHexString(SHA1.HashData(reportBytes)); | ||
| var validationResult = new ReportValidationResult | ||
| { | ||
| ReportId = reportId |
Contributor
There was a problem hiding this comment.
just in case, to make it explicit and safeguard against a constructor being reintroduced
Suggested change
| ReportId = reportId | |
| ReportId = reportId, | |
| IsValid = false |
| Assert.That(data.EnvironmentInformation.EnvironmentData["MonitoringEnabled"], Is.EqualTo("True")); | ||
|
|
||
| Assert.That(report.Signature, Is.EqualTo("IEbO4i0Jn54iHUzlwotHf9aw/fZIHY+dztY9cMRkWjVVo6AiYtihWR0mip793gRrWHOxHVobCpa4l5svRk16mBR+YAOrs3KNRVTzrl4+wL21e1u9zFuPNrHLtFeul+taJxV8ciA7zEgD7LMle9CcR/Vfm8BZ9mmD5W/DjsCYLCdVXfN4iRMlz+eW50mOHty21yJ0pOiYBooaN2EJexVY4Q+5FMyAkm0wucEPFyaQB6+SfcS37fEm807B7sXhtUPiW+einqDOX6uYF+MuXxUn1u9LxlEWKV9kPqXJnulxmoReHXHigP45pj/8m9jUzrQdagINl1uIOBkq5SMDccRfTA==")); | ||
| //Assert.That(report.Signature, Is.EqualTo("IEbO4i0Jn54iHUzlwotHf9aw/fZIHY+dztY9cMRkWjVVo6AiYtihWR0mip793gRrWHOxHVobCpa4l5svRk16mBR+YAOrs3KNRVTzrl4+wL21e1u9zFuPNrHLtFeul+taJxV8ciA7zEgD7LMle9CcR/Vfm8BZ9mmD5W/DjsCYLCdVXfN4iRMlz+eW50mOHty21yJ0pOiYBooaN2EJexVY4Q+5FMyAkm0wucEPFyaQB6+SfcS37fEm807B7sXhtUPiW+einqDOX6uYF+MuXxUn1u9LxlEWKV9kPqXJnulxmoReHXHigP45pj/8m9jUzrQdagINl1uIOBkq5SMDccRfTA==")); |
DavidBoike
approved these changes
Aug 28, 2026
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.
While trying to remove
TotalThroughputwe discovered a point of friction with the way signatures are being validated.The way this was happening is as follows:
SignedReport). This object had two fields,SignatureandReportData.ReportDataand use that to calculate the expected signatureSignatureThis means that any change to the
ReportDatathat would affect the way it is serialized, would break the signature validation logic. This includes removing fields, renaming fields (even if we could handle the way old reports were deserialized), or adding fields that have a default value.To resolve this we added a class that validates the signature while it reads the report data. It does this by:
JsonDocumentThis means we can validate the signature, even without having the in-memory representation if we need to.
The downside to doing it this way is that we have to validate the signature when we load the raw json into memory. We cannot load a
SignedReportinto memory and then validate it's signature separately. As we only do this in our internal tools, and we always validate the signature shortly after loading it, that trade-off seems acceptable.