You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add support for Python poetry.lock files (#9)
* feat: add support for Python poetry.lock files
* style: format Python files with black and isort
* style: adhere to yamllint and format action.yml
* style: adhere to markdownlint and format README
* docs: update README for 1.4.1 release
* refactor: update action.yml dependencies and format
* build: Ensure each dependent action is pinned to the latest major version tag
* style: correct for basic Python linting issues
* style: format and cleanup analyze.py
* style: provide descriptive step names in action.yml
Copy file name to clipboardExpand all lines: README.md
+39-26Lines changed: 39 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,26 @@
1
1
# phylum-analyze-pr-action
2
2
A GitHub Action to automatically analyze Pull Requests for changes to package manager lockfiles using Phylum.
3
3
4
-
Phylum provides a complete risk analyis of "open-source packages" (read: untrusted software from random Internet strangers). Phylum evolved forward from legacy SCA tools to defend from supply-chain malware, malicious open-source authors, and engineering risk, in addtion to software vulnerabilities and license risks. To learn more, please see [our website](https://phylum.io)
4
+
Phylum provides a complete risk analyis of "open-source packages" (read: untrusted software from random Internet
5
+
strangers). Phylum evolved forward from legacy SCA tools to defend from supply-chain malware, malicious open-source
6
+
authors, and engineering risk, in addtion to software vulnerabilities and license risks. To learn more, please see
7
+
[our website](https://phylum.io)
5
8
6
-
This action enables users to configure thresholds for each of Phylum's five risk domain scores. If a package risk domain score is below the threshold, the action will fail the check on the pull request. When packages fail the risk analysis, a comment is created on the PR to summarize the issues.
9
+
This action enables users to configure thresholds for each of Phylum's five risk domain scores. If a package risk
10
+
domain score is below the threshold, the action will fail the check on the pull request. When packages fail the risk
11
+
analysis, a comment is created on the PR to summarize the issues.
7
12
8
13
## Features
9
14
- configurable risk domain thresholds
10
-
- uses [peter-evans/create-or-update-comment](https://github.com/marketplace/actions/create-or-update-comment) to add comments to PRs
1. Create a workflow in a repository that uses the workflow definition listed below as an example.
14
-
2. Be sure to include the base branches you use for development, the defaults are set to `master` and `main`.
15
-
3. Define risk domain thresholds using `vul_threshold`, `mal_threshold`, etc to define a score requirement. A Phylum project score requirement of 60 is defined as `0.6`, for example.
19
+
1. Create a workflow in a repository that uses the workflow definition listed below as an example
20
+
2. Be sure to include the base/default branches used for development, where the defaults are set to `master` and `main`
21
+
3. Define risk domain thresholds using `vul_threshold`, `mal_threshold`, etc. to define a score requirement
22
+
1. For example, a Phylum project score requirement of 60 is defined as `0.6`
23
+
4. Additional inputs can be used - see [action.yml](action.yml) for full list
16
24
17
25
```yaml
18
26
on:
@@ -26,9 +34,9 @@ jobs:
26
34
runs-on: ubuntu-latest
27
35
name: A job to analyze PR with phylum
28
36
steps:
29
-
- uses: actions/checkout@v2
37
+
- uses: actions/checkout@v3
30
38
- id: analyze-pr-test
31
-
uses: phylum-dev/phylum-analyze-pr-action@v1.4
39
+
uses: phylum-dev/phylum-analyze-pr-action@v1
32
40
with:
33
41
vul_threshold: 0.6
34
42
mal_threshold: 0.6
@@ -39,34 +47,39 @@ jobs:
39
47
```
40
48
41
49
### Supported lockfiles
42
-
- requirements.txt (Python PyPI)
43
-
- package-lock.json (JavaScript/TypeScript NPM)
44
-
- yarn.lock (JavaScript/TypeScript NPM)
45
-
- Gemfile.lock (Ruby Rubygems/Bundler)
50
+
- `requirements.txt` (Python PyPI)
51
+
- `poetry.lock`(Python PyPI)
52
+
- `package-lock.json`(JavaScript/TypeScript NPM)
53
+
- `yarn.lock`(JavaScript/TypeScript NPM)
54
+
- `Gemfile.lock`(Ruby Rubygems/Bundler)
46
55
47
56
### Requirements
48
57
- active Phylum account ([Register here](https://app.phylum.io/auth/registration))
1. Ensure you've updated the Phylum CLI on a local installation to a version >= `1.2.0`
51
-
2. Successfully authenticate using Phylum CLI. This will ensure the token is populated in the phylum config file `~/.phylum/settings.yaml` in stanza `offline_access`
52
-
3. Copy the token value in the `offline_access` stanza
53
-
4. Create a new GitHub secret in the desired repository. This can be done through the GitHub web UI or using the gh command line tool: `gh secret set PHYLUM_TOKEN -b <token_value>`
54
-
5. Optionally, you can remove the vestigial `PHYLUM_USER` and `PHYLUM_PASS` GitHub secrets as they are no longer used.
55
-
- concrete package versions (only applicable for requirements.txt)
1. Ensure you've updated the Phylum CLI on a local installation to a version >= `2.0.1`
60
+
2. Successfully authenticate using Phylum CLI to ensure the token is populated and correct
61
+
3. Copy the token value from the output of the `phylum auth token` command
62
+
4. Create a new GitHub secret named `PHYLUM_TOKEN` in the desired repository, through the GitHub web UI or using the gh command line tool: `gh secret set PHYLUM_TOKEN -b <token_value>`
63
+
- concrete package versions (only applicable for `requirements.txt`)
56
64
- existing Phylum project for repository (`.phylum_project` must be present)
57
65
58
66
### Known Issues
59
-
~~1. Incomplete packages: if Phylum hasn't yet analyzed a package requested by this action, the action will fail with an exit code of 5. This is momentarily preferable than waiting.~~
Sometimes, users will request risk analysis information for open-source packages Phylum has not yet processed. When this occurs, Phylum cannot reasonably provide risk scoring information until those packages have been processed.
71
+
Sometimes, users will request risk analysis information for open-source packages Phylum has not yet processed.
72
+
When this occurs, Phylum cannot reasonably provide risk scoring information until those packages have been processed.
63
73
64
-
New in `v1.4`, `phylum-analyze-pr-action` will:
74
+
Starting with `v1.4.0`, `phylum-analyze-pr-action` will:
65
75
1. Detect the case of incomplete packages
66
-
2. Return an exit code of 0 (a "passing" mark in GitHub Action parlance). This is to avoid failing a check in the PR with incomplete information.
67
-
3. Add a comment to the PR indicating that there were incomplete packages. The comment will advise users to wait 30m and re-run the check on the Pull Request. This will give Phylum sufficient time to download, process and analyze the incomplete packages.
68
-
4. When the check is run a second time, another comment will be added to the Pull Request noting the result of the risk analysis operation.
76
+
2. Return an exit code of 0 (a "passing" mark in GitHub Action parlance)
77
+
1. This is to avoid failing a check in the PR with incomplete information
78
+
3. Add a comment to the PR indicating that there were incomplete packages
79
+
1. The comment will advise users to wait 30m and re-run the check on the Pull Request
80
+
2. This will give Phylum sufficient time to download, process and analyze the incomplete packages
81
+
4. When the check is run a second time, another comment will be added to the Pull Request noting the result of the
0 commit comments