Commit graph

151 commits

Author SHA1 Message Date
marco
89efed68b0 replace syscall with unix/windows packages where possible
from the 1.22 release notes:

The syscall package has been frozen since Go 1.4 and was marked as deprecated in Go 1.11 [...]
However, some non-deprecated functionality requires use of the syscall package [...]
To avoid unnecessary complaints[...] no longer marked as deprecated.
The package remains frozen to most new functionality, and new code remains encouraged
to use golang.org/x/sys/unix or golang.org/x/sys/windows where possible.
2024-08-22 09:38:48 +02:00
mmetc
08fdfc4fb0
cscli refact: package 'cliconsole' (#3149)
* cscli refact: package 'cliconsole'

* dry

* lint

* lint
2024-08-20 16:20:40 +02:00
mmetc
6b9b19b8c1
CI: use golangci-lint 1.60 (#3180)
* use golangci-lint 1.60

* lint (gosimple/S1009) -> len(nil) == 0

* nerf govet for now
2024-08-19 14:09:17 +02:00
mmetc
1bc3b0870b
command "cscli doc --target /path/to/dir" (#3169)
* command "cscli doc --target /path/to/dir"

* typos and improved messages

* CI: remove obsolete parameters for golangi-lint action

* lint
2024-08-07 12:45:54 +02:00
mmetc
136dba61d9
reduce log verbosity, minor CI fixes, lint (#3157)
* pkg/cwhub: redundant log messages

* CI: fixture output and elapsed time

* CI: preload only essential hub items

* report full version (including -rc2 etc.) with cscli hub update --debug

* lint
2024-08-01 10:55:04 +02:00
blotus
a3d7900b5f
update expr (#3144) 2024-07-22 12:14:46 +02:00
mmetc
206211ce53
lint: import statement order (#3085)
* lint: import statement order

* lint
2024-06-26 12:16:17 +02:00
mmetc
0e93f98cad
lint: github.com/pkg/errors -> errors (#3091) 2024-06-21 14:31:45 +02:00
mmetc
4b988701ed
lint (intrange) (#2970) 2024-06-21 13:47:26 +02:00
mmetc
8a259fd25b
lint (copyloopvar) (#2971) 2024-06-20 22:13:26 +02:00
mmetc
659774fd3d
refactor: prefer logrus.WithField over WithFields with a single param (#3087) 2024-06-20 10:38:23 +02:00
mmetc
ae58b158a5
enable linter: revive (var-declaration) (#3069) 2024-06-11 09:26:50 +02:00
mmetc
31ed9fb5ee
enable linter: revive (indent-error-flow) (#3068)
* enable linter: revive (indent-error-flow)

* lint
2024-06-10 17:36:22 +02:00
mmetc
7fd01ae3fc
CI: update golangci-lint to 1.59; enforce canonical HTTP headers (#3074) 2024-06-10 16:13:49 +02:00
mmetc
72b6da9925
enable linter: revive (early-return) (#3051)
* enable linter: revive (early-return)

* lint
2024-06-07 16:53:23 +02:00
mmetc
6ef2396c91
enable linter: revive (blank-imports) (#3062)
* lint: revive (blank-imports) require a comment to justify blank imports

* typo
2024-06-06 16:03:32 +02:00
mmetc
3dd17b9081
tests: log.Fatal -> return err (#3056)
* tests: log.Fatal -> return err

* lint
2024-06-05 11:04:54 +02:00
mmetc
7313d49145
enable linter: revive(bool-literal-in-expr) (#2983) 2024-06-04 09:47:25 +02:00
mmetc
89d02e9458
CI/lint: enable some "revive" rules (#3041)
argument-limit
Warns when a function receives more parameters than the maximum set by the rule's configuration.

bare-return
Warns on bare (a.k.a. naked) returns

context-as-argument
By convention, context.Context should be the first parameter of a function.

duplicated-imports
It is possible to unintentionally import the same package twice.

modifies-parameter
A function that modifies its parameters can be hard to understand. It can also be misleading if the arguments are passed by value by the caller.

redundant-import-alias
This rule warns on redundant import aliases.

unreachable-code
This rule spots and proposes to remove unreachable code.
2024-05-31 16:45:47 +02:00
mmetc
7d6514c7cc
update user agent with version and platform information (#3035)
* update user agent with version and platform information

* remove unused import

* user agent: omit tag correctly if git is dirty
2024-05-30 09:45:43 +02:00
blotus
f3341c1382
Appsec: properly populate event (#2943) 2024-05-27 10:15:38 +02:00
Laurence Jones
9088f31b7d
enhance: container discovery via labels (#2959)
* wip: attempt to autodiscover via labels

* wip: remove labels dep on docker acquistion

* wip: remove labels dep on docker acquistion

* wip: add debug

* wip: try fix parser maps

* wip: remove redundant pointer

* wip: add debug

* wip: cant type assert

* wip: reinstate debug

* wip: reinstate debug

* wip: reinstate debug

* wip: oops

* wip: add a debug

* wip: fix labels

* wip: remove redundant paramter

* wip: rename config option to be more self declarative

* wip: update log wording

* wip: the if check was not correct

* wip: me lost

* fix: add checks to typecast and log useful information

* add tests for parseLabels

* return nil instead of pointer to empty struct

* simplify EvalContainer return value

---------

Co-authored-by: Sebastien Blot <sebastien@crowdsec.net>
2024-05-24 14:27:25 +01:00
blotus
09afcbe93a
appsec: respect on_success parameter in hooks (#3017) 2024-05-24 14:42:17 +02:00
blotus
20e44cd18a
appsec: add files and cookies related zones (#2956) 2024-05-17 16:16:04 +02:00
mmetc
3788610aff
cscli: avoid global vars (#2977)
* cscli: avoid global usage

This is required to make it possible to split the package

* lint (fmt.Errorf)
2024-05-02 10:25:04 +02:00
Thibault "bui" Koechlin
912c4bca70
split & reorganize tests a bit. Add tests on existing zones (#2925) 2024-04-03 17:49:05 +02:00
Thibault "bui" Koechlin
63bd31b471
Fix REQUEST_URI behavior + fix #2891 (#2917)
* fix our behavior to comply more with modsec, REQUEST_URI should be: path+query string

* fix #2891 as well

* add new transforms

* add transform tests
2024-03-29 17:57:54 +01:00
mmetc
dd71f0a866
CI: bump lint version and update configuration (#2901)
* bump golangci-lint to 1.56

* lint (testifylint)

* update lint configuration

* windows test: remove stale code
2024-03-19 10:48:49 +01:00
blotus
6de62a1468
warn if user is using inotify to tail a symlink (#2881) 2024-03-19 10:22:43 +01:00
mmetc
2f49088163
file acquisition: don't bubble error when tailed file disappears (#2903)
* file acquisition: don't bubble error when tailed file disappears
* don't call t.Kill()
* lint (whitespace)
2024-03-18 11:25:45 +01:00
Thibault "bui" Koechlin
b1c09f7512
acquisition : take prometheus level into account (#2885)
* properly take into account the aggregation level of prometheus metrics in acquisition
2024-03-13 14:57:19 +01:00
blotus
44ec3b9e01
file acquis: add mutex to protect access to the internal tail map (#2878) 2024-03-08 13:56:59 +01:00
blotus
5731491b4e
Auto detect if reading logs or storing sqlite db on a network share (#2241) 2024-03-07 14:04:50 +01:00
mmetc
a23fe06d68
remove dependencies on enescakir/emoji, gotest.tools (#2837)
* wrap emoji package in pkg/emoji
* remove dependency on enescakir/emoji
* remove dependency on gotest.tools
* lint (whitespace)
2024-02-23 16:05:01 +01:00
Laurence Jones
f3ea88f64c
Appsec unix socket (#2737)
* Appsec socket

* Patch detection of nil listenaddr

* Allow TLS unix socket

* Merge diff issue
2024-02-21 13:40:38 +00:00
blotus
332af5dd8d
appsec: split return code for bouncer and user (#2821) 2024-02-09 14:39:34 +01:00
Laurence Jones
fa56d35a48
[Loki] Set headers/basic auth if set for queryRange (#2815) 2024-02-09 14:37:49 +01:00
mmetc
f75cdeb239
lint: enalble linter "wastedassign" (#2772) 2024-01-24 17:31:11 +01:00
AlteredCoder
70e8377c0d
Fix appsec evt send order (#2749) 2024-01-17 11:59:31 +01:00
Thibault "bui" Koechlin
685cda545b
fix the reload process for appsec (#2750) 2024-01-17 11:54:44 +01:00
mmetc
08794c5b6d
[appsec] waf tester (#2746) 2024-01-16 11:39:23 +01:00
blotus
6acbcb0a33
Various appsec fixes (#2742) 2024-01-15 16:38:11 +01:00
blotus
e452dc80bd
ignore native modsec rules that were either pass or allow (#2684) 2024-01-15 15:12:02 +01:00
blotus
fd309134a2
log death reason of file reader if available (#2721) 2024-01-15 15:00:49 +01:00
mmetc
5622ac8338
CI: enable testifylint (#2696)
- reverse actual and expected values
 - use assert.False, assert.True
 - use assert.Len, assert.Emtpy
 - use require.Error, require.NoError
 - use assert.InDelta
2024-01-05 15:26:13 +01:00
Thibault "bui" Koechlin
1c03fbe99e
minor waf fixes (#2693) 2024-01-03 17:19:48 +01:00
blotus
b6f272d09a
always set the transaction in the current request (#2682) 2023-12-22 11:44:06 +01:00
blotus
a62e28fdfb
always set inband transaction even if we have no rules (#2681) 2023-12-22 10:18:35 +01:00
blotus
33e3fdabe4
Appsec additional fixes (#2676) 2023-12-21 11:51:04 +01:00
Thibault "bui" Koechlin
51f70e47e3
Minor improvements to hubtest and appsec component (#2656) 2023-12-13 17:45:56 +01:00