Skip to content

Commit 29b8a1b

Browse files
committed
address feedback
1 parent cf809b1 commit 29b8a1b

File tree

2 files changed

+84
-43
lines changed

2 files changed

+84
-43
lines changed

README.md

+84-43
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,96 @@ This is a GitHub action for installing `roxctl` on Github Action runners. `roxct
66

77
## Table of Contents
88

9+
- [Parameters](#parameters)
910
- [Usage](#usage)
1011
- [Scan images in CI pipeline](#scan-images-in-ci-pipelines)
1112
- [Check images in CI pipeline](#check-images-in-ci-pipelines)
1213
- [Download roxctl from mirror.openshift.com](#download-roxctl-from-mirror-openshift-com)
1314
- [GitHub code scanning](#github-code-scanning)
1415
- [Authenticate with static API tokens](#authenticate-with-static-api-tokens)
15-
- [Parameters](#parameters)
1616

17-
## Usage
17+
## Parameters
18+
19+
| Parameter name | Required? | Description |
20+
| ------------------ | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
21+
| `install-dir` | (optional) | Path of directory to install `roxctl` to. |
22+
| `version` | (optional) | `roxctl` release version to use, e.g. "4.4.0". The latest available version is used by default. Ignored when `central-endpoint` is specified. |
23+
| `central-endpoint` | (optional) | RHACS Central endpoint to download `roxctl` from. If left unspecified, `roxctl` is downloaded from mirror.openshift.com instead. Requires `central-token` to be set. |
24+
| `central-token` | (optional) | Token to access RHACS Central endpoint. |
25+
| `skip-tls-verify` | (optional) | Skip TLS certificate verification for Central's API endpoint. `false` by default. |
26+
27+
## Authentication
1828

1929
Short-lived access tokens are the recommended authentication method when using `roxctl` in GitHub workflows.
2030
To generate a suitable token, configure a machine access configuration in Central and run the
2131
[central-login](https://github.com/stackrox/central-login) Github Action to set up an authenticated environment.
2232

23-
The following examples assume `env.CENTRAL_ENDPOINT` to be a valid Central URL.
33+
For example, to allow access from GitHub workflows in the `stackrox/stackrox` repository:
34+
35+
1. Create a machine access configuration of type `GitHub` in Central.
36+
2. Add a new rule with `Key = sub`, `Value = repo:stackrox/stackrox.*` and `Role = Continuous Integration`.
37+
38+
![](./docs/images/machine-access.png.png)
39+
40+
The following examples assume `env.CENTRAL_ENDPOINT=https://my-central.com` to be a valid Central URL.
41+
42+
### Authenticate with short-lived access tokens
43+
44+
See [Scan images in CI pipeline](#scan-images-in-ci-pipelines) and [Check images in CI pipeline](#check-images-in-ci-pipelines) for full length examples.
45+
46+
```yaml
47+
steps:
48+
- name: Central login
49+
uses: stackrox/central-login@v1
50+
with:
51+
endpoint: ${{ env.CENTRAL_ENDPOINT }}
52+
- name: Install roxctl
53+
uses: stackrox/roxctl-installer-action@v1
54+
with:
55+
central-endpoint: ${{ env.CENTRAL_ENDPOINT }}
56+
central-token: ${{ env.ROX_API_TOKEN }}
57+
```
58+
59+
### Authenticate with long-lived API tokens
60+
61+
Long-lived API tokens are not recommended because they carry an increased risk of credential exposure.
62+
They should only be used when short-lived access tokens are not an option.
63+
64+
To authenticate with a Central API token, create a GitHub secret `secrets.ROX_API_TOKEN` and assign its value to the API token.
65+
66+
```yaml
67+
name: Scan image with roxctl
68+
on:
69+
push:
70+
branches: ["main"]
71+
pull_request:
72+
jobs:
73+
scan:
74+
runs-on: ubuntu-latest
75+
permissions:
76+
id-token: write
77+
steps:
78+
- name: Install roxctl
79+
uses: stackrox/roxctl-installer-action@v1
80+
with:
81+
central-endpoint: ${{ env.CENTRAL_ENDPOINT }}
82+
central-token: ${{ secrets.ROX_API_TOKEN }}
83+
- name: Scan image with roxctl
84+
shell: bash
85+
env:
86+
ROX_ENDPOINT: ${{ env.CENTRAL_ENDPOINT }}
87+
ROX_API_TOKEN: ${{ secrets.ROX_API_TOKEN }}
88+
run: |
89+
roxctl image scan --output=table --image="quay.io/stackrox-io/main"
90+
```
91+
92+
## Usage
2493

2594
### Scan images in CI pipelines
2695

96+
See `roxctl image scan`](https://docs.openshift.com/acs/4.4/cli/command-reference/roxctl-image.html#roxctl-image-scan_roxctl-image)
97+
for the full parameter list.
98+
2799
```yaml
28100
name: Scan image with roxctl
29101
on:
@@ -53,6 +125,9 @@ jobs:
53125

54126
### Check images in CI pipelines
55127

128+
See [`roxctl image check`](https://docs.openshift.com/acs/4.4/cli/command-reference/roxctl-image.html#roxctl-image-check_roxctl-image)
129+
for the full parameter list.
130+
56131
```yaml
57132
name: Check image with roxctl
58133
on:
@@ -82,6 +157,9 @@ jobs:
82157

83158
### Download roxctl from mirror.openshift.com
84159

160+
See `roxctl image scan`](https://docs.openshift.com/acs/4.4/cli/command-reference/roxctl-image.html#roxctl-image-scan_roxctl-image)
161+
for the full parameter list.
162+
85163
```yaml
86164
name: Scan image with roxctl
87165
on:
@@ -110,6 +188,9 @@ jobs:
110188

111189
### GitHub code scanning
112190

191+
See `roxctl image scan`](https://docs.openshift.com/acs/4.4/cli/command-reference/roxctl-image.html#roxctl-image-scan_roxctl-image)
192+
for the full parameter list.
193+
113194
```yaml
114195
name: Code scanning with roxctl
115196
on:
@@ -144,43 +225,3 @@ jobs:
144225
category: stackrox-io/main
145226
sarif_file: results.sarif
146227
```
147-
148-
### Authenticate with static API tokens
149-
150-
Create a repository secret `secrets.ROX_API_TOKEN` and assign its value to a valid Central API token.
151-
152-
```yaml
153-
name: Scan image with roxctl
154-
on:
155-
push:
156-
branches: ["main"]
157-
pull_request:
158-
jobs:
159-
scan:
160-
runs-on: ubuntu-latest
161-
permissions:
162-
id-token: write
163-
steps:
164-
- name: Install roxctl
165-
uses: stackrox/roxctl-installer-action@v1
166-
with:
167-
central-endpoint: ${{ env.CENTRAL_ENDPOINT }}
168-
central-token: ${{ secrets.ROX_API_TOKEN }}
169-
- name: Scan image with roxctl
170-
shell: bash
171-
env:
172-
ROX_ENDPOINT: ${{ env.CENTRAL_ENDPOINT }}
173-
ROX_API_TOKEN: ${{ secrets.ROX_API_TOKEN }}
174-
run: |
175-
roxctl image scan --output=table --image="quay.io/stackrox-io/main"
176-
```
177-
178-
## Parameters
179-
180-
| Parameter name | Required? | Description |
181-
| ------------------ | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
182-
| `install-dir` | (optional) | Path of directory to install `roxctl` to. |
183-
| `version` | (optional) | `roxctl` release version to use, e.g. "4.4.0". The latest available version is used by default. Ignored when `central-endpoint` is specified. |
184-
| `central-endpoint` | (optional) | RHACS Central endpoint to download `roxctl` from. If left unspecified, `roxctl` is downloaded from mirror.openshift.com instead. Requires `central-token` to be set. |
185-
| `central-token` | (optional) | Token to access RHACS Central endpoint. |
186-
| `skip-tls-verify` | (optional) | Skip TLS certificate verification for Central's API endpoint. `false` by default. |

docs/images/machine-access.png

334 KB
Loading

0 commit comments

Comments
 (0)