Skip to content

Commit 1a99cda

Browse files
committed
doc updates
1 parent 8b3d603 commit 1a99cda

File tree

3 files changed

+88
-55
lines changed

3 files changed

+88
-55
lines changed

README.md

+84-55
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Checkmarx One Scan Scheduler
22

3-
This provides a method of scheduling scans in Checkmarx One. Some
4-
highlights of how it works:
3+
The scan scheduler provides a method of automating scan invocation by cadence in Checkmarx One (CxOne).
4+
5+
Some highlights of how it works:
56

67
* Runs in a container that builds the scan schedule on startup.
7-
* Works for single- or multi-tenant Checkmarx One.
8+
* Works for single- or multi-tenant CxOne.
89
* Scans can be scheduled per project using one or more of the
910
following methods:
1011
* A tag applied to the project with scan details.
@@ -18,7 +19,7 @@ based on changes in projects that would affect schedule assignments.
1819

1920
Scheduling scans for a project requires the project has a configured way to clone code from the repository to be scanned.
2021
If the repository is private, a supported set of credentials must also be configured so that the code for scanning can be
21-
cloned.
22+
cloned. Projects created using the "Code Repository" integration will have the clone credentials automatically managed without the need to configure credentials for each repository.
2223

2324
The following methods can be used to schedule a scan:
2425

@@ -29,47 +30,99 @@ The following methods can be used to schedule a scan:
2930

3031
### Scheduling via Tags
3132

32-
Scheduling a project for scanning requires adding a tag to the project in the form of:
33+
This is the preferred method of scheduling scans. Scheduling a project for
34+
scanning requires adding a tag to the project in the form of:
3335

3436
```
3537
schedule:<schedule>:<branch>:<engines>
3638
```
3739

38-
Only one `schedule` tag may be added to a project.
40+
Only one `schedule` tag may be added to a project. The elements of the
41+
schedule string (e.g. `<schedule>:<branch>:<engines>`) are described below.
42+
43+
The `<branch>` and `<engines>` elements are optional. Some examples of schedule
44+
strings:
45+
46+
* `<schedule>:<branch>:<engines>` - a schedule string that defines all possible elements.
47+
* `<schedule>` - a schedule string that only defines the scan invocation cadence. The branch and engines will be determined following the logic described below.
48+
* `<schedule>:<branch>` - a schedule string that defines the scan invocation cadence
49+
as well as the branch to be scanned on each scan invocation. The engines for
50+
the scan will be determined following the logic described below.
51+
* `<schedule>::<engines>` - a schedule string that defines the scan invocation cadence as well as the engines used for the scan. The branch has been
52+
omitted from the schedule string; the branch used for
53+
the scan will be determined following the logic described below.
3954

40-
#### Element: `<schedule>`
55+
56+
#### Element: `<schedule>` (required)
4157

4258
The `<schedule>` for scans can be one of the following values:
4359

4460
* `hourly`
4561
* `daily`
4662
* A custom configured [policy name](#policy-definitions).
4763

64+
The image below shows an example of projects configured with different scan
65+
schedules:
66+
67+
* `schedule:2x-daily` corresponds to a [custom scan policy](#policy-definitions)
68+
with the name `POLICY_2X_DAILY`.
69+
* `schedule:daily` corresponds to the built-in `daily` scan schedule.
70+
* `schedule:general-audit-policy` corresponds to a
71+
[custom scan policy](#policy-definitions) with the name
72+
`POLICY_GENERAL_AUDIT_POLICY`.
73+
74+
75+
![schedule examples](images/schedule-tags.png "Schedule Examples")
76+
77+
#### Element: `<branch>` (optional)
78+
79+
The name of the branch to schedule. The branch to scan is selected by the
80+
following order of precedence:
4881

49-
#### Element: `<branch>`
82+
1. The branch defined in the tag.
83+
2. The branch selected as the `Primary Branch` in the project configuration.
84+
3. The default branch as defined in the SCM when the project was imported with a code repository integration.
5085

51-
The name of the branch to schedule. If not provided, the primary branch selected in the project view is used. Selection of the primary branch is shown in the image below:
86+
If the branch to scan can't be determined, the scan will not be scheduled.
87+
88+
Selection of the primary branch via the project configuration is shown in the image below:
5289

5390
![primary branch selection](images/primary-branch.png "Primary Branch Selection")
5491

55-
If the branch is not provided and no primary branch has been set, the scan will not be scheduled.
5692

57-
#### Element: `<engines>`
5893

59-
The value for `<engines>` can be one of the following:
94+
#### Element: `<engines>` (optional)
6095

96+
The value for `<engines>` can be one of the following:
6197

62-
* `all` to scan with all engines
63-
* Empty, which implies `all`
98+
* `all` to scan with all engines.
99+
* Empty which follows the logic described below.
64100
* A single engine name, which is currently one of the following:
65101
* `sast`
66102
* `sca`
67103
* `kics`
68104
* `apisec`
69105
* A comma-separated list of two or more of the single engine names.
70106

71-
Duplicated or invalid engine names are ignored. If no valid set of
72-
engine names can be determined, `all` is assumed.
107+
Duplicated or invalid engine names are ignored.
108+
109+
The engines for the scan are chosen in the following precedence order:
110+
111+
1. Engines defined explicitly in the tag override all other engine selections.
112+
2. For a project created with a code repository integration, the engines selected in the "Code Repository"
113+
project settings.
114+
3. The engines that were used in the last scan.
115+
4. If the engines for the scan can't be determined, `all` engines are selected.
116+
117+
### Scheduling with a Default Schedule
118+
119+
A default schedule can be applied to projects that are not [scheduled with a tag](#scheduling-via-tags)
120+
or [scheduled with a group](#scheduling-via-assigned-groups). This method is not advised
121+
unless there are very few projects to schedule for scanning. If a large number of projects are scheduled to scan
122+
by default, it may cause other scans to take longer as they wait for an available scan engine.
123+
124+
A default schedule is defined using the `DEFAULT_SCHEDULE` [configuration environment variable](#environment-variables). Setting it to a schedule policy name
125+
will cause all projects that have no deterministic schedule to assume the default schedule.
73126

74127
### Scheduling via Assigned Groups
75128

@@ -79,7 +132,7 @@ scheduling environment variables.
79132

80133
Projects can be assigned to zero or more groups. If a project is not
81134
assigned to a group, a schedule will only be executed if the project
82-
has a `schedule` tag of a default schedule has been defined. Group schedules
135+
has a `schedule` tag or a default schedule has been defined. Group schedules
83136
only execute using the project's configured primary branch; if a
84137
project does not have a primary branch configured, the scan is not scheduled.
85138

@@ -105,38 +158,14 @@ scheduled scan is executing for that project. This will prevent overlapping sch
105158
starting multiple scans or long-running scans from being started before
106159
the previously scheduled scan is completed.
107160

108-
Scans executed by the Scan Scheduler are tagged with `scheduled:<crontab string>`. This
109-
will allow validation that scheduled scans are executing and verification of the
110-
scan schedule that caused the scan invocation.
161+
Scans executed by the Scan Scheduler are tagged with `scheduled:<crontab string>` when scan tagging on scan invoke is possible. Scans invoked for projects
162+
created with a Code Repository integration can't be tagged until the scan is complete.
163+
Since the scheduler keeps no state and does not monitor scan executions, scans for projects
164+
created by a Code Repository integration will not be tagged.
111165

112-
### Example Tags
113-
114-
Schedule a daily scan of the project's primary branch using all engines.
115-
116-
```
117-
schedule:daily
118-
```
119-
120-
121-
Schedule a daily scan of the `master` branch using all engines.
122-
123-
```
124-
schedule:daily:master:all
125-
```
126-
127-
Schedule a daily scan at midnight limited to weekdays using the
128-
project's primary branch, the sast engine, and a custom defined
129-
scan policy name.
130-
131-
```
132-
schedule:weekdays-midnight::sast
133-
```
134-
135-
Schedule a daily scan at midnight limited to weekdays using the branch `master` with the sast and sca engines.
136-
137-
```
138-
schedule:weekdays-midnight:master:sast,sca
139-
```
166+
If auditing scans from the list of all scans, filtering for scheduled scans
167+
can be accomplished using the `Initiator` column. The initiator will use the name of
168+
the Checkmarx One OAuth client used by the scanner to interact with the Checkmarx One API.
140169

141170
## Scan Scheduler Configuration
142171

@@ -146,7 +175,7 @@ the scan schedules accordingly.
146175

147176
### Add Optional Trusted CA Certificates
148177

149-
While the CheckmarxOne system uses TLS certificates signed by a public CA, it is possible that corporate
178+
While the Checkmarx One system uses TLS certificates signed by a public CA, it is possible that corporate
150179
proxies use certificates signed by a private CA. If so, it is possible to import custom CA certificates
151180
when the scheduler starts.
152181

@@ -190,9 +219,9 @@ OAuth client does not require this role.
190219
A custom role with limited capabilities may be configured if desired. The `ast-scanner`
191220
role will allow the scan scheduler to see all projects, create
192221
scheduled scan for all projects, and execute scans for all projects.
193-
This may not always be a desirable scenario.
222+
This level of access may not be appropriate for all organizations.
194223

195-
To limit the Scan Scheduler to limit project visibility via group membership
224+
To limit the Scan Scheduler's project visibility via group membership
196225
, the following minimum permissions can be assigned to the OAuth Client
197226
or as a custom composite role:
198227

@@ -216,9 +245,9 @@ The following runtime environment variables are required to configure the system
216245
|`CXONE_REGION`|N/A| Required for use with multi-tenant Checkmarx One tenants. The endpoint region used by your Checkmarx One tenant. This can be one of the following values: `US`, `US2`, `EU`, `EU2`, `DEU`, `ANZ`, `India`, `Singapore`, or `UAE`. If this is not supplied, the `SINGLE_TENANT_` variables must be defined.|
217246
|`SINGLE_TENANT_AUTH`|N/A|The name of the single-tenant IAM endpoint host. (e.g. `myhost.cxone.cloud`)|
218247
|`SINGLE_TENANT_API`|N/A|The name of the single-tenant API endpoint host. (e.g. `myhost.cxone.cloud`)|
219-
|`DEFAULT_SCHEDULE`|N/A|This defines the default schedule to apply to projects that do not have `schedule` tags. If not provided, projects that do not meet scheduling criteria via tags or group schedules will not be scanned with the scheduler. The value of this environment variable must be a valid `<schedule>` string. |
220-
|`GROUP_x`|N/A|`GROUP_` is considered a prefix with the remainder of the environment variable name being a key value. The key value is used to match other environment variables having the same key value. The value for this environment variable is a group path in the form of `/value/value/...` matching a group defined in Checkmarx One. This environment variable can be defined to apply a schedule to projects assigned to the defined group without the need to assign a `schedule` tag to the project.
221-
|`SCHEDULE_x`|N/A|`SCHEDULE_` is considered a prefix with the remainder of the environment variable name being a key value. The key value is used to match other environment variables having the same key value. The value of this environment variable must be a valid `<schedule>` string.|
248+
|`DEFAULT_SCHEDULE`|N/A|This defines the default schedule policy to apply to projects that do not have `schedule` tags. If not provided, projects that do not meet scheduling criteria via tags or group schedules will not be scanned with the scheduler. The value of this environment variable must be a valid `<schedule>` policy name. The branch and engine configurations are not defined as part of the default schedule.|
249+
|`GROUP_x`|N/A|`GROUP_` is considered a prefix with the remainder of the environment variable name being a key value. The key value is used to match `SCHEDULE_x` variables having the same key value. The value for this environment variable is a group path in the form of `/value/value/...` matching a group defined in Checkmarx One. This environment variable can be defined to apply a schedule to projects assigned to the defined group without the need to assign a `schedule` tag to the project.
250+
|`SCHEDULE_x`|N/A|`SCHEDULE_` is considered a prefix with the remainder of the environment variable name being a key value. The key value is used to match `GROUP_x` environment variables having the same key value. The value of this environment variable must be a valid `<schedule>` policy name.|
222251
|`LOG_LEVEL`|INFO|The logging level to control how much logging is emitted. Set to `DEBUG` for more verbose logging output.|
223252
|`SSL_VERIFY`|`True`| Set to `False` to turn off SSL certificate validation.|
224253
|`PROXY`| N/A | Set to the URL for an unauthenticated proxy. All http/s traffic will route through the specified proxy.|
@@ -290,7 +319,7 @@ There are two other runtimes that can be specified: `audit` and
290319
##### Executing `scanner`
291320

292321
The `scanner` is the tool used by `Cron` to execute scans. It has some self-explanatory command line arguments that can be retrieved with the `-h` option.
293-
Executing the `scanner` to see the help, for example, could be done using the following command line if running Docker locally:
322+
Executing `scanner` to see the help, for example, could be done using the following command line if running Docker locally:
294323

295324
```
296325
docker run -it -v $(pwd)/run/secrets/:/run/secrets --env-file .env ghcr.io/checkmarx-ts/cxone/scan-scheduler:latest scanner -h

RELEASE_NOTES.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes
22

3+
## v1.2
4+
5+
* Support added for projects created by code repository integrations.
6+
37
## v1.1
48

59
* Bug fix for auth token not refreshing properly.

images/schedule-tags.png

17.4 KB
Loading

0 commit comments

Comments
 (0)