Commit graph

520 commits

Author SHA1 Message Date
mmetc
418a27596e
lint/gocritic: enable importShadow, typeUnparen, unnecessaryDefer (#3583) 2025-04-24 11:12:38 +02:00
mmetc
2dcc3ae0df
CI: pin hub branch during functional tests (#3526) 2025-03-20 11:28:37 +01:00
mmetc
0459a9a880
update appsec test runner (#3518) 2025-03-18 11:45:06 +01:00
mmetc
cab99643d1
Parallel hubtest (#3509)
Hubtests are now much faster and have a --max-jobs option which defaults to the number of cpu cores.
2025-03-17 11:27:09 +01:00
blotus
cce41a1e6c
do not attempt to set db log level if no db config (#3510) 2025-03-13 17:38:07 +01:00
mmetc
12a3c70860
lint: gocritic/httpNoBody (#3493)
* lint: gocritic/httpNoBody
2025-03-07 14:35:25 +01:00
mmetc
b12ade27f4
cscli: review/update argument number checking (#3490)
* cscsli: remove unused Command.Args setting

* cscli: review/update argument number checking

cscli will consistently print the help text if the number of arguments is
wrong for the command, but not for other types of errors.

* fix func tests

* lint
2025-03-04 12:21:27 +01:00
Thibault "bui" Koechlin
61c7de1331
enable/disable options for console enroll - make alert context a default (#3487)
* enable/disable options for console enroll - make alert context a default

* extract method and refact

---------

Co-authored-by: marco <marco@crowdsec.net>
2025-03-03 16:09:09 +01:00
mmetc
c161eb270b
pkg/cwhub: refact Item.State.(Downloaded | Installed) (#3476) 2025-02-25 10:09:29 +01:00
mmetc
2b70dbf3e5
cscli hub/items: always show action plan; fix --interactive in pipes (#3451) 2025-02-21 00:17:01 +01:00
blotus
16d0677938
Add support for centralized allowlists (#3355) 2025-02-19 15:04:47 +01:00
mmetc
8a10e2c61d
refact: avoid use of defer calls in loops (#3466)
* refact apic.Send()
* refact Papi.SendDeletedDecisions()
* refact MetricsProvider.Run()
* refact PluginBroker.pushNotificationsToPlugin()
* refact leakybucket.LoadBuckets()
2025-02-19 14:50:38 +01:00
mmetc
5136d928ed
lint: gocritic/typeDefFirst (ensure type definitions come before methods) (#3404)
* lint: gocritic/typeDefFirst (ensure type definitions come before methods)

* lint
2025-02-17 10:55:18 +01:00
mmetc
a9cc23e446
cscli: exclude removed commands from generated docs (#3449) 2025-02-07 10:52:14 +01:00
mmetc
a001e1d760
cscli: replace '--yes' option with '--interactive' (#3448) 2025-02-06 11:43:29 +01:00
mmetc
bfed861ba7
don't ask user to reload systemd service when running in docker (#3434)
* don't ask user to reload systemd service when running in docker

* refactor + give appropriate message if terminal is attached

* remove explicit filetype
2025-01-31 10:15:28 +00:00
Laurence Jones
5a37161df2
fix: use CreatedAt instead of StartAt (#3427)
* fix: use CreatedAt instead of StartAt

fix: #3321

* not a ptr
2025-01-27 12:05:26 +00:00
mmetc
4935dc536e
cscli hub: handle freebsd pre-release version numbers (#3423) 2025-01-23 09:29:29 +01:00
mmetc
bd7e1b50c3
cscli: cliconfig - remove global variables and gratuitous pointer (#3414) 2025-01-20 10:30:36 +01:00
mmetc
49fb24c3b1
lint: enable errcheck; add allowlist and explicit checks (#3403)
* lint: enable errcheck with explicit allow list
* add explicit error checks
* windows tests
* windows nolint
2025-01-16 16:13:10 +01:00
mmetc
fe931af5ca
lint: gocritic/captLocal (don't capitalize local variables) (#3402)
* lint: gocritic/captLocal (don't capitalize local variables)

* lint (whitespace)
2025-01-16 14:03:53 +01:00
mmetc
b582730d06
remove commands "cscli config backup/restore" (#3158)
* remove "cscli config backup/restore"
* remove backup/restore calls from deb,rpm pre/postinst and wizard
* remove from prerm too
2025-01-16 14:02:39 +01:00
mmetc
5df56844d9
log warning if local items have conflicting names (#3399) 2025-01-13 13:28:48 +01:00
Nathanael Demacon
e9c1ed05d9
feat(cscli): add env variable flag for dashboard setup (#3110)
Signed-off-by: Nathanael DEMACON <quantumsheep@users.noreply.github.com>
Co-authored-by: Nathanael DEMACON <quantumsheep@users.noreply.github.com>
Co-authored-by: Laurence Jones <laurence.jones@live.co.uk>
2025-01-13 09:17:18 +01:00
mmetc
866b0ad60c
Hubops tests (#3393) 2025-01-07 16:39:32 +01:00
mmetc
57d7247a43
cscli hub: refact/split files; add some doc/examples (#3394) 2025-01-06 23:55:39 +01:00
mmetc
5c7b957a34
cscli: restyle table titles; autocomplete "cscli metrics show" (#3391)
* cscli: restyle table titles; autocomplete "cscli metrics show"
* lint
2025-01-02 16:58:03 +01:00
Laurence Jones
f938b0c602
enhancement: Hubtest respect patterndir option set via config.yaml (#3386)
* enhancement: Hubtest respect patterndir option set via config.yaml

* pass patternDir to Run()

---------

Co-authored-by: marco <marco@crowdsec.net>
2025-01-02 14:21:03 +00:00
mmetc
4e6e6dec65
lint: explicit error checks (#3388)
* errcheck: tests
* fflag errcheck
* http_test errcheck (avoid duplicate metric registration)
2025-01-02 12:33:54 +01:00
mmetc
78f4b85311
pkg/cwhub - refact Downloader (#3382)
* pkg/cwhub - refact Downloader
* single method interfaces
* lint
2024-12-27 11:49:14 +01:00
mmetc
a1d26bdc5b
cscli: improved hub management (#3352) 2024-12-26 15:21:52 +01:00
victoredvardsson
466f39b880
Add possibility to configure log format #799 (#2941)
* make it possible to enable json log

* fix

* fix typo

* fix typo

* fix typo

* fix typo

* fix typo

* fix typo

* Add error handling

* Add log_format to default config

* Fix syntax error in if statement

* Fix typo

* Fix typo

* Fix some typos and change naming from native to text, makes more sense

* Set same timestamp format for json logging

* Fix formatting

* Move in if statement under previous

* Fix some formatting that got messed up

* Default to text formatter, if log_format is not configured.

* defining logFormatter outside if statement so that log.SetFormatter(logFormatter) is not undefined when function is called

* Add variables that were undefined

* Argument were missing when calling SetDefaultLoggerConfig function

* Fix order of arguments passed

* Fix order of arguments passed

* Fix typo

* Implicit log_format = "text"

* functional test

* ignore log_format in FatalHook

* make it possible to enable json log

* fix

* fix typo

* fix typo

* fix typo

* fix typo

* fix typo

* fix typo

* Add error handling

* Add log_format to default config

* Fix syntax error in if statement

* Fix typo

* Fix typo

* Fix some typos and change naming from native to text, makes more sense

* Set same timestamp format for json logging

* Fix formatting

* Move in if statement under previous

* Fix some formatting that got messed up

* Default to text formatter, if log_format is not configured.

* defining logFormatter outside if statement so that log.SetFormatter(logFormatter) is not undefined when function is called

* Add variables that were undefined

* Argument were missing when calling SetDefaultLoggerConfig function

* Fix order of arguments passed

* Fix order of arguments passed

* Fix typo

* Implicit log_format = "text"

* functional test

* ignore log_format in FatalHook

* lint

* fix func test

* lint

* remove < > characters from log

---------

Co-authored-by: Victor Edvardsson <victor.edvardsson@loopia.se>
Co-authored-by: marco <marco@crowdsec.net>
Co-authored-by: Thibault "bui" Koechlin <thibault@crowdsec.net>
2024-12-23 11:08:33 +01:00
mmetc
b1e2b9523c
cscli: print errors in plain text with -o json (#2973) 2024-12-13 15:45:07 +01:00
mmetc
082c1dde71
lint/deep-exit: avoid log.Fatal (#3360)
* deep-exit: bubble up error from item_metrics.go
* deep-exit: bubble up error from password.go
2024-12-13 15:44:21 +01:00
blotus
d35d01fd9a
support dump: generate pprof files with debug=1 to avoid generating an unusable heap dump (#3361) 2024-12-11 17:57:07 +01:00
mmetc
dada07b2da
cscli: display expired decisions' expiration time in red (#3357)
* cscli decisions: display negative expiration times in red

* honor color flag
2024-12-11 14:02:22 +01:00
mmetc
88c5f85064
sigmahq: fix functional test (#3359) 2024-12-10 13:19:56 +01:00
mmetc
7a1ad8376a
lint: style, autofix (#3354) 2024-12-05 10:40:48 +01:00
mmetc
bbe7752967
update golangci-lint to 1.62 (#3332)
- ensure consistent pointer/value receivers
 - testify: json assertions with dedicated methods
2024-11-27 14:14:56 +01:00
blotus
fb733ee43a
Allow bouncers to share API keys (#3323) 2024-11-19 14:47:59 +01:00
mmetc
a4497da6b9
context propagation: papi, loki (#3308)
* context propagation: AuthenticatedLAPIClient()

* context propagation: papi

* context propagation: loki
2024-11-15 15:31:10 +01:00
blotus
5d414f58e5
Add explicit configuration for signals sharing and blocklists pull (#3277) 2024-11-08 15:11:09 +01:00
mmetc
92662ed461
refact cscli: decisions, lapi, bouncers, machines (#3306)
* refact "cscli decisions import"

* cobra.ExactArgs(0) -> cobra.NoArgs

* refact cscli bouncers

* refact cscli machines

* refact "cscli lapi"

* lint
2024-10-30 10:59:20 +01:00
mmetc
8ff58ee74e
context propagation: pkg/csplugin (#3273) 2024-10-10 17:18:59 +02:00
mmetc
b9bccfa56f
context propagation: pkg/apiserver (#3272)
* context propagation: apic.Push()

* context propagation: NewServer()

* lint
2024-10-09 13:06:03 +02:00
mmetc
4e3495dbba
lint/revive: check tags on non-exported struct fields (#3257)
* lint/revive: check tags on non-exported struct fields

* update .golangci.yaml; remove full list of enabled linters

* lint
2024-10-03 15:27:48 +02:00
mmetc
27451a5ee6
context propagation: pass ctx to UpdateScenario() (#3258)
* context propagation: pass ctx to UpdateScenario()

* context propagation: SendMetrics, SendUsageMetrics, plugin config
2024-10-02 13:39:07 +02:00
mmetc
3945a991bd
context propagation: pkg/database/alerts (#3252)
* alerts
* drop CTX from dbclient
* lint
* pkg/database/alerts: context.TODO()
* cscli: context.Background() -> cmd.Context()
2024-09-24 14:13:45 +02:00
mmetc
4a2a663227
context propagation: pkg/database/bouncers (#3249) 2024-09-20 20:45:21 +02:00
mmetc
fee3debdcc
context propagation: pkg/database/machines (#3248) 2024-09-20 16:00:58 +02:00