sig-security icon indicating copy to clipboard operation
sig-security copied to clipboard

[govulncheck] Periodic Prow Job for `govulncheck`

Open PushkarJ opened this issue 2 years ago • 5 comments
trafficstars

Description

Run govulncheck periodically in default mode symbol level on https://github.com/kubernetes/kubernetes for:

  • master branch i.e. HEAD
  • release-1.stable-version
  • release-1.prev-stable-minor-version
  • release-1.oldest-stable-minor-version

This will allow to get a sense of new vulnerabilities identified and help facilitate decision on cherry picks

Implementation Details

Create a new yaml file here: https://github.com/kubernetes/test-infra/tree/0e5705d1a7cfe4c0ba8e2518a15c26f8ebc1b66d/config/jobs/kubernetes/sig-security named as govulncheck-periodic.yaml that looks something like this:

periodics:
  - interval: 6h
    name: check-dependency-stats-periodical
    decorate: true
    decoration_config:
      timeout: 5m
    extra_refs:
    - org: kubernetes
      repo: kubernetes
      base_ref: master
      path_alias: k8s.io/kubernetes
    spec:
      containers:
      - image: golang
        command:
        - /bin/bash
        args:
        - -c
    spec:
      containers:
      - image: golang
        command:
        - /bin/bash
        args:
        - -c
        - |
          set -euo pipefail
          export WORKDIR=${ARTIFACTS:-$TMPDIR}
          export PATH=$PATH:$GOPATH/bin
          mkdir -p "${WORKDIR}"
          pushd "$WORKDIR"
          go install golang.org/x/vuln/cmd/govulncheck@latest
          popd
          
          govulncheck -scan module ./... > "${WORKDIR}/head.txt"
          
          stable=$(curl -Ls https://dl.k8s.io/release/stable.txt)
          minorversion=$(echo $stable | cut -d. -f2)
          prevminorversion=$(expr $minorversion - 1)
          oldestminorversion=$(expr $prevminorversion - 1)
          
          b1=$(echo "release-1.${minorversion}")
          b2=$(echo "release-1.${prevminorversion}")
          b3=$(echo "release-1.${oldestminorversion}")
          git reset --hard HEAD
          git checkout $b1
          govulncheck -scan module ./... > "${WORKDIR}/b1.txt"
          git reset --hard HEAD
          git checkout $b2
          govulncheck -scan module ./... > "${WORKDIR}/b2.txt"
          git reset --hard HEAD
          git checkout $b3
          govulncheck -scan module ./... > "${WORKDIR}/b3.txt"
          for file in *.txt; do if [ -s $file ]; then cat *.txt; exit -1; fi; done
  annotations:
    testgrid-create-test-group: "true"
    testgrid-dashboards: sig-security-govulncheck-periodics
    description: Runs `govulncheck` periodically on master and supported release branches

Tips and Caveats

  • Check which directory the script is running in when any errors show up
  • Use prow jobs like this one as reference: https://prow.k8s.io/view/gs/kubernetes-jenkins/logs/check-dependency-stats-periodical/1696290069356220416 and https://prow.k8s.io/view/gs/kubernetes-jenkins/logs/ci-kubernetes-snyk-master/1696294096638840832

Parent

#95

PushkarJ avatar Aug 28 '23 22:08 PushkarJ

/sig security architecture release /area dependency

PushkarJ avatar Aug 28 '23 22:08 PushkarJ

/assign

ArkaSaha30 avatar Aug 31 '23 15:08 ArkaSaha30

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 27 '24 09:01 k8s-triage-robot

/remove-lifecycle stale

This is planned to be worked on soon

PushkarJ avatar Jan 28 '24 23:01 PushkarJ

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Apr 28 '24 00:04 k8s-triage-robot

Relevant slack conversation: https://kubernetes.slack.com/archives/C01CUSVMHPY/p1716151527074909

PushkarJ avatar May 21 '24 23:05 PushkarJ

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Jun 25 '24 03:06 k8s-triage-robot

Periodics are running for master / HEAD, v1.30, v1.29, v1.28 and v1.27. They are working for master , v1.30 and v1.29. Added a backport fix for v1.28: https://github.com/kubernetes/kubernetes/pull/125772 to maintain n-2 support of releases. Once that is merged and once release team agrees that v1.27 backport is needed or not, we will be done with the work needed to close this issue :)

Big thanks to @ArkaSaha30 for taking this forward to where it is today!

PushkarJ avatar Jun 27 '24 21:06 PushkarJ

remove-lifecycle rotten

PushkarJ avatar Jun 27 '24 21:06 PushkarJ

/remove-lifecycle rotten

PushkarJ avatar Jun 27 '24 21:06 PushkarJ

With https://github.com/kubernetes/kubernetes/issues/125772 merged we can mark this issue as closed (complete)

Any future patch version upgrades to govulncheck do not need an issue but any minor (breaking only) and major version upgrade it is recommended to discuss it in an issue before opening a PR.

/close

PushkarJ avatar Jul 09 '24 00:07 PushkarJ

@PushkarJ: Closing this issue.

In response to this:

With https://github.com/kubernetes/kubernetes/issues/125772 merged we can mark this issue as closed (complete)

Any future patch version upgrades to govulncheck do not need an issue but any minor (breaking only) and major version upgrade it is recommended to discuss it in an issue before opening a PR.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Jul 09 '24 00:07 k8s-ci-robot