-
Notifications
You must be signed in to change notification settings - Fork 1
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
[StepSecurity] Apply security best practices #17
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Test a branch on canary | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
COMMIT_SHA: | ||
description: 'Commit SHA to be tested' | ||
required: true | ||
|
||
env: | ||
COMMIT_SHA: ${{ github.event.inputs.COMMIT_SHA }} | ||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
permissions: # added using https://github.com/step-security/secure-workflows | ||
contents: read | ||
|
||
jobs: | ||
update_tag: | ||
name: Update the rc tag to ${{ github.event.inputs.COMMIT_SHA }} commit | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v1 | ||
with: | ||
egress-policy: audit | ||
allowed-endpoints: | ||
api.github.com:443 | ||
github.com:443 | ||
|
||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v2 | ||
- name: Update the rc tag | ||
uses: step-security/publish-action@b438f840875fdcb7d1de4fc3d1d30e86cf6acb5d | ||
with: | ||
rc-sha: ${{ env.COMMIT_SHA }} | ||
rc: true | ||
|
||
- name: Canary test | ||
uses: docker://ghcr.io/step-security/integration-test/int:latest@sha256:cd10adbca15cf7e07d9ae5d623109899ded50687cabd7b952dfeb2daa76d6347 | ||
env: | ||
PAT: ${{ secrets.PAT }} | ||
canary: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Code Review | ||
on: | ||
pull_request: | ||
permissions: | ||
contents: read | ||
jobs: | ||
code-review: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: read | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 | ||
with: | ||
disable-sudo: true | ||
egress-policy: block | ||
allowed-endpoints: > | ||
api.github.com:443 | ||
int.api.stepsecurity.io:443 | ||
|
||
- name: Code Review | ||
uses: step-security/ai-codewise@ab9fe138367d6094b2df7f8469ddc2c5a79c9cf4 # int |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Low]Add comments to explain what the workflow does The workflow file is missing comments explaining what it does. This will help others understand the purpose of the file and the steps in it. Add comments above each step to explain what it does and why it's necessary. Add a comment at the top of the file that explains the purpose of the workflow. |
||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ main ] | ||
schedule: | ||
- cron: '17 0 * * 2' | ||
|
||
permissions: # added using https://github.com/step-security/secure-workflows | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Medium]Avoid exposing unnecessary permissions in actions The workflow specifies |
||
contents: read | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'javascript' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] | ||
# Learn more about CodeQL language support at https://git.io/codeql-language-support | ||
|
||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 | ||
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@cdcdbb579706841c47f7063dda365e292e5cad7a | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Low]Remove commented-out code The workflow file contains commented-out code in the |
||
# and modify them (or add more) to build your code if your project | ||
# uses a compiled language | ||
|
||
#- run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Recurring INT tests | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 */2 * * *' # every other hour | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
int-tests: | ||
name: int tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 | ||
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | ||
|
||
- name: Canary test | ||
uses: docker://ghcr.io/step-security/integration-test/int:latest@sha256:cd10adbca15cf7e07d9ae5d623109899ded50687cabd7b952dfeb2daa76d6347 | ||
env: | ||
PAT: ${{ secrets.PAT }} | ||
canary: true |
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.
[Medium]Use approved base images in containers
The base image for the canary test container is not specified and may not be approved. Always specify a base image that is approved.