1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +01:00

Add time range to checker.

This commit is contained in:
Sascha L. Teichmann 2023-07-26 13:34:15 +02:00
parent 125028773f
commit 5e5074fbf1
3 changed files with 85 additions and 28 deletions

View file

@ -16,10 +16,11 @@ Application Options:
-v, --verbose Verbose output
-r, --rate= The average upper limit of https operations per second (defaults to unlimited)
-y, --years=YEARS Number of years to look back from now
-t, --timerange=RANGE RANGE of time from which advisories to download
-H, --header= One or more extra HTTP header fields
--validator=URL URL to validate documents remotely
--validatorcache=FILE FILE to cache remote validations
--validatorpreset= One or more presets to validate remotely (default: mandatory)
--validatorpreset= One or more presets to validate remotely (default: [mandatory])
-c, --config=TOML-FILE Path to config TOML file
Help Options:
@ -48,6 +49,7 @@ insecure = false
verbose = false
# rate # not set by default
# years # not set by default
# timerange # not set by default
# header # not set by default
# validator # not set by default
# validatorcache # not set by default
@ -64,8 +66,37 @@ type 1: warning
type 2: error
```
The checker result is a success if no checks resulted in type 2, and a failure otherwise.
The checker result is a success if no checks resulted in type 2, and a failure otherwise.
`years` and `timerange` allows only checking advisories from a given time interval.
It is only allowed to specify one off them.
`years` looks number of years back from now. `timerange` values allow finer controls:
1. Relative. If the given string follows the rules of being a [Go duration](https://pkg.go.dev/time@go1.20.6#ParseDuration)
the time interval from now minus that duration till now is used.
E.g. `"3h"` means checking the advisories that have changed in the last three hours.
2. Absolute. If the given string is an RFC 3339 date timestamp the time interval between
this date and now is used.
E.g. `"2006-01-02"` means that all files between 2006 January 2nd and now going to be
checked.
Accepted patterns are:
- `"2006-01-02T15:04:05Z"`
- `"2006-01-02T15:04:05+07:00"`
- `"2006-01-02T15:04:05-07:00"`
- `"2006-01-02T15:04:05"`
- `"2006-01-02T15:04"`
- `"2006-01-02T15"`
- `"2006-01-02"`
- `"2006-01"`
- `"2006"`
Missing parts are set to the smallest value possible in that field.
3. Range. Same as 2 but separated by a `,` to span an interval. e.g `2019,2024`
spans an interval from 1st January 2019 to the 1st January of 2024.
All interval boundaries are inclusive.
### Remarks