-
Notifications
You must be signed in to change notification settings - Fork 25
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
ADR for Scorecard metrics aggregation and stack quality scoring #439
Merged
sesheta
merged 1 commit into
thoth-station:master
from
mayaCostantini:adr-scorecard-metrics
Aug 8, 2022
Merged
Changes from all commits
Commits
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 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Aggregating OpenSSF Scorecard metrics to compute software stack quality scores | ||
|
||
* Status: proposed | ||
* Date: 2022-August-1 | ||
|
||
Technical Story: Aggregate OpenSSF Scorecard metrics on a package release update to compute software stack quality scores. | ||
|
||
## Context and Problem Statement | ||
|
||
As part of advise output improvements mentioned in [](https://github.com/thoth-station/core/issues/434), we would like to aggregate Security Scorecards data on a new package release to provide software stack quality metrics with regards to the global quality of packages that can be found in Thoth's Database. These metrics would inform the user about the health of a project dependencies and provide a software stack score (on a 0-100 scale or A,B,C...) based on Scorecard data. | ||
|
||
**Note:** The architecture diagram below supposes that the OSSF Scorecards dataset available on BigQuery will expose metrics by package release instead of repository head commit SHA as it is currently the case. However if this feature is not going to be implemented on the Scorecards project side, we will need to handle the head commit SHA to release association logic by ourselves and thus revisit the diagram to include appropriate calls to the GitHub API and additional computations. | ||
|
||
The data aggregation and score computation logic would be implemented as follows: | ||
|
||
* With each `package-releases-job` run, aggregate data about the latest package release and corresponding Scorecards data retrieved from BigQuery | ||
* Update a new database table `package_scorecard_metrics` with columns for the package name and version and Scorecards Check (1 if the check passed, 0 otherwise). Eventually add a column for a global confidence computed from all Scorecards confidence for a project | ||
* Schedule a job to compute a global package quality score from the previously aggregated data and store this score in the database | ||
* Make this data available in prescriptions: update existing Scorecard prescriptions with the package version and create new prescriptions for other packages via `prescriptions-refresh-job` | ||
* Implement the scoring logic available for relevant Thoth endpoints | ||
* When a request is made to the relevant endpoint or a parameter is passed to ask for software stack scoring when computing an advise, output the computed metrics about the user's software stack quality | ||
|
||
## Architectural diagram | ||
|
||
![Scorecard metrics aggregation logic diagram](/images/Scorecards_metrics_ADR.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Can e use the scorecard command line Utility for this?
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.
As we want to aggregate data about packages we do not have yet into the prescriptions database, I don't think this will work unless we modify the scorecards handler logic. Another alternative to this architecture would be to compute prescriptions from new releases aggregated on
package-release-job
without storing this data in the DB, which will (if I'm not mistaken) greatly increase the number of prescriptions we already have. The global quality metrics could then be derived from prescriptions directly and stored in the DB on a regular job run for example.