Skip to content

Bound threat-feed staleness and stop silently reporting "no threats" when the feed never loaded #353

Description

@N-thnI

Description

Distinguish an empty threat feed from a broken one.

Problem Statement

In anomaly-detector/src/audit-guard/threat-feed-fetcher.ts: when no feed URL is configured, updateFeed logs one console.warn and returns (lines 14-17). isThreat() then returns false forever, so THREAT_FEED_MATCH never fires and nothing distinguishes "no threats" from "no feed".

When all fetches fail, the code keeps this.threatAddresses indefinitely — lastUpdated is recorded but never checked, so a feed broken for weeks keeps serving stale data while the alert text claims "matches active blocklist in threat feed".

Finally, setMockThreats (line 71) is a public method on the production class that makes isThreat consult only the mock set — so a stray call disables real matching entirely.

Proposed Changes

  • Expose a health/staleness signal (isStale(maxAgeMs)) and raise a dedicated alert when the feed is unconfigured or older than a configured max age
  • Validate feed URLs (https, parseable) before fetching and reject the rest
  • Move setMockThreats/clearMockThreats behind a test-only subclass or constructor-injected source rather than a public production method

Technical Implementation Scaffolding

  • Target Repository: vero-audit-guard
  • Target Path: anomaly-detector/src/audit-guard/threat-feed-fetcher.ts
  • Branch Naming: fix/issue--threat-feed-staleness
  • Authority Context: Security — silent detection gap

Acceptance Criteria

  • With no THREAT_FEED_URL(S) set, a run emits a distinguishable "feed unconfigured" alert, not silence
  • With lastUpdated older than the max age, isThreat results are flagged stale and an alert is raised
  • isThreat cannot be neutered by production code paths

Definition of Done

  • Reviewed by lead maintainer
  • Pull request merged via verified status check

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions