Repository navigation
fix: use the hub mirror when the CrowdSec hub CDN is unreachable - #1798
Merged
Merged
Conversation
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep GitHub App |
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! |
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
Addresses #1739 and #1738.
Makes CrowdSec's hub requests fall back to the GitHub mirror when the hub CDN is unreachable, and tells the presets list when the hub was not used.
hub_unreachable.hub update, item installs, upgrades): a failed or timed-out attempt is retried once through a temporary copy of the cscli config that points at the mirror. The copy is mode 0600, always removed, and never appears in the file list, export or import. A configuration that already sets its own hub address is left alone (no retry). After the mirror answers, cscli goes to the mirror first for up to 10 minutes..docker/cscli-hub-mirror.sh), with bounded time for each step.GET /admin/crowdsec/presetsgainshub_offline. When the hub list was not used the page shows one quiet note. Hub-only presets that are not downloaded are shown greyed out and are skipped by the auto-select.<mirror>/api/index.jsonaddress is no longer tried.Known limits (documented): the 10-minute mirror-first window applies to cscli only, so during an outage each presets list or download request spends a few extra seconds on the hanging address first. On a very slow link,
hub updateandhub upgradeat start split their time between the main address and the mirror.Testing
scripts/cscli_hub_mirror_test.sh, 118 checks) passes under bash, dash and busybox sh; it runs in the newcscli-hub-mirror-testsjob inquality-checks.yml.security-tests(107 passed), whitelist onfirefox(12 passed).hub_offlinetrue, 503hub_unreachable). Details indocs/reports/qa_report.md.Follow-ups filed
#1796 (apply during an in-flight restore waits), #1797 (export warns per symlink).