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

chore: Output failure telemetry if signing validation fails #547

Merged

Conversation

DaveTryon
Copy link
Contributor

As called out in #501, telemetry is reporting success even if the manifest signing check fails. This PR fixes this via the following additions:

  1. Add a new failure type so that we can appropriately distinguish this failure case from other failure cases
  2. When a signing failure occurs, capture the failure in validFailures. This will be used in the finally block to capture the telemetry results
  3. Extend the "this is an error" cases in LogResultsSummary and LogIndividualFileResults so that we don't generate unhelpful log output after signing validation fails

Tested locally by forcing the signing failure in the debugger and observing the rest of the execution. The resulting telemetry log reports the error as follows:

{
  "Result": "Failure",
  "Errors": {
    "Count": 1,
    "Errors": [
      {
        "Path": null,
        "ErrorType": "ManifestFileSigningError"
      }
    ]
  },
  // Other properties have been omitted for brevity
}

I left the Path field blank, since it wasn't available in the scope of this function and since it can be inferred from the Parameters object that exists in the raw file but that I omitted for brevity.

@DaveTryon DaveTryon requested a review from a team as a code owner April 11, 2024 17:00
@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 59.70%. Comparing base (8609bce) to head (8684488).

Files Patch % Lines
...Api/Workflows/SBOMParserBasedValidationWorkflow.cs 0.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #547      +/-   ##
==========================================
- Coverage   59.70%   59.70%   -0.01%     
==========================================
  Files         248      248              
  Lines        7575     7576       +1     
  Branches      901      901              
==========================================
  Hits         4523     4523              
- Misses       2639     2640       +1     
  Partials      413      413              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DaveTryon DaveTryon merged commit 2a08f59 into microsoft:main Apr 12, 2024
6 checks passed
@DaveTryon DaveTryon deleted the correct-telemetry-on-signing-error branch April 12, 2024 18:23
tarun06 pushed a commit to tarun06/sbom-tool that referenced this pull request Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants