239 Commits
Author SHA1 Message Date
blotus 7c1b99dddc bump to go 1.27 (#4675) 2026-09-11 15:33:41 +02:00
Recoordinate 863a4997af docs: fix broken Vagrant include link in test README (#4594)
The link to the shared Vagrant include pointed to
vagrant/Vagrantfile.common, which does not exist. The shared include is
test/ansible/vagrant/common, so this repoints the link.
2026-08-06 12:24:14 +02:00
Thibault "bui" Koechlin 3d25833e78 revamp 'cscli console status' to be all-in-one (#4592) 2026-08-05 10:06:23 +02:00
blotus 7b6a8dab01 waf: allow to configure auth timeout to LAPI (#4585) 2026-07-28 14:59:14 +02:00
Roshan Singh 95c854570e cscli lapi register: no error if the credentials file does not exist (#4570)
The lapi command group's PersistentPreRunE loads the API client
credentials before subcommands such as register and status run, so
register failed with "no such file or directory" unless the file it
is meant to create already existed. Skip that requirement for register
when a credentials path is configured, keeping the strict behavior for
subcommands that read the LAPI.

Fixes #4237
2026-07-23 17:46:03 +02:00
Thibault "bui" Koechlin 55dbc4a39d cscli: make hub list more human friendly 2026-07-22 14:44:13 +02:00
blotusandClaude Opus 4.8 7364ef838e CI hardening (#4546)
* ci: set least-privilege permissions on workflows

Add an explicit top-level permissions: block to every workflow that was
relying on the default GITHUB_TOKEN scope, granting only what each one
needs (contents: read by default; packages: write for the ghcr.io pushes;
actions: write for the cache cleanup).

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* ci: disable credential persistence on checkout

Set persist-credentials: false on every actions/checkout step so the
GITHUB_TOKEN is not written to .git/config for the job's lifetime. None
of these jobs push via git, so nothing relied on the persisted token.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* ci: pass untrusted values via env instead of inline interpolation

In version.yml and cache-cleanup.yaml, move workflow-dispatch- and
pull_request-derived values out of the inline run: script and into env:
variables, removing the shell-injection surface.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* ci: verify protoc and javy download checksums

The go generate check downloaded protoc and javy release binaries over
curl with no integrity check. Pin the sha256 of each asset and verify it
before use (job aborts on mismatch via set -e), and harden the curl
invocation (--fail, --proto '=https', --tlsv1.2).

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* ci: use native gh cache instead of third-party extension

Cache cleanup installed the actions/gh-actions-cache extension at runtime
(an unpinned, unverified download). gh now manages Actions caches
natively, so replace the extension + delete loop with a single
'gh cache delete --all --ref ...'. This also drops the now-unnecessary
repo checkout (gh reads the repo from GH_REPO) and narrows permissions to
just actions: write.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* ci: inline coverage badge update instead of third-party action

Replace schneegans/dynamic-badges-action with an inline gh api PATCH to
the badge gist. The action was just wrapping a GitHub Gist update with
shields.io endpoint JSON, so this removes a single-maintainer dependency
in favor of the GitHub API we already trust, and updates both badge
files in one call.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* test(bats): fetch hub index from a git clone to dodge CDN rate limiting

The bats fixture builds fetch the hub index from cdn-hub.crowdsec.net,
which rate-limits shared CI runner IPs and intermittently 403s, failing
'cscli hub update'. The committed .index.json on each hub branch already
embeds every item's content, so 'collections install' needs no further
downloads once the index is present.

Add a TEST_HUB_CLONE switch to config-local: when set, fetch the index
from a shallow git clone of the hub at the pinned branch instead of the
CDN (default behavior is unchanged, so local dev still uses the CDN). All
four bats CI jobs set it. On a failed index fetch (CDN or clone) log the
runner's public IP to help diagnose future rate limiting.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* ci(docker): use a GitHub environment for docker publish secrets

Set the reusable publish-docker workflow's push job to a configurable
environment (default: docker) so DockerHub credentials are sourced from
environment secrets. Drop the now-redundant secrets forwarding from the
master and release callers.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
2026-07-08 10:03:30 +02:00
blotus 69090c80cc cscli metrics: don't attempt to create a DB client if there's no DB config (#4451) 2026-05-05 09:35:26 +02:00
blotus b0f524555d Dependencies update (#4412)
- Update to go 1.26
 - Update all dependancies (expect Gin)
 - Replace all `ptr.Of()` usage by `new()`
2026-04-10 16:05:55 +02:00
blotus ac5e6f9708 cscli allowlists: add import command (#4378) 2026-03-23 12:17:44 +01:00
blotus 5eda72214b Add new kind alert attribute (#4351) 2026-03-19 14:36:02 +01:00
Thibault "bui" Koechlin 39f41f94e8 support for waf- alias in cscli (#4347) 2026-03-10 08:53:30 +01:00
mmetc 6ecd27fd22 cscli: consistent status and usage message for unknown subcommands (#4320)
* cscli: consistent status and usage message for unknown subcommands

* lint/format
2026-02-20 16:44:19 +01:00
mmetc 3e6f402373 cmd/crowdsec: assign overflow after parsing (#4226) 2026-01-23 17:03:43 +01:00
mmetc 6787990e29 update functional tests with time-based-bf (#4217) 2026-01-21 09:50:39 +01:00
mmetc 4e0cc464cc pkg/acquisition: refact configuration validation and tests (#4187) 2026-01-16 23:20:00 +01:00
mmetc 9ee3a1324a pkg/leakybucket: replace global variables with injected StateDumper (#4197)
* pkg/leakybucket: replace global variables with injected collector

* replace globals StageParse* with injected collector

* remove global bucketOverflows

* group collectors in a StateDumper{}
2026-01-16 13:48:37 +01:00
mmetc 222a06192b CI/tests: update bats-*, remove bats-mock (#4172)
* CI/tests: update bats-*, remove bats-mock

* remove reference to bats-mock

* skip buggy bats-core 1.13

https://github.com/bats-core/bats-assert/issues/91

* remove $FILE from test description

* submodules: use upstream repo
2026-01-06 16:58:16 +01:00
mmetc 03f7797037 CI, docker: update yq to v4.50.1 (#4179) 2026-01-05 15:20:28 +01:00
mmetc 113a6da0f0 appsec: inject dependencies, avoid globals (#4148) 2025-12-19 16:46:11 +01:00
mmetc 2302ec5fc0 fix typos in function name, error messages, comments (#4154) 2025-12-17 17:21:06 +01:00
mmetc 01988e743d leakybucket: reduce error verbosity, test for misconfiguration (#4087) 2025-12-15 14:16:01 +01:00
mmetc 58c2147769 refact logging configuration; add log_media="syslog" (#4045) 2025-11-26 16:38:20 +01:00
mmetc f7554cf006 refact load/save apic token: dependencies and sentinel errors (#4081) 2025-11-25 10:07:13 +01:00
mmetc 6a739941dc replace prom2json with native Prometheus parser and context-aware scraping in CLI metrics (#3932)
* deps: update prometheus client

* remove dependency on prom2json

* lint: protogetter
2025-11-21 13:16:59 +01:00
mmetc 409c15aeb0 refactg pkg/acquisition: split file.go (#4038) 2025-11-10 22:03:43 +01:00
mmetc 6a5e3a088f pkg/acquisition: refact journalctl datasource and unified retry loop (#4023) 2025-11-07 16:03:58 +01:00
mmetc 298e75b8df lint: nilaway, unnecessary pointers (#3951)
* lint: nilaway

* lint: nilaway, unnecessary pointers

This removes *log.Level from configuration structs and logging
helpers and switches to value log.Level everywhere. It simplifies
defaults and inheritance, removes reliance on ptr.Of, and avoids nil
checks. Uses PanicLevel (natural zero value) as sentinel instead of nil.
2025-10-23 13:51:40 +02:00
mmetc bab543fda4 CI: reset GTID before restoring mysql db (#3988) 2025-10-22 23:35:21 +02:00
mmetc 2f4d0398c7 cscli: allow "support dump" to run without hub index, add --fast option to skip cpu profiling (#3982)
* cscli: allow "support dump" to run without hub index, add --fast option to skip cpu profiling

* log.Info -> fmt.Fprint
2025-10-22 14:15:56 +02:00
mmetc 1a4de194cd CI: fix flaky cold logs test (#3942) 2025-10-02 13:05:47 +02:00
mmetc a028184199 refact pkg/acquisition: split DataSource interface (#3900)
* refact pkg/acquisition: split DataSource interface

* fix/add tests

* lint
2025-09-22 15:36:02 +02:00
mmetc 35a6f442c3 refact simulation: redundant use of pointers; log (stderr) -> print (stdout) (#3889)
* refact cscli simulation: redundant use of pointers; log (strerr) -> print (stdout)

* format
2025-09-13 00:10:16 +02:00
mmetc b110b60341 fix "cscli alerts list -s <scenario>" for alerts with no decisions (#3830) 2025-08-28 16:39:16 +02:00
mmetc ee64fea1f2 cscli setup: allow skipping service detection with $CROWDSEC_SETUP_UNATTENDED_DISABLE (#3822) 2025-08-25 11:36:04 +02:00
mmetc 9671da6dcb cscli setup: improve service detection and datasource validation (#3812) 2025-08-18 23:41:33 +02:00
mmetc be436d8617 move detect.yaml to /var/lib/crowdsec/data (#3797) 2025-08-08 16:26:24 +02:00
mmetc f93b996554 cscli setup: skip missing items, fix collection name (#3794) 2025-08-07 16:35:35 +02:00
mmetc 16f941cb9f cscli setup improvements (#3789)
* cscli setup:

- remove redundant detect options, keep only --force and --ignore
- use gopsutil instead of osinfo - it can recognize derived distributions
- detect systemd units even if masked or disabled

The goal is to detect what's installed and potentially configurable,
regardless if it's running, temporary disabled or not yet configured

* lint

* rename UnitEnabled -> UnitInstalled

* detect.yaml

* change Path.Exists("/etc/...") -> Host.PlatformFamily == "..."
2025-08-06 16:34:20 +02:00
mmetc 3f2709e83c cscli: remove "dashboard" command (#3004) 2025-08-06 16:05:29 +02:00
mmetc 7416c7363d remove the cscli_setup feature flag (#3784)
This was never used outside testing, should not impact anyone.
If someone really used the feature, it's not compatible anyway with the
previous version and they'll get an error at runtime.
2025-08-05 23:53:58 +02:00
mmetc 20053b779f cscli setup: new service detection and configuration (#3730) 2025-07-31 17:00:41 +02:00
57989ea84c feat: add swarm support to docker acquistion (#3744)
* feat: add swarm support to docker acquistion

* format

* merge issue

* test issue

* lint

* enhance: extract some functions for @mmetc

* test with regexp

* enhance: Handle invalid regexp instead of panic and add some test cases

* fix text + shorten error messages

* enhance: Disable context check

---------

Co-authored-by: marco <[email protected]>
Co-authored-by: Sebastien Blot <[email protected]>
2025-07-31 15:10:30 +01:00
mmetc 59df443301 cscli: print command name along with errors (#3768) 2025-07-31 14:34:24 +02:00
mmetc 76ea87c6ba refact whitelist/allowlist: net.IP to net/netip (#3683) 2025-07-30 14:03:16 +02:00
mmetc cf981319d9 improve datasource validation (goccy/go-yaml) (#3646) 2025-07-24 11:18:35 +02:00
Laurence Jones 1d89310e02 fix: normalize scope within range to ensure allowlist check (#3735) 2025-07-22 10:39:22 +02:00
Laurence Jones 798707693c cscli: Add allowlist check (#3684) 2025-07-09 13:49:27 +02:00
mmetc 0490986924 pkg/csplugin: constructors for PluginConfig, PluginConfigList (#3640) 2025-07-09 10:32:09 +02:00
mmetc 958f9a7d76 update github.com/jedib0t/go-pretty/ (#3705) 2025-06-27 15:09:18 +02:00