Skip to content

Commit

Permalink
Add back the trusty rule_type and an example to profile.yaml (#1488)
Browse files Browse the repository at this point in the history
I'm pretty sure this must have been a bad rebase of commit
20dfa79 which seems to have removed the
trusty rule_type. Oops.

Also let's add an example to profile.yaml
  • Loading branch information
jhrozek authored Nov 5, 2023
1 parent af51955 commit 567530f
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/github/profiles/profile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,11 @@ pull_request:
vulnerability_database_endpoint: https://api.osv.dev/v1/query
package_repository:
url: https://pypi.org/pypi
- type: pr_trusty_check
def:
action: summary
ecosystem_config:
- name: npm
score: 5
- name: pypi
score: 5
50 changes: 50 additions & 0 deletions examples/github/rule-types/pr_trusty_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
version: v1
type: rule-type
name: pr_trusty_check
context:
provider: github
description: Verifies that pull requests do not add any dependencies with low Trusty scores
guidance: |
For every pull request submitted to a repository, this rule will check if the pull request
adds a new dependency with a low Trusty score. If a dependency with a low
score is added, the PR will commented on or even rejected, depending on the configuration.
def:
in_entity: pull_request
rule_schema:
type: object
properties:
action:
type: string
description: "The action to take if a package with a low score is found."
enum:
# the evaluator engine will merely pass on an error, marking the profile as failed if a packages with low scores is found
- profile_only
# the evaluator engine will add a single summary comment with a table listing the packages with low scores found
- summary
default: review
ecosystem_config:
type: array
description: "The configuration for the ecosystems to check."
items:
type: object
properties:
name:
type: string
description: "The name of the ecosystem to check. Currently only `npm` and `pypi` are supported."
pi_threshold:
type: number
description: "The minimum Trusty score for a dependency to be considered safe."
default: 5
ingest:
type: diff
diff:
ecosystems:
- name: npm
depfile: package-lock.json
- name: pypi
depfile: requirements.txt
# Defines the configuration for evaluating data ingested against the given profile
eval:
type: trusty
trusty: {}

0 comments on commit 567530f

Please sign in to comment.