fix: cache lookup fails after update-cache with custom URL in offline environments#467
Merged
thomaspatzke merged 1 commit intomainfrom Apr 21, 2026
Merged
Conversation
…e_d3fend
Previously the cache key included the URL (e.g. "mitre_attack_data_./enterprise-attack.json"),
so data pre-populated via `update-cache --url mitre_attack:./file.json` was stored under a
URL-specific key. When `sigma check` ran in a fresh process with no custom URL set, it looked
for "mitre_attack_data_default" - a different key - got a cache miss, and attempted a network
download, breaking offline/restricted-network usage.
Fix: use a stable key ("mitre_attack_data" / "mitre_d3fend_data") so any pre-populated cache
entry is found regardless of the source URL. set_url() already calls clear_cache() to force
re-download when the source changes, so correctness is maintained.
Agent-Logs-Url: https://github.com/SigmaHQ/pySigma/sessions/55649932-4d52-4cc7-8e19-a843bfa99b0b
Co-authored-by: thomaspatzke <1845601+thomaspatzke@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
thomaspatzke
April 21, 2026 13:02
View session
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.
After pre-populating the cache via
sigma pysigma update-cache --url mitre_attack:"./file.json", subsequentsigma checkruns in a fresh process fail with a network error instead of using the cached data.Root cause: The diskcache key embedded the source URL —
f"mitre_attack_data_{_custom_url or 'default'}". Data cached with a custom URL (key:"mitre_attack_data_./file.json") is invisible to a fresh process where_custom_urlisNone(key:"mitre_attack_data_default"), causing a miss and a download attempt.Changes
sigma/data/mitre_attack.py— replace URL-dependent cache key with stable constant"mitre_attack_data"sigma/data/mitre_d3fend.py— same fix, stable key"mitre_d3fend_data"tests/test_validators_tags.py— add two tests that explicitly simulate the offline workflow: cache via custom URL → reset_custom_urltoNone→ assert cached data is returned without a downloadset_url()already callsclear_cache(), so cache invalidation when switching sources is unaffected.