Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/automatePR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Automate PR
on:
issues:
types:
- labeled

permissions:
contents: read

jobs:
Automate:
if: github.event.label.name == 'Automate'
runs-on: ubuntu-latest
permissions:
issues: write
actions: write

steps:
- name: Harden Runner
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
repository: step-security/secure-repo

- name: Automate PR
uses: step-security/secure-repo/Automate-PR@98ff385ea512d8ac7a1445f95e199f6864f439e1
with:
github-token: ${{secrets.PAT }}
issue-id: ${{ github.event.issue.number}}
81 changes: 81 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# 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"

on:
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
- cron: "35 17 * * 4"

permissions: # added using https://github.com/step-security/secure-repo
contents: read

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["go"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Harden Runner
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@bc02a25f6449997c5e9d5a368879b28f56ae19a1
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.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# 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@bc02a25f6449997c5e9d5a368879b28f56ae19a1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@bc02a25f6449997c5e9d5a368879b28f56ae19a1
with:
category: "/language:${{matrix.language}}"
90 changes: 90 additions & 0 deletions .github/workflows/int.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Cfnrelease-int

on:
push:
branches:
- int

permissions: # added using https://github.com/step-security/secure-repo
contents: read

jobs:
publish-test:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
with:
go-version: 1.17

- run: go test ./... -coverpkg=./...
env:
PAT: ${{ secrets.PAT }}

- uses: step-security/wait-for-secrets@084b3ae774c0e0003a9307ae4f487c10f1f998fe
id: wait-for-secrets
with:
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
secrets: |
AWS_ACCESS_KEY_ID_INT:
name: 'AWS access key id'
description: 'Access key id for secure-repo int'
AWS_SECRET_ACCESS_KEY_INT:
name: 'AWS secret access key'
description: 'Secret access key for secure-repo int'
AWS_SESSION_TOKEN_INT:
name: 'AWS session token'
description: 'Session token for secure-repo int'

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df
with:
aws-access-key-id: ${{ steps.wait-for-secrets.outputs.AWS_ACCESS_KEY_ID_INT }}
aws-secret-access-key: ${{ steps.wait-for-secrets.outputs.AWS_SECRET_ACCESS_KEY_INT }}
aws-session-token: ${{ steps.wait-for-secrets.outputs.AWS_SESSION_TOKEN_INT }}
aws-region: us-west-2

- name: Deploy to AWS CloudFormation
uses: aws-actions/aws-cloudformation-github-deploy@33527b83bddcf6b3f0b135d9550bde8475325c73
with:
name: secure-workflow-api-ecr
template: cloudformation/ecr.yml
parameter-overrides: "ResourceName=secure-workflow-api"
no-fail-on-empty-changeset: "1"

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: secure-workflow-api
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

- name: Deploy to AWS CloudFormation
uses: aws-actions/aws-cloudformation-github-deploy@33527b83bddcf6b3f0b135d9550bde8475325c73
with:
name: secure-workflow-api
template: cloudformation/resources.yml
parameter-overrides: >-
ResourceName=secure-workflow-api,
ImageTag=${{ github.sha }},
PAT=${{ secrets.PAT }}
no-fail-on-empty-changeset: "1"


38 changes: 38 additions & 0 deletions .github/workflows/kb-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Knowledge-base Test
on:
push:
branches:
- knowledge-base # to test new KBs

permissions: # added using https://github.com/step-security/secure-workflows
contents: read
concurrency:
group: ${{ github.workflow }}
jobs:
test:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0
with:
allowed-endpoints: >
api.github.com:443
github.com:443
proxy.golang.org:443
sum.golang.org:443
storage.googleapis.com:443
objects.githubusercontent.com:443
golang.org:443
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
with:
go-version: 1.17
- name: Run coverage
run: go test ./... -coverpkg=./... -race -coverprofile=coverage.txt -covermode=atomic
env:
PAT: ${{ secrets.PAT }}
56 changes: 56 additions & 0 deletions .github/workflows/kbanalysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: KBAnalysis
on:
workflow_dispatch:
inputs:
owner:
type: string
description: owner of the missing KB
repo:
type: string
description: repo of the missing KB

permissions:
contents: read

jobs:
Analysis:
runs-on: ubuntu-latest
permissions:
issues: write
contents: write
pull-requests: write

steps:
- name: Harden Runner
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0
with:
egress-policy: audit

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
repository: step-security/secure-repo

- name: KBAnalysis
uses: step-security/secure-workflows/kbanalysis@main
with:
github-token: ${{secrets.PAT}}
owner: ${{inputs.owner}}
repo : ${{inputs.repo}}

- id: get-action
uses: actions/github-script@5d03ada4b0a753e9460b312e61cc4f8fdeacf163
with:
script: |
var id = "${{github.event.issue.title}}".split(' ')[6]
core.setOutput('id', id)

- name: Create Pull Request
uses: peter-evans/create-pull-request@18f7dc018cc2cd597073088f7c7591b9d1c02672
with:
token: ${{secrets.PAT}} # need to use PAT since GITHUB_TOKEN does not initiate workflows
commit-message: "added action-security.yml for ${{inputs.owner}}/${{inputs.repo}}"
title: "[KB] Add GitHub token permissions for ${{inputs.owner}}/${{inputs.repo}}"
branch: "kb-${{inputs.owner}}-${{inputs.repo}}"
base: "knowledge-base"
body: "PR added by kb-analysis workflow"
labels: "knowledge-base"
89 changes: 89 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Cfnrelease

on:
workflow_dispatch:
push:
branches:
- main

permissions: # added using https://github.com/step-security/secure-repo
contents: read

jobs:
publish-test:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
with:
go-version: 1.17

- run: go test ./... -coverpkg=./...
env:
PAT: ${{ secrets.PAT }}

- uses: step-security/wait-for-secrets@084b3ae774c0e0003a9307ae4f487c10f1f998fe
id: wait-for-secrets
with:
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
secrets: |
AWS_ACCESS_KEY_ID:
name: 'AWS access key id'
description: 'Access key id for secure-repo prod'
AWS_SECRET_ACCESS_KEY:
name: 'AWS secret access key'
description: 'Secret access key for secure-repo prod'
AWS_SESSION_TOKEN:
name: 'AWS session token'
description: 'Session token for secure-repo prod'

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df
with:
aws-access-key-id: ${{ steps.wait-for-secrets.outputs.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ steps.wait-for-secrets.outputs.AWS_SECRET_ACCESS_KEY }}
aws-session-token: ${{ steps.wait-for-secrets.outputs.AWS_SESSION_TOKEN }}
aws-region: us-west-2

- name: Deploy to AWS CloudFormation
uses: aws-actions/aws-cloudformation-github-deploy@33527b83bddcf6b3f0b135d9550bde8475325c73
with:
name: secure-workflow-api-ecr
template: cloudformation/ecr.yml
parameter-overrides: "ResourceName=secure-workflow-api"
no-fail-on-empty-changeset: "1"

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: secure-workflow-api
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

- name: Deploy to AWS CloudFormation
uses: aws-actions/aws-cloudformation-github-deploy@33527b83bddcf6b3f0b135d9550bde8475325c73
with:
name: secure-workflow-api
template: cloudformation/resources.yml
parameter-overrides: >-
ResourceName=secure-workflow-api,
ImageTag=${{ github.sha }},
PAT=${{ secrets.PAT }}
no-fail-on-empty-changeset: "1"
Loading
Loading