Repository navigation
feat(cli): send threatcrush/<version> user agent to our API - #368
Merged
Merged
Conversation
Node's fetch says "node", so threatcrush.com could not tell CLI versions apart or tell the CLI from any other Node script. The CLI and daemon now wrap fetch once at startup: requests to the configured API host and *.threatcrush.com that set no User-Agent carry "threatcrush/<version> (node <ver>; <platform>)". Third-party hosts keep Node's default. scripts threatcrush-nightly already parses this UA for CLI users by version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThreatCrush Security Scan22 finding(s) HIGH/CRITICAL: 1 | MEDIUM: 12 | LOW: 9
Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
Node's fetch sends the user agent
node, so threatcrush.com can't tell CLI versions apart, or tell the CLI from any other Node script. The new threatcrush-nightly report (profullstack/scripts#35) counts CLI users from nginx and needs the version.apps/cli/src/core/user-agent.ts:installUserAgent()wrapsglobalThis.fetchonce and is idempotent. Requests to the configured API host (THREATCRUSH_API_URL) or to threatcrush.com and its subdomains that set no User-Agent getthreatcrush/<version> (node <ver>; <platform>). Third-party hosts (abuse.ch, Discord, PagerDuty, scan targets) keep Node's default, so nothing new goes to anyone else. A User-Agent set by the caller is never replaced.src/index.ts(the CLI) andsrc/daemon-entry.ts(threatcrushd).Tests: new
user-agent.test.tscovers host matching, header merging, idempotence and leaving third parties alone. The full CLI suite passes (71 files, 672 tests), as dotsc --noEmit,tsupand the pre-commit hook. The builtdist/index.js orgs listagainst a local server sentthreatcrush/0.13.51 (node v24.22.1; linux).🤖 Generated with Claude Code