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

Add security best practices #107

Merged
merged 2 commits into from
Oct 25, 2023

Conversation

rahulchaphalkar
Copy link
Contributor

Adds some changes for improving security. Motivation was to improve score as tracked by https://github.com/ossf/scorecard .
The tool at https://app.stepsecurity.io/securerepo is used for identifying the required changes, and the bot helped create the base commit, as recommended by Scorecard.

Security Fixes

Least Privileged GitHub Actions Token Permissions

The GITHUB_TOKEN is an automatically generated secret to make authenticated calls to the GitHub API. GitHub recommends setting minimum token permissions for the GITHUB_TOKEN.

Pinned Dependencies

GitHub Action tags and Docker tags are mutatble. This poses a security risk. GitHub's Security Hardening guide recommends pinning actions to full length commit.

Keeping your actions up to date with Dependabot

With Dependabot version updates, when Dependabot identifies an outdated dependency, it raises a pull request to update the manifest to the latest version of the dependency. This is recommended by GitHub as well as The Open Source Security Foundation (OpenSSF).

Detect Vulnerabilities with SAST Workflow

Static Code Analysis (also known as Source Code Analysis) is usually performed as part of a Code Review (also known as clear-box testing) and is carried out at the Implementation phase of a Security Development Lifecycle (SDL). Static Code Analysis commonly refers to the running of Static Code Analysis tools that attempt to highlight possible vulnerabilities within ‘static’ (non-running) source code by using techniques such as Taint Analysis and Data Flow Analysis. (CodeQL is added in this PR)

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Copy link
Contributor

@abrown abrown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with these changes; @ekovanova, @ichepiga?

strategy:
fail-fast: false
matrix:
language: ["cpp", "python"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wish this also supported Rust but I don't think that is available yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, not available for Rust yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abrown abrown merged commit fb0f2f2 into intel:master Oct 25, 2023
12 checks passed
@abrown abrown mentioned this pull request Jan 12, 2024
abrown added a commit to abrown/ittapi that referenced this pull request Feb 6, 2024
PR intel#107 introduced dependabot to the repository to update GitHub
Actions. This results in a weekly stream of PRs to incorporate every
tiny patch update for every GitHub Action we use here. This results in a
lot of churn and I do not have any sense that it improves the code
quality in any way. Instead, it may in fact be the cause of the breakage
in the release workflow, since that relies on `upload-artifact` which
dependabot bumped from v3.1.3 to v4.0.0.

What this change does is follow GitHub's [guidance] to only receive
security updates. Since "dependabot security updates" are enabled, we
don't need to follow each action update; setting
`open-pull-requests-limit` to 0 mutes the dependabot PRs but we should
still see any security alerts in the security tab.

[guidance]: https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates#overriding-the-default-behavior-with-a-configuration-file
abrown added a commit that referenced this pull request Feb 10, 2024
PR #107 introduced dependabot to the repository to update GitHub
Actions. This results in a weekly stream of PRs to incorporate every
tiny patch update for every GitHub Action we use here. This results in a
lot of churn and I do not have any sense that it improves the code
quality in any way. Instead, it may in fact be the cause of the breakage
in the release workflow, since that relies on `upload-artifact` which
dependabot bumped from v3.1.3 to v4.0.0.

What this change does is follow GitHub's [guidance] to only receive
security updates. Since "dependabot security updates" are enabled, we
don't need to follow each action update; setting
`open-pull-requests-limit` to 0 mutes the dependabot PRs but we should
still see any security alerts in the security tab.

[guidance]: https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates#overriding-the-default-behavior-with-a-configuration-file
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.

4 participants