Repository navigation
feat: list installed CrowdSec hub items in exports and offer to install missing ones after an import - #1561
Merged
Conversation
An import whose profiles reference notifications that the archive does not define is now refused before anything is changed.
An export now lists the installed hub items by name and type, and an import reports which of them are not installed on the target system.
A new admin action installs hub items that an imported configuration lists but the system does not have, one item at a time, and reports what happened.
After an import, the CrowdSec page lists the hub items the export names but this system does not have, and offers to install them with a clear result.
Explain the installed hub item list in an export, the action that installs missing items after an import, and the check on notification references.
Contributor
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Contributor
✅ Supply Chain Verification Results✅ PASSED 📦 SBOM Summary
🔍 Vulnerability Scan
📎 Artifacts
Generated by Supply Chain Verification workflow • View Details |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Wikid82
marked this pull request as ready for review
October 11, 2026 06:34
This was referenced Oct 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes the CrowdSec export/import follow-ups from #1549/#1553 in one PR. The commits are ordered fixes first, then the feature.
Closes #1545, closes #1546, closes #1547
promptCrowdsecFilename(t, defaultName)takes the translation function likerateLimit.ts.name:field inside the file, multi-document files define every name, and only lowercase.yaml/.ymlfiles directly innotifications/count. It skips instead of refusing when it cannot decide (unparsable files, redirected paths, oversized entries, no profiles file). Refusal returns a fixed 422 message listing at most 10 sorted names. Redaction of notification values stays a follow-up (feat: redact sensitive values in notification files when exporting a CrowdSec configuration #1551).charon-hub-items.json, derived from the installed links, nocsclicall, never extracted to disk). An import reportshub_items.missing(items in the export that this system lacks). A new admin actionPOST /api/v1/admin/crowdsec/hub-items/restoreinstalls them from the official hub, one item at a time: strict mixed-caseowner/namevalidation and a type allowlist, literalcscliwith no shell, a single-flight guard (409), the data lock held for one hub operation at a time with a per-item time bound, verified installs, retryablenot_attempteditems with aremainingcount, and a best-effort reload on a detached context. The CrowdSec page shows an inline, non-intrusive panel after an import (button "Install missing hub items", "Install remaining").ValidHubItemName(mixed case) for the manifest and restore, with the strict lowercaseValidPresetItemNamekept for curated presets;verifyItemextracted as an exported function;ParseYAMLDocumentsmoved into thecrowdsecpackage.Testing
go test -raceon the touched packages and-count=2/3on the new tests; the full handlers package passes (387 s). Local CodeQL: Go "4 suppressed, 0 blocking" (existing entries only), JS 0.--project=security-tests, no fixme left): the hub-items, import, config, diagnostics, file-editor and zzz import specs pass on a freshcharon-e2e. Valid restore requests and the 409 are covered by Go tests with a fake executor, because the E2E container's hub reachability is environment-dependent and a real restore installs items.docs/reports/qa_report.md) found no critical, high or medium issues. It verified the endpoint live: unauthenticated 401,userrole 403, hostile names (flags,.., NUL, newlines, look-alike characters,=, spaces, over-long) all 400, oversized body 413, alias-expansion documents rejected in 1-2 ms.Manual check in throwaway containers (not the live proxy), real hub, HEAD before the final docs/QA commits
not_found,reloaded: true, CrowdSec kept running (same PID)hub_items.missinglisted the 5 extra items; B's links unchanged (import installs nothing)missingalready_installed--network none)Notes
crowdsec -tfails as soon as a profile names any notification; the pre-import check cannot change that (see feat: redact sensitive values in notification files when exporting a CrowdSec configuration #1551).ValidPresetItemNamenow also rejects..and over-long names (no bundled preset is affected).config/folder), and a frontend test-timeout issue for two load-sensitive tests. chore: use filepath.Rel for the CrowdSec diagnostics path containment checks #1541 is with a contributor in crowdsec: enforce strict path containment in diagnostics handlers #1543.