Sentinel · security scanner
defang-sentinel
Defang and refang indicators of compromise, and stop live malicious links from getting into threat reports, tickets and docs.
npm i -D @mrlouiswright/defang-sentinelPublished to GitHub Packages: add @mrlouiswright:registry=https://npm.pkg.github.com to .npmrc first (installing needs a token with read:packages).
What it checks
- DetectsURLs (http/https/ftp/sftp/ws), domains (validated against gTLD/ccTLD lists, with file names such as
setup.pyignored), public IPv4/IPv6 addresses (private, loopback and documentation ranges ignored unless--include-private… - Clickable link detection(
live-link, high): Markdown linkstext, reference links, autolinks<https://…>and HTMLhrefattributes. Defanged link text doesn't help if the href is still live. - Half-defanged detection(
partial-defang):hxxp://evil.comorevil[.]com.badhost.rulook safe at a glance but still contain a live host. - Reference allowlistlinks to MITRE ATT&CK, NVD, CVE.org, CISA, NCSC, VirusTotal, abuse.ch, urlscan, GitHub and others are expected in reports and allowed by default (
--no-reference-domainsturns this off)… - Defang styles(
--style):brackets(default)hxxps://www[.]evil[.]com/a.php,fullhxxps[://]www[.]evil[.]com/a[.]php,dothxxps://www[dot]evil[dot]com,minimalhxxps://www.evil[.]com. Emails becomeuser[@]domain[.]com… - Refangunderstands
hxxp,hXXps,h[xx]p,fxp,[.],(.),{.},[dot],(dot),\.,[:],[://],[@],(at),[at].
Quick usage
CLI
echo 'C2: https://evil.com/gate.php 45.9.148.3' | npx defang-sentinel defang -
# C2: hxxps://evil[.]com/gate.php 45[.]9[.]148[.]3
npx defang-sentinel refang iocs.txt > iocs-live.txt
npx defang-sentinel defang --write reports/2026-10-apt.md
npx defang-sentinel reports/ --skip-code --ignore-domain 'mycompany.com,*.mycompany.com'
API
import { defangText, refang, defangValue, check } from 'defang-sentinel';
defangText('see https://evil.com', { style: 'brackets' }).text; // 'see hxxps://evil[.]com'
refang('hxxps[://]evil[.]com'); // 'https://evil.com'
defangValue('bad@phish.ru'); // 'bad[@]phish[.]ru'
const report = check(['reports/'], { skipCode: true });
Every option is documented in the defang-sentinel docs.
CI / GitHub Action
permissions:
contents: read
security-events: write # only for the SARIF upload
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with: { persist-credentials: false }
- uses: MrLouisWright/defang-sentinel@v1
with:
targets: 'reports/'
fail-on: medium
sarif: defang-sentinel.sarif
- uses: github/codeql-action/upload-sarif@v3
if: always()
with: { sarif_file: defang-sentinel.sarif }