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}}
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"
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.3
hooks:
- id: gitleaks
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.38.0
hooks:
- id: eslint
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Loading