-
Notifications
You must be signed in to change notification settings - Fork 5
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
Ossf/gha scorecard #30
Conversation
WalkthroughThe pull request introduces multiple updates to the workflow configurations and documentation of the Savvyi I/O project. Key changes include enhancements to the existing pipeline in Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (5)
.github/workflows/scorecard.yml (1)
1-10
: Consider optimizing the schedule timingThe workflow is scheduled to run every Tuesday at 17:45 UTC. Consider running it during off-peak hours to minimize resource contention with other workflows.
- - cron: '45 17 * * 2' + - cron: '0 2 * * 2' # Run at 2 AM UTC on Tuesdays.github/workflows/pipelines.yml (2)
Line range hint
214-224
: Consider adding deployment safeguards.The deploy job is well-structured with:
- ✅ Appropriate conditional execution preventing PR deployments
- ✅ Comprehensive dependencies on all quality gates
- ✅ Production environment usage
- ✅ Proper version management
Consider these enhancements:
- Add deployment approval gates using environment protection rules
- Implement retry mechanism for NuGet push to handle transient failures
Example configuration for retry mechanism:
- uses: codebeltnet/nuget-push@v1 with: token: ${{ secrets.NUGET_TOKEN }} configuration: ${{ inputs.configuration == '' && 'Release' || inputs.configuration }} + retryAttempts: 3 + retryDelay: 10000
Security improvements needed for GitHub Actions workflow
- All custom actions are using major version tags (e.g.,
@v1
,@v2
,@v3
) instead of specific commit hashes, which could allow for potential supply chain attacks if the actions are compromised.- No timeout limits are set for any jobs, which could lead to excessive resource consumption or hung jobs.
Recommended changes:
- Pin all actions to specific commit hashes instead of major versions (e.g.,
@{commit-hash}
)- Add
timeout-minutes
to each job to prevent indefinite runs- Consider using official GitHub Actions where possible to reduce third-party dependencies
🔗 Analysis chain
Line range hint
1-224
: Verify custom actions security.The workflow heavily relies on custom actions from the
codebeltnet
organization. While this provides consistency, it's important to:
- Ensure these actions are maintained and regularly updated for security
- Consider adding timeout limits to prevent long-running jobs
- Pin action versions to specific commits instead of major versions for better security
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check the last update dates and versions of custom actions used in the workflow # List all custom actions and their versions echo "Checking custom actions versions and last updates..." rg "uses: codebeltnet/([a-zA-Z0-9-]+)@v\d+" -o | sort -u | while read -r action; do echo "Action: $action" # Extract action name and version name=$(echo "$action" | cut -d'/' -f2 | cut -d'@' -f1) # Use GitHub API to check last update gh api "repos/codebeltnet/$name" --jq '.updated_at + " | Stars: " + (.stargazers_count|tostring) + " | Open Issues: " + (.open_issues_count|tostring)' doneLength of output: 190
Script:
#!/bin/bash # Let's try a different approach to analyze the custom actions usage # First, let's extract all the custom actions and their versions echo "Custom actions usage:" rg "uses:\s+codebeltnet/[^\s]+" .github/workflows/pipelines.yml # Check for timeout settings echo -e "\nTimeout settings:" rg "timeout-minutes:" .github/workflows/pipelines.yml # Check if any actions are pinned to specific commits echo -e "\nCommit hash pinned actions:" rg "uses:\s+\S+@[0-9a-f]{40}" .github/workflows/pipelines.ymlLength of output: 1762
README.md (2)
25-25
: Format the documentation URL using proper markdown syntax.The bare URL should be formatted as a proper markdown link for better readability and maintainability.
Apply this change:
-Full documentation (generated by [DocFx](https://github.com/dotnet/docfx)) located here: https://docs.savvyio.net/ +Full documentation (generated by [DocFx](https://github.com/dotnet/docfx)) is located here: [https://docs.savvyio.net/](https://docs.savvyio.net/)🧰 Tools
🪛 Markdownlint
25-25: null
Bare URL used(MD034, no-bare-urls)
29-29
: Fix grammar in the code quality analysis statement.There's a subject-verb agreement issue in the sentence.
Apply this change:
-All code quality analysis are done by [SonarCloud](https://sonarcloud.io/) and [CodeCov.io](https://codecov.io/). +All code quality analysis is done by [SonarCloud](https://sonarcloud.io/) and [CodeCov.io](https://codecov.io/).🧰 Tools
🪛 LanguageTool
[grammar] ~29-~29: The verb form ‘are’ does not appear to fit in this context.
Context: ...odebeltnet) umbrella. All code quality analysis are done by [SonarCloud](https://sonarcloud...(SINGULAR_NOUN_VERB_AGREEMENT)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
.github/workflows/pipelines.yml
(1 hunks).github/workflows/scorecard.yml
(1 hunks)README.md
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md
[grammar] ~29-~29: The verb form ‘are’ does not appear to fit in this context.
Context: ...odebeltnet) umbrella. All code quality analysis are done by [SonarCloud](https://sonarcloud...
(SINGULAR_NOUN_VERB_AGREEMENT)
🪛 Markdownlint
README.md
25-25: null
Bare URL used
(MD034, no-bare-urls)
🔇 Additional comments (6)
.github/workflows/scorecard.yml (3)
11-18
: LGTM! Well-structured job configuration
The job permissions follow the principle of least privilege by explicitly declaring only the required write permissions for security-events and id-token.
1-42
: Verify workflow completeness against OSSF best practices
Let's verify if the workflow includes all recommended components and follows OSSF Scorecard best practices.
#!/bin/bash
# Check for common OSSF Scorecard workflow patterns
echo "Checking for common required steps..."
# Check if other repositories use additional important steps
gh api graphql -f query='
{
search(query: "filename:scorecard.yml path:.github/workflows", type: CODE, first: 10) {
nodes {
... on CodeResult {
repository {
nameWithOwner
}
file {
text
}
}
}
}
}' | jq -r '.data.search.nodes[].file.text'
25-31
: Verify the latest version of scorecard-action
The workflow uses ossf/[email protected]
. Let's verify if this is the latest stable version.
.github/workflows/pipelines.yml (1)
9-9
: LGTM! More explicit glob pattern.
The updated pattern **/*.md
follows standard glob pattern conventions and is more explicit about matching Markdown files.
README.md (2)
19-23
: LGTM! Clear deprecation notice with proper versioning information.
The deprecation notice is well-structured and provides clear information about the last supported versions for both .NET 6 and .NET 7, along with a reference to the .NET support lifecycle.
31-31
: LGTM! Well-integrated OpenSSF Scorecard badge.
The OpenSSF Scorecard badge is properly integrated with the existing badges, maintaining consistent formatting and providing valuable security posture information.
- name: "Upload artifact" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: SARIF file | ||
path: results.sarif | ||
retention-days: 5 | ||
|
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.
🛠️ Refactor suggestion
Consider extending the artifact retention period
A 5-day retention period for security analysis results might be too short for compliance and audit purposes. Consider extending this to at least 30 days.
- retention-days: 5
+ retention-days: 30
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- name: "Upload artifact" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SARIF file | |
path: results.sarif | |
retention-days: 5 | |
- name: "Upload artifact" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SARIF file | |
path: results.sarif | |
retention-days: 30 | |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #30 +/- ##
=======================================
Coverage 89.54% 89.54%
=======================================
Files 158 158
Lines 3289 3289
Branches 331 331
=======================================
Hits 2945 2945
Misses 342 342
Partials 2 2 ☔ View full report in Codecov by Sentry. |
|
This pull request includes several changes to the GitHub workflows and documentation for the project. The most important changes include adding a new workflow for Scorecard supply-chain security, updating the paths to ignore in the pipelines workflow, and modifying the README file to reflect deprecations and add a new badge.
GitHub Workflows:
.github/workflows/scorecard.yml
: Added a new workflow for Scorecard supply-chain security, which includes a schedule, push triggers, and steps for running analysis and uploading results..github/workflows/pipelines.yml
: Updated thepaths-ignore
section to exclude.github/**
and changed the pattern for markdown files to'**/*.md'
.Documentation:
README.md
: Updated to indicate that support for .NET 6 and .NET 7 has been deprecated.README.md
: Added an OpenSSF Scorecard badge to the list of badges.Summary by CodeRabbit
New Features
Documentation
Bug Fixes