securitytxt-sentinel

Sentinel · security scanner

securitytxt-sentinel

Validate security.txt (RFC 9116) and robots.txt for your domains, or as local files in CI before you deploy them.

npm i -D @mrlouiswright/securitytxt-sentinel

Published to GitHub Packages: add @mrlouiswright:registry=https://npm.pkg.github.com to .npmrc first (installing needs a token with read:packages).

What it checks

  • missingNo security.txt at /.well-known/security.txt
  • soft-404security.txt URL returns HTML or an error page instead of the file
  • not-httpssecurity.txt is not served over HTTPS
  • missing-contactNo Contact field (required)
  • missing-expiresNo Expires field (required)
  • expiredExpires date is in the past
  • invalid-expiresExpires is not an RFC 3339 date-time
  • expires-soonExpires within the warning window (default 30 days)

Quick usage

CLI

npx securitytxt-sentinel example.com www.example.org
npx securitytxt-sentinel example.com --no-robots --warn-days 60 --fail-on medium
npx securitytxt-sentinel public/.well-known/security.txt --canonical https://example.com/.well-known/security.txt
npx securitytxt-sentinel public/robots.txt

API

import { check, exitCode } from 'securitytxt-sentinel';
const report = await check(['example.com'], { warnDays: 45 });
console.log(report.targets[0].summary.expires);
process.exitCode = exitCode(report, 'high');

Every option is documented in the securitytxt-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/securitytxt-sentinel@v1
    with:
      targets: 'example.com'
      fail-on: high
      sarif: securitytxt-sentinel.sarif
  - uses: github/codeql-action/upload-sarif@v3
    if: always()
    with: { sarif_file: securitytxt-sentinel.sarif }