Skip to content

Commit

Permalink
Scorecard improvements (#949)
Browse files Browse the repository at this point in the history
* build sget image and push for the ci repo

Signed-off-by: Carlos Panato <[email protected]>

* add permissions based on the scorecard report

{
      "details": [
        "Warn: no permission defined: .github/workflows/build.yaml:1",
"Warn: no permission defined:
.github/workflows/codeql-analysis.yml:1"
      ],
      "score": -1,
"reason": "internal error: yaml.Unmarshal: yaml: unmarshal
errors:\n  line 1: cannot unmarshal !!str `-----BE...` into
map[interface {}]interface {}",
      "name": "Token-Permissions",
      "documentation": {
"url":
"https://github.com/ossf/scorecard/blob/6c1c789dc5b05cde492334f57b53807c786b038a/docs/checks.md#token-permissions",
"short": "Determines if the project's workflows follow the
principle of least privilege."
      }
    }

Signed-off-by: Carlos Panato <[email protected]>
  • Loading branch information
cpanato authored Oct 25, 2021
1 parent be6ab36 commit 7e295f1
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ on:
- main
- release-*

permissions: read-all

jobs:
build:
name: build
Expand Down Expand Up @@ -52,3 +54,5 @@ jobs:
run: echo -n "${{secrets.COSIGN_PASSWORD}}" | KO_PREFIX=gcr.io/projectsigstore/cosign/ci make sign-container
- name: cosigned
run: echo -n "${{secrets.COSIGN_PASSWORD}}" | KO_PREFIX=gcr.io/projectsigstore/cosign/ci make sign-cosigned
- name: sget
run: echo -n "${{secrets.COSIGN_PASSWORD}}" | KO_PREFIX=gcr.io/projectsigstore/cosign/ci make sign-sget
2 changes: 2 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ on:
push:
branches: [ main ]

permissions: read-all

jobs:
analyze:
name: Analyze
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/cross.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
- release-*
pull_request:

permissions: read-all

name: Cross
jobs:
sanity-build:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/donotsubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
pull_request:
branches: [ 'main', 'release-*' ]

permissions: read-all

jobs:

donotsubmit:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ name: e2e-tests
# Run on every push, and allow it to be run manually.
on: [push, workflow_dispatch]

permissions: read-all

jobs:
e2e-tests:
# Skip if running in a fork that might not have secrets configured.
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/kind-e2e-cosigned.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ on:
pull_request:
branches: [ 'main', 'release-*' ]

permissions: read-all

jobs:
e2e-tests:
name: e2e tests
runs-on: ubuntu-latest

strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
pull_request:
branches: [ 'main', 'release-*' ]

jobs:
permissions: read-all

jobs:
autoformat:
name: Auto-format and Check
runs-on: ubuntu-latest

strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ on:
branches: ['main', 'release-*']
pull_request:

permissions: read-all

jobs:
unit-tests:
name: Run tests
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/verify-docgen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ on:
branches: ['main', 'release-*']
pull_request:

permissions: read-all

jobs:
docgen:
name: Verify Docgen
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/whitespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
pull_request:
branches: [ 'main', 'release-*' ]

permissions: read-all

jobs:

whitespace:
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ ko:
--tags $(GIT_VERSION) --tags $(GIT_HASH) \
github.com/sigstore/cosign/cmd/cosign/webhook

# sget
KO_DOCKER_REPO=${KO_PREFIX}/sget CGO_ENABLED=0 GOFLAGS="-ldflags=-X=$(PKG).gitCommit=$(GIT_HASH)" ko publish --bare \
--tags $(GIT_VERSION) --tags $(GIT_HASH) \
github.com/sigstore/cosign/cmd/sget

.PHONY: ko-local
ko-local:
# We can't pass more than one LDFLAG via GOFLAGS, you can't have spaces in there.
Expand All @@ -114,6 +119,10 @@ sign-container: ko
sign-cosigned:
cosign sign --key .github/workflows/cosign.key -a GIT_HASH=$(GIT_HASH) ${KO_PREFIX}/cosigned:$(GIT_HASH)

.PHONY: sign-sget
sign-sget:
cosign sign --key .github/workflows/cosign.key -a GIT_HASH=$(GIT_HASH) ${KO_PREFIX}/sget:$(GIT_HASH)

# used when releasing together with GCP CloudBuild
.PHONY: release
release:
Expand Down

0 comments on commit 7e295f1

Please sign in to comment.