Commit graph

1961 commits

Author SHA1 Message Date
marco
edd8f037d9 wip 2024-12-26 16:55:11 +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
4748720a07
refactor pkg/leakybucket (#3371)
* refact pkg/leakybucket - call LoadBuckets with Item instances
* extract compileScopeFilter()
2024-12-20 14:33:24 +01:00
mmetc
26c15a1267
refact pkg/database: clean up code and error messages (#3263)
* refact pkg/database: extract alertfilter.go
* refact pkg/database: extract function rollbackOnError(); dry error messages
2024-12-19 17:01:16 +01:00
mmetc
ecf34c2fa1
lint/deep-exit: avoid log.Fatal (#3367)
* lint/deep-exit: don't fail on invalid alert
* lint/deep-exit: kinesis_test.go
* lint/deep-exit: watcher_test.go
* lint/deep-exit: parsing_test.go
* lint/deep-exit: client_test.go
2024-12-18 16:43:19 +01:00
mmetc
2c95a24f69
loop performance optimizations / 2 (#3364) 2024-12-18 16:40:40 +01:00
mmetc
99552f4a53
update dependency on docker (#3175)
* update dependency on docker

since docker doesn't have a go.mod, the opentelemetry dependencies
in go.sum must be updated by hand according to the vendor.mod file
of the related docker release

ex. https://github.com/docker/cli/blob/v27.1.1/vendor.mod
2024-12-18 16:35:00 +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
mmetc
118275fd03
lint: enable more gocritic checks (#3363)
* lint: gocritic - avoid unnecessary byte->string conversions
* lint: gocritic - use %q instead of "%s"
* lint: return struct from DataSource constructor, not pointer (ptrToRefParam)
* lint: gocritic - check use of append()
2024-12-13 15:42:55 +01:00
mmetc
08296d9cfa
acquisition: add some test and warning for wrong source type (#3362) 2024-12-13 11:00:41 +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
411bb48a81
loop performance optimizations / 1 (#3313)
* rangeValCopy: each iteration copies 248 bytes
* rangeValCopy: each iteration copies 576 bytes
* rangeValCopy: each iteration copies 376 bytes
* rangeValCopy: each iteration copies 312 bytes
* enable linter: gocritic/rangeValCopy
2024-12-05 18:04:26 +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
2ab93f79a1
appsec: missing err check when initializing out-of-band engine (#3344) 2024-11-25 17:35:21 +01:00
blotus
fb733ee43a
Allow bouncers to share API keys (#3323) 2024-11-19 14:47:59 +01:00
mmetc
36e2c6c8be
make: improve re2/wasm check (#3335) 2024-11-19 11:02:37 +01:00
blotus
c57dadce27
better handle error when sending usage metrics (#3333) 2024-11-18 11:21:30 +01:00
Thibault "bui" Koechlin
9067106ac0
Support multiple appsec configs (#3314)
* support multiple appsec configs
2024-11-15 16:40:48 +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
Laurence Jones
b96a7a5f06
fix: Use clientIP when passing coraza (#3322)
* fix: Use clientIP when passing coraza

* chore: update tests to reflect what remoteAddr and ClientIP should represent

* chore: Add a basic seclang rule test to appsec runner test suite

* chore: make linter happy :)
2024-11-15 09:48:55 +00:00
Manuel Sabban
4bd4e8dc29
test for cron dependency for packaging (#3331) 2024-11-13 15:42:10 +01:00
Laurence Jones
b3810c7e75
enhance: add fedora 41 (40, with provision to upgrade to 41 since there no image so far on vagrant cloud) (#3328) 2024-11-13 14:17:15 +00:00
Laurence Jones
4be84b8a0a
enhance: add opensuse leap 15 vagrant (#3329) 2024-11-13 14:15:01 +00:00
Laurence Jones
dd52e137ee
fix: Add a check to prevent attempting to load a directory within patterns (#3326) 2024-11-12 16:56:16 +00:00
Laurence Jones
3ba71f412e
fix: Ansible fedora 40 to use 40 (#3327) 2024-11-12 16:42:19 +00:00
blotus
fd314a31ce
fix go version for azure pipeline (#3324) 2024-11-12 14:49:26 +01:00
Manuel Sabban
1c140142da
add go minor in go.mod (#3318) 2024-11-12 10:04:10 +01:00
blotus
5d414f58e5
Add explicit configuration for signals sharing and blocklists pull (#3277) 2024-11-08 15:11:09 +01:00
blotus
94a2a586e4
loki: add no_ready_check option (#3317) 2024-11-08 12:01:30 +01:00
laur89
f2dfc66afa
readme: update bouncers link (#3297) 2024-11-05 14:18:29 +01:00
he2ss
19b70f10be
add HTTP datasource (#3294) 2024-11-05 14:15:04 +01:00
mmetc
57521114bd
update checks for wrapped errors (#3117)
* errors.Is()
* extract function isBrokenConnection()
2024-11-04 11:21:48 +01:00
Thibault "bui" Koechlin
1616991398
Alert context appsec (#3288) 2024-11-04 10:02:55 +01:00
mmetc
094072441c
make: allow build on ubuntu 24.10 (#3311) 2024-10-31 17:12:53 +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
97c1f60a68
make: remove obsolete/redundant parameters (#3304)
* makefile: remove -w from build flags (implied by -s)

* remove reference to obsolete build param
2024-10-29 09:56:51 +01:00
mmetc
96d4da76b9
remove unused code: HandleDeletedDecisions() (#3301) 2024-10-29 09:33:44 +01:00
mmetc
53f9bc562d
context propagation: OneShotAcquisition(); enable contextcheck linter (#3285)
* context propagation: OneShotAcquisition(); enable contextcheck linter
2024-10-28 15:38:50 +01:00
Laurence Jones
3ead7461ed
enhance: Remove if log check in one instance that was not needed as the logged items are not resource intensive (#3300) 2024-10-28 10:20:36 +00:00
mmetc
9d6ccb0f08
context propagation: appsec, docker, kafka, k8s datasources (#3284) 2024-10-25 15:43:03 +02:00
Laurence Jones
d00a6a6873
enhance: Check if resp is nil in capi metrics and continue (#3299) 2024-10-25 10:31:08 +01:00
mmetc
128328bda1
require go 1.23 (#3298) 2024-10-25 11:03:11 +02:00
blotus
d8bc17b170
wineventlog: add support for replaying evtx files (#3278) 2024-10-16 16:55:32 +02:00
blotus
b2ac65bfb6
avoid deadlock when deleting decisions if PAPI is half configured (#3283) 2024-10-16 16:55:18 +02:00
mmetc
9976616773
context propagation: StreamingAcquisition() (#3274)
* context propagation: StreamingAcquisition()
* lint
* ship with codecov.yml
2024-10-11 15:59:10 +02:00