Sentinel · security scanner
redirect-sentinel
Find open redirects and mixed content in a built site (offline) or a live crawl.
npm i -D @mrlouiswright/redirect-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
- Mixed contenton HTTPS pages:
http://scripts, stylesheets,@import, iframes, objects and<base>(active, high); images,srcset, media, icons and CSSurl()(passive, medium); forms posting tohttp://;http://links (low, once per host)… - Client-side open redirects
location = …,location.assign/replace,window.open,router.push,navigatefed bylocation.search/hash,URLSearchParams,document.referrerorwindow.name, directly or through a variable… - Server redirect rulesNetlify
_redirectsandnetlify.toml,vercel.json/next.config.js, nginx (return 302 $arg_url) and Apache (RewriteRule … %1 [R]) rules whose destination host comes from the request. - Linksthat pass a full URL in a redirect-style parameter (
next,url,returnTo,redirect_uri,continue,goto…). - Crawl onlyredirect chains longer than 3 hops,
https://→http://downgrades (including meta refresh),http://not redirecting tohttps://, and same-origin JavaScript files. --probe(crawl only, opt-in): for each same-origin link with a redirect-style parameter, requests it withhttps://redirect-sentinel.invalid/,//redirect-sentinel.invalid/and similar payloads, without following the redirect…
Quick usage
CLI
npx redirect-sentinel dist/ # offline, in CI after the build
npx redirect-sentinel https://staging.example.com --max-pages 200
npx redirect-sentinel https://staging.example.com --probe --fail-on high
API
import { check, analyzeHtml, analyzeJs } from 'redirect-sentinel';
const report = await check(['dist'], { severity: { 'insecure-link': 'off' } });
Every option is documented in the redirect-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/redirect-sentinel@v1
with:
targets: 'dist'
fail-on: high
sarif: redirect-sentinel.sarif
- uses: github/codeql-action/upload-sarif@v3
if: always()
with: { sarif_file: redirect-sentinel.sarif }