Commit Graph

2551 Commits

Author SHA1 Message Date
Felix Hoeborn
21d53ce28c
Added probe for permissive licenses (#3838)
* Added check for permissive licenses

Signed-off-by: Felix Hoeborn <f.hoeborn@gmail.com>

* Regenerated docs and added more permissive licenses to check

Signed-off-by: Felix Hoeborn <f.hoeborn@gmail.com>

* Added e2e tests

Signed-off-by: Felix Hoeborn <f.hoeborn@gmail.com>

* Corrected copyright dates and missing newlines

Signed-off-by: Felix Hoeborn <f.hoeborn@gmail.com>

* Corrected copyright dates

Signed-off-by: Felix Hoeborn <f.hoeborn@gmail.com>

* Adjustments after review

Signed-off-by: Felix Hoeborn <f.hoeborn@gmail.com>

* Added file location in case a permissive license was found and adjusted tests

Signed-off-by: Felix Hoeborn <f.hoeborn@gmail.com>

* Removed code for check, adjusted probe code to be invocated independently

Signed-off-by: Felix Hoeborn <f.hoeborn@gmail.com>

* add remediate on outcome detail

Signed-off-by: Spencer Schrock <sschrock@google.com>

* avoid memory aliasing

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Felix Hoeborn <f.hoeborn@gmail.com>
Signed-off-by: Felix Hoeborn <98820380+fhoeborn@users.noreply.github.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Co-authored-by: Spencer Schrock <sschrock@google.com>
2024-04-11 23:07:35 -07:00
Adam Harvey
b77f248ff6
🌱 Bump CodeQL Action version to 3.24.10 and remove whitespace (#3972)
* 🌱 Remove whitespace

Signed-off-by: Adam Harvey <33203301+adamdmharvey@users.noreply.github.com>

* 🌱 Bump CodeQL Action version manually

Signed-off-by: Adam Harvey <33203301+adamdmharvey@users.noreply.github.com>

* 🌱 Bump CodeQL Action to v3.x series

Signed-off-by: Adam Harvey <33203301+adamdmharvey@users.noreply.github.com>

* chore(ci): Bump to latest CodeQL action hash/version

Signed-off-by: Adam Harvey <33203301+adamdmharvey@users.noreply.github.com>

---------

Signed-off-by: Adam Harvey <33203301+adamdmharvey@users.noreply.github.com>
2024-04-12 05:28:34 +00:00
Spencer Schrock
96452d99ab
📖 Review and update some probe documentation (#4023)
* polish some probe yaml definitions

Signed-off-by: Spencer Schrock <sschrock@google.com>

* update references to probe naming and outcomes

now that #3654 is addressed, the naming restrictions can be relaxed.

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-04-11 22:08:55 -07:00
Spencer Schrock
856419158a
🌱 migrate code review check to probes (#3979)
* initial conversion

Signed-off-by: Spencer Schrock <sschrock@google.com>

* appease the linter

Signed-off-by: Spencer Schrock <sschrock@google.com>

* cleanup outcomes from positive/negative to true/false conversion

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-04-10 15:43:12 -07:00
Spencer Schrock
99a6dc4ea2
🌱 Ensure Token-Permission and Branch-Protection probes use exported value keys (#3977)
* use exported value keys for token permissions

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert required reviewer count to use exported value key

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-04-10 14:40:55 -07:00
Spencer Schrock
6b071eddeb
⚠️ Allow probes to specify their own bad outcomes (#4020)
* merge probe and finding packages

No one interacts with the probes directly,
and having them in the same package helps with follow up commits

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add extra field to indicate the outcome a probe should show remediation for

Signed-off-by: Spencer Schrock <sschrock@google.com>

* start all probes with remediate on 'False'

Signed-off-by: Spencer Schrock <sschrock@google.com>

* make OutcomeTrue bad for hasOSVVulnerabilities

Signed-off-by: Spencer Schrock <sschrock@google.com>

* nest outcome trigger under remediation in yaml

Signed-off-by: Spencer Schrock <sschrock@google.com>

* invert outcomes for dangerous workflow probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* rename notArchived probe to archived

with the swap, the true outcome is now the bad outcome.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* rename notCreatedRecently probe to createRecently

with the rename, the true outcome is now bad

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch binary artifact probes so detecting binaries is a true outcome

Signed-off-by: Spencer Schrock <sschrock@google.com>

* appease the linter

Signed-off-by: Spencer Schrock <sschrock@google.com>

* dont export probe type

we can always make it public again later

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-04-10 14:12:53 -07:00
Spencer Schrock
a220b48096
⚠️ Delegate logging decisions to the checks instead of a helper (#4019)
* add func to log single finding at caller specified level.

This may not be the final form, we may support want to support
passing a map of probe+outcome to level mappings.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch dependency update tool check off LogFindings

For now, we only use one probe so logging is simple.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch fuzzing check off LogFindings

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch packaging check off LogFindings

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch security policy check off LogFindings

This changes the logging of an error state, but it's not one we expect to see.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch signed releases off LogFindings

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch license check off LogFindings

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch vuln check off LogFindings

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch maintained check off logfindings and delete it

Signed-off-by: Spencer Schrock <sschrock@google.com>

* dont log lack of commit or issue activity

scdiff caught a lot of new details being generated.
So going to try removing them

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-04-09 15:09:40 -07:00
Spencer Schrock
775fc97e3d
⚠️ remove rule.Remediation and switch users to probe.Remediation (#3978)
probes were initially called rules, so deleted rule and switched
usages to probe.

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-04-09 13:28:15 -07:00
Spencer Schrock
b577d79c96
⚠️ Replace Positive and Negative outcomes with True and False (#4017)
* rename positive to true

Signed-off-by: Spencer Schrock <sschrock@google.com>

* rename negative to false

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-04-08 15:36:11 -07:00
Spencer Schrock
ba4fb1b94b
⚠️ Switch Outcome type to string (#4006)
* convert outcome constants to strings

Originally, these were introduced as ints to enable ordering between them.
Today, I don't see the value in doing that, and it makes the output less readable.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* explicitly mention negative outcome for some tests

previously, OutcomeNegative had the integer value of 0. So some tests
didnt specify the outcome and happened to pass due to the zero value.
This also fixes the tests names while I was here.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* match expected probe output with new string values

this change demonstrates the reason for this PR.
Human readable outcomes are good!

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-04-08 16:31:39 +00:00
dependabot[bot]
d61c9aa11f
🌱 Bump golang from 1.22.1 to 1.22.2 (#4012) 2024-04-08 15:54:36 +00:00
Spencer Schrock
4c6d0e53a3
📖 revert PAT scope change and document Go resources (#4003)
* undo pat scope doc change

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add Go resources

some contributors may be unfamiliar with the language

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-04-08 08:37:04 -07:00
dependabot[bot]
b118c1950f
🌱 Bump github.com/xanzy/go-gitlab from 0.101.0 to 0.102.0 (#4005) 2024-04-05 18:11:56 +00:00
Spencer Schrock
76a9b0470a
⚠️ Only include probes which ran for probe format (#3991)
* add findings to check results struct

these dont make it to the JSON output format as theyre
not copied to the jsonCheckResultV2 struct in AsJSON2()

Signed-off-by: Spencer Schrock <sschrock@google.com>

* populate CheckResult findings

It would be nice if the evaluation functions did this for us,
but would require changes to theCreate*ScoreResult functions.
It was simpler just to set it in one place at the check level.

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-04-04 14:43:30 -07:00
Spencer Schrock
aeaee6099e
📖 Review and update CONTRIBUTING.md (#4002)
* feature dco requirement more prominently

Signed-off-by: Spencer Schrock <sschrock@google.com>

* recommend merge commits to sync PR

Signed-off-by: Spencer Schrock <sschrock@google.com>

* fix make target table

Signed-off-by: Spencer Schrock <sschrock@google.com>

* remove references to old Go environment variables

GO111MODULE is no longer used as of Go 1.17.
GOPATH is still used for other purposes, but not in 'development mode'.
https://go.dev/wiki/GOPATH

Signed-off-by: Spencer Schrock <sschrock@google.com>

* misc minor clarifications

Signed-off-by: Spencer Schrock <sschrock@google.com>

* remove reference to errors from CONTRIBUTORS.md

I don't think this is one of the top things we should be displaying to someone

Signed-off-by: Spencer Schrock <sschrock@google.com>

* mention make in environment

Signed-off-by: Spencer Schrock <sschrock@google.com>

* no scopes needed for PATs

Signed-off-by: Spencer Schrock <sschrock@google.com>

* highlight other scorecard options

Signed-off-by: Spencer Schrock <sschrock@google.com>

* allow shell codeblocks to be pasted into a shell

the comment style was wrong and the $ was interpretted as a command.

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-04-04 12:52:11 -07:00
dependabot[bot]
605feb7fd2
🌱 Bump github.com/goreleaser/goreleaser in /tools (#4001)
Bumps [github.com/goreleaser/goreleaser](https://github.com/goreleaser/goreleaser) from 1.24.0 to 1.25.1.
- [Release notes](https://github.com/goreleaser/goreleaser/releases)
- [Changelog](https://github.com/goreleaser/goreleaser/blob/main/.goreleaser.yaml)
- [Commits](https://github.com/goreleaser/goreleaser/compare/v1.24.0...v1.25.1)

---
updated-dependencies:
- dependency-name: github.com/goreleaser/goreleaser
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-04 11:02:16 -04:00
dependabot[bot]
d58bfb03aa
🌱 Bump the github-actions group with 6 updates (#3985)
Updates the requirements on [actions/checkout](https://github.com/actions/checkout), [github/codeql-action](https://github.com/github/codeql-action), [actions/dependency-review-action](https://github.com/actions/dependency-review-action), [actions/cache](https://github.com/actions/cache), [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator) and [slsa-framework/slsa-verifier](https://github.com/slsa-framework/slsa-verifier) to permit the latest version.

Updates `actions/checkout` from 4.1.1 to 4.1.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](b4ffde65f4...9bb56186c3)

Updates `github/codeql-action` to cdcdbb579706841c47f7063dda365e292e5cad7a
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](cdcdbb5797)

Updates `actions/dependency-review-action` from 4.1.3 to 4.2.5
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](9129d7d40b...5bbc3ba658)

Updates `actions/cache` from 4.0.1 to 4.0.2
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](ab5e6d0c87...0c45773b62)

Updates `slsa-framework/slsa-github-generator` from 1.9.0 to 1.10.0
- [Release notes](https://github.com/slsa-framework/slsa-github-generator/releases)
- [Changelog](https://github.com/slsa-framework/slsa-github-generator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/slsa-framework/slsa-github-generator/compare/v1.9.0...v1.10.0)

Updates `slsa-framework/slsa-verifier` from 2.4.1 to 2.5.1
- [Release notes](https://github.com/slsa-framework/slsa-verifier/releases)
- [Changelog](https://github.com/slsa-framework/slsa-verifier/blob/main/RELEASE.md)
- [Commits](https://github.com/slsa-framework/slsa-verifier/compare/v2.4.1...v2.5.1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action
  dependency-type: direct:production
  dependency-group: github-actions
- dependency-name: actions/dependency-review-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: slsa-framework/slsa-github-generator
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: slsa-framework/slsa-verifier
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-01 14:27:31 -07:00
dependabot[bot]
4779feb979
🌱 Bump github.com/onsi/ginkgo/v2 in /tools (#3970) 2024-04-01 20:30:10 +00:00
dependabot[bot]
6d488c0410
🌱 Bump github.com/bradleyfalzon/ghinstallation/v2 (#3975) 2024-04-01 20:09:15 +00:00
dependabot[bot]
bcaef6d34e
🌱 Bump github.com/go-git/go-git/v5 from 5.11.0 to 5.12.0 (#3984) 2024-04-01 19:29:04 +00:00
dependabot[bot]
6ae6472698
🌱 Bump cloud.google.com/go/bigquery from 1.59.1 to 1.60.0 (#3980)
Bumps [cloud.google.com/go/bigquery](https://github.com/googleapis/google-cloud-go) from 1.59.1 to 1.60.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/bigquery/v1.59.1...spanner/v1.60.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/bigquery
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-01 11:30:42 -04:00
Spencer Schrock
46eea0eeaf
🌱 Fix pinsDependencies outcomes (#3961)
* switch no dependencies to OutcomeNotApplicable

OutcomeNotApplicable is what we've been using for cases where there are no occurences of X.
Previously this outcome was used for this probe to handle some error cases, but
OutcomeError is currently being used. Existing callers were moved to OutcomeNotSupported.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* deduplicate location setting

checker.File.Location() is nil safe, so this should work when we have a location or not

Signed-off-by: Spencer Schrock <sschrock@google.com>

* update outcome descriptions

Signed-off-by: Spencer Schrock <sschrock@google.com>

* simplify OutcomeNotSupported logging path

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add tests for no deps and processing errors

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-03-29 21:58:28 +00:00
dependabot[bot]
2a45ba6cf6
🌱 Bump github.com/golangci/golangci-lint in /tools (#3982)
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.57.1 to 1.57.2.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/golangci/golangci-lint/compare/v1.57.1...v1.57.2)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-29 14:38:36 -07:00
Spencer Schrock
46bb36ab10
🌱 Combine Dependency-Update-Tool probes into one (#3981)
* add single probe for dependencyUpdateToolConfigured probe

Signed-off-by: Spencer Schrock <sschrock@google.com>

* delete individual update tool probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* use new update tool probe in evaluation

Signed-off-by: Spencer Schrock <sschrock@google.com>

* fix dependency update tool tests

The old test names were unclear, and didn't cover all supported tools.
Additionally the warn count changed since there's only one probe now,
instead of 3.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* clarify test name

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-03-28 15:18:56 -07:00
dependabot[bot]
153e06d99f
🌱 Bump github.com/onsi/ginkgo/v2 from 2.16.0 to 2.17.1 (#3974)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.16.0 to 2.17.1.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.16.0...v2.17.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-26 19:25:05 +00:00
Spencer Schrock
11e859fc58
🌱 Combine hasLicenseFile and hasLicenseFileAtTopDir probes (#3955)
* delete hasLicenseFileAtTopDir probe

Signed-off-by: Spencer Schrock <sschrock@google.com>

* increase value of having a license

the old split was 6 for having a license and 3 for having it in the expected location
but 1.5 years later, and there is still no other way we detect it. So it was effectively
worth 9 points. This change makes it actually worth 9 points.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* simplify logging and scoring

Signed-off-by: Spencer Schrock <sschrock@google.com>

* ensure license findings have locations

Signed-off-by: Spencer Schrock <sschrock@google.com>

* update tests to reflect new logging

Signed-off-by: Spencer Schrock <sschrock@google.com>

* match existing detail better

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-03-26 18:27:57 +00:00
dependabot[bot]
be15709929
🌱 Bump github.com/xanzy/go-gitlab from 0.99.0 to 0.101.0 (#3973) 2024-03-26 17:59:52 +00:00
dependabot[bot]
bf18c27508
🌱 Bump github.com/golangci/golangci-lint from 1.56.2 to 1.57.1 in /tools (#3966)
* 🌱 Bump github.com/golangci/golangci-lint in /tools

Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.56.2 to 1.57.1.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/golangci/golangci-lint/compare/v1.56.2...v1.57.1)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* remove unused wrapcheck nolint directives

wrapcheck v2.8.3 includes a fix for false positives in func literals.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* satisfy assignOp gocritic linter

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert const regex to MustCompile

included at package level to ensure regex compiles at build time.
These could stay as func regexes if desired, but we'd need test coverage
for the piper code so we know we wont panic

Signed-off-by: Spencer Schrock <sschrock@google.com>

* satisfy unslice linter

Signed-off-by: Spencer Schrock <sschrock@google.com>

* satisfy wrapperFunc linter

This seems like a nice readability change anyway

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Spencer Schrock <sschrock@google.com>
2024-03-25 15:56:22 -07:00
dependabot[bot]
deced313db
🌱 Bump github.com/onsi/gomega from 1.31.1 to 1.32.0 (#3964) 2024-03-25 21:37:29 +00:00
dependabot[bot]
92168c767a
🌱 Bump github.com/docker/docker in /tools (#3960) 2024-03-25 21:18:46 +00:00
dependabot[bot]
b379817680
🌱 Bump gocloud.dev from 0.36.0 to 0.37.0 (#3963) 2024-03-25 20:58:27 +00:00
Diogo Teles Sant'Anna
376ee1f4d3
⚠️ rename fields on Branch Protection Pull Request rules (#3879)
Signed-off-by: Diogo Teles Sant'Anna <diogoteles@google.com>
2024-03-25 11:16:59 -07:00
Spencer Schrock
e780e089f5
🌱 polish scorecard workflow for use as example workflow (#3969)
This updates the version comments, adds some explanatory comments,
and generally makes it better. The intent is to use this file as an example
for the Scorecard Action repo so it remains up-to-date.

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-03-22 11:14:57 -07:00
AdamKorcz
5b0ae81d49
🌱 migrate token permission check to probes (#3816)
* 🌱 migrate token permission check to probes

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* combine seperate write-probes into two that combine them all

Signed-off-by: AdamKorcz <adam@adalogics.com>

* change write probes to read and write

Signed-off-by: AdamKorcz <adam@adalogics.com>

* minor nit

Signed-off-by: AdamKorcz <adam@adalogics.com>

* remove WritaAll probes

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* Merge read-perm probe with job/top probes

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* minor refactoring

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* fix copy paste error

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* fix linter issues and restructure code

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* remove hasGitHubWorkflowPermissionNone probe

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* Remove 'hasGitHubWorkflowPermissionUndeclared' probe

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* bit of clean up

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* reduce code complexity and remove comment

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* simplify file location

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* change probe text

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* invert name of probe

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* OutcomeNotApplicable -> OutcomeError

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* OutcomeNotAvailable -> OutcomeNotApplicable

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* more OutcomeNotAvailable -> OutcomeNotApplicable

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* change name of 'notAvailableOrNotApplicable'

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* fix linter issues

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* add comments to remediation fields

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* add check for nil-dereference

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* remove the permissionLocation finding value

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* rename checkAndLogNotAvailableOrNotApplicable to isBothUndeclaredAndNotAvailableOrNotApplicable

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* use raw metadata for remediation output

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* change 'branch' to 'defaultBranch'

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* remove unused fields in rule Remediation

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* fix remediation

Signed-off-by: Adam Korczynski <adam@adalogics.com>

* change 'metadata.defaultBranch' to 'metadata.repository.defaultBranch'

Signed-off-by: Adam Korczynski <adam@adalogics.com>

---------

Signed-off-by: Adam Korczynski <adam@adalogics.com>
Signed-off-by: AdamKorcz <adam@adalogics.com>
2024-03-22 10:38:02 -07:00
dependabot[bot]
c1066d9ac2
🌱 Bump github.com/moby/buildkit from 0.12.5 to 0.13.1 (#3951)
Bumps [github.com/moby/buildkit](https://github.com/moby/buildkit) from 0.12.5 to 0.13.1.
- [Release notes](https://github.com/moby/buildkit/releases)
- [Commits](https://github.com/moby/buildkit/compare/v0.12.5...v0.13.1)

---
updated-dependencies:
- dependency-name: github.com/moby/buildkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-20 23:46:54 +00:00
dependabot[bot]
da798b6523
🌱 Bump github.com/google/osv-scanner from 1.6.2 to 1.7.1 (#3958)
* 🌱 Bump github.com/google/osv-scanner from 1.6.2 to 1.7.1

Bumps [github.com/google/osv-scanner](https://github.com/google/osv-scanner) from 1.6.2 to 1.7.1.
- [Release notes](https://github.com/google/osv-scanner/releases)
- [Changelog](https://github.com/google/osv-scanner/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/osv-scanner/compare/v1.6.2...v1.7.1)

---
updated-dependencies:
- dependency-name: github.com/google/osv-scanner
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* remove toolchain directive

Signed-off-by: Spencer Schrock <sschrock@google.com>

* bump vulnerable package so PR can merge

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Spencer Schrock <sschrock@google.com>
2024-03-20 23:26:56 +00:00
dependabot[bot]
2324040089
🌱 Bump github.com/onsi/ginkgo/v2 in /tools (#3952)
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.16.0 to 2.17.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.16.0...v2.17.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-20 16:03:11 -07:00
Spencer Schrock
b3ad602a59
🌱 Add probe registration mechanism (#3876)
* add basic probe registration function

Signed-off-by: Spencer Schrock <sschrock@google.com>

* ignore probes which call init to register the probe

Signed-off-by: Spencer Schrock <sschrock@google.com>

* redefine probeimpl to avoid circular imports

Signed-off-by: Spencer Schrock <sschrock@google.com>

* register all probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* experiment with a probe struct

Signed-off-by: Spencer Schrock <sschrock@google.com>

* make check name constants

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert branch protection probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert binary artifact probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert cii probe

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert ci test probe

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert code review probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert contributor probe

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert dangerous workflow probe

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert dep update tool probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert fuzzing probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert license probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert maintained probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert packaging probe

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert sast probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert security policy probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert signed releases probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert vuln probe

Signed-off-by: Spencer Schrock <sschrock@google.com>

* try using probe registration data

Signed-off-by: Spencer Schrock <sschrock@google.com>

* blank import unused probe

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add uncategorized group

Signed-off-by: Spencer Schrock <sschrock@google.com>

* ensure All list is up-to-date

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add reason behind uncategorized group

Signed-off-by: Spencer Schrock <sschrock@google.com>

* fix linter yaml parse error

Signed-off-by: Spencer Schrock <sschrock@google.com>

* fix linter

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add webhook data

Signed-off-by: Spencer Schrock <sschrock@google.com>

* convert probe registration to Must pattern

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add registration for new probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add missing license header

Signed-off-by: Spencer Schrock <sschrock@google.com>

* revert changing wrapcheck linter config

Signed-off-by: Spencer Schrock <sschrock@google.com>

* use error func which doesnt need wrapped

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add test for probe registration

Signed-off-by: Spencer Schrock <sschrock@google.com>

* restore trailing newline

Signed-off-by: Spencer Schrock <sschrock@google.com>

* order probe category list

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-03-19 13:10:11 -07:00
dependabot[bot]
2c02d4b816
🌱 Bump google.golang.org/protobuf from 1.32.0 to 1.33.0 (#3927)
Bumps google.golang.org/protobuf from 1.32.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-19 09:27:53 -07:00
Spencer Schrock
8791d483e9
🌱 Cleanup branch protection tests (#3932)
* switch to helper func

done using a find/replace regex

Signed-off-by: Spencer Schrock <sschrock@google.com>

* use constants for branch names

Signed-off-by: Spencer Schrock <sschrock@google.com>

* replace branch name with constants

Signed-off-by: Spencer Schrock <sschrock@google.com>

* handle findings with values needed

Signed-off-by: Spencer Schrock <sschrock@google.com>

* use requiresApproversForPullRequests constants

Signed-off-by: Spencer Schrock <sschrock@google.com>

* shorter to just use main instead of a const

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-03-15 01:13:18 +00:00
Spencer Schrock
1d1df07770
Add experimental local OSV mode for cron releasetest worker (#3947)
* add local osv db client

Signed-off-by: Spencer Schrock <sschrock@google.com>

* enable osv experiment in cron release test

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-03-15 11:46:09 +11:00
Naveen
1bd4af7fa5
🐛 ignore .git folder for localdir (#3943)
- ignore .git folder for localdir

Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
2024-03-13 07:45:35 -05:00
Spencer Schrock
bfc8f37fef
🌱 Bump golang from 1.22.0 to 1.22.1 (#3941)
Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-03-12 03:44:15 +00:00
afmarcum
af155611a2
📖 Add survey announcement to readme (#3942)
* Add survey announcement to readme

Signed-off-by: afmarcum <138055109+afmarcum@users.noreply.github.com>

* Update README.md

Co-authored-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: afmarcum <138055109+afmarcum@users.noreply.github.com>

---------

Signed-off-by: afmarcum <138055109+afmarcum@users.noreply.github.com>
Co-authored-by: Spencer Schrock <sschrock@google.com>
2024-03-11 23:41:32 +00:00
Spencer Schrock
f1e703f500
🌱 Combine fuzzing probes (#3877)
* single fuzz probe boilerplate

Signed-off-by: Spencer Schrock <sschrock@google.com>

* initial implementation

Signed-off-by: Spencer Schrock <sschrock@google.com>

* connect fuzzing probe to eval code

Signed-off-by: Spencer Schrock <sschrock@google.com>

* include fuzzer name as tool

Signed-off-by: Spencer Schrock <sschrock@google.com>

* connect to probes flag

Signed-off-by: Spencer Schrock <sschrock@google.com>

* remove old probes from list

Signed-off-by: Spencer Schrock <sschrock@google.com>

* remove old probes

Signed-off-by: Spencer Schrock <sschrock@google.com>

* fix failing test

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add tool value to test

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add fuzz tool helper

Signed-off-by: Spencer Schrock <sschrock@google.com>

* specify supported tools

Signed-off-by: Spencer Schrock <sschrock@google.com>

* update e2e test

Signed-off-by: Spencer Schrock <sschrock@google.com>

* check for no raw data

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add basic tests

Signed-off-by: Spencer Schrock <sschrock@google.com>

* add test to ensure fuzzer location is propagated

Signed-off-by: Spencer Schrock <sschrock@google.com>

* expand detailed tests to include other info like tool value

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-03-11 02:50:45 +00:00
dependabot[bot]
e1f54831df
🌱 Bump gopkg.in/go-jose/go-jose.v2 in /tools (#3930)
Bumps gopkg.in/go-jose/go-jose.v2 from 2.6.1 to 2.6.3.

---
updated-dependencies:
- dependency-name: gopkg.in/go-jose/go-jose.v2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-07 23:07:31 +00:00
Spencer Schrock
f401d794df
🐛 Avoid reading every file searching for sonar configs (#3929)
* use reader instead of contents

if the filename doesn't match we don't use the file content.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* compare bytes to avoid allocations

we don't save the line, just the offset.
using the bytes versions avoids allocating new strings

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-03-07 19:19:27 +00:00
dependabot[bot]
db234bb9ab
🌱 Bump github.com/onsi/ginkgo/v2 in /tools (#3921) 2024-03-07 17:46:06 +00:00
dependabot[bot]
2aef57de7f
🌱 Bump github.com/onsi/ginkgo/v2 from 2.15.0 to 2.16.0 (#3918) 2024-03-06 23:04:53 +00:00
dependabot[bot]
c3f2f131ec
🌱 Bump github.com/xanzy/go-gitlab from 0.98.0 to 0.99.0 (#3919) 2024-03-06 22:43:32 +00:00