CI/CD link checks

Fail a build when your code, docs or config link to a malicious host. The action reads every link in the repository, groups them by host, and has LinkThreatScan score each host; a host scoring below your organization's threshold (3,000 until you change it — a host on a threat list scores 1,000 at most) fails the step, with an annotation on every line that links to it. For organizations: it takes an organization's API key, on a subscribed organization.

GitHub Action

Create a key on your organization's API keys page, add it to the repository as the Actions secret LINKTHREATSCAN_API_KEY, then add a workflow:

name: Link scan

on:
  push:
    branches: [main]
  pull_request:

jobs:
  links:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: decentralisoft/link-scanner-cicd-action@v1
        with:
          api-key: ${{ secrets.LINKTHREATSCAN_API_KEY }}
          files: |
            .
            !docs/archive/**
          exclude-hosts: github.com, npmjs.com

The threshold and the reuse window are set on linkthreatscan.com, on the organization's CI/CD page, not in the workflow: a host scoring below the minimum score (0–10,000, 3,000 to start) fails, and a result the organization got for a host within the reuse window (24 hours to start; 0 always scans, at most 30 days) answers again without a new scan. The same page lists the hosts of each repository's latest run, and any of them can be switched off: later runs skip it.

  • filesPaths, directories or globs to read, one per line; ! excludes. Default .. .git and node_modules are never read; lockfiles, source maps and binaries are skipped.
  • urlsMore URLs to check, one per line.
  • exclude-hostsHosts to skip; example.org also skips its subdomains, *.cdn.example.org is a glob.
  • fail-on-malicious / fail-on-unreachable / fail-on-errorWhether malicious hosts (default true), hosts that cannot be scanned (default false) and failed checks (default true) fail the step.
  • max-hostsRefuse to start above this many hosts. Default 500.
  • privateWhether new scans' reports are private to the organization. Default: the organization's setting.

Outputs: result (clean, malicious, error or none), links, hosts, malicious, unreachable, errors and report — the path to a JSON report with every host's verdict and every file and line linking to it. The job summary lists each host. Every run shows on the organization's CI/CD page, by repository and run. The action on GitHub →

GitLab CI and the command line

The same checks from any pipeline or terminal with Node 20+: npx linkthreatscan scan [paths…] or npx linkthreatscan check <url>…. Exit code 0 is clean, 1 a malicious link, 2 an error. On GitLab CI the checks carry the project, commit and pipeline.

link-check:
  image: node:22
  script:
    - npx linkthreatscan scan
  variables:
    LINKTHREATSCAN_API_KEY: $LINKTHREATSCAN_API_KEY

What is sent, and what it costs

  • Only the originEach host is checked once per run, as https://host/. Paths and query strings, which can carry tokens, never leave the runner.
  • SkippedHosts that cannot be on the public internet (localhost, private addresses, .local, .test, .internal…), the example.com documentation domains, and XML namespace URIs such as www.w3.org/2000/svg.
  • ReusedA host your organization checked in CI within its reuse window is answered from that full scan: no new scan, nothing counted.
  • Switched offA host switched off for the repository on the CI/CD page is answered skipped: no scan, never a failure.
  • FreshEvery other host is one full scan on the organization's daily volume, recorded with its other API scans and sent to its webhooks.

The endpoint: POST /api/v1/ci/check

One host per call, with an organization's key as Authorization: Bearer.

curl -X POST https://linkthreatscan.com/api/v1/ci/check \
  -H "Authorization: Bearer YOUR_ORGANIZATION_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://cdn.example.org/",
       "ci": {"provider": "github", "repository": "acme/app", "runId": "42"}}'
  • urlRequired. Any http(s) URL; only its origin is scanned and its host is the reuse key.
  • ciOptional: provider (github, gitlab, other), repository (owner/name, required inside ci), ref, commit, workflow, runId, runAttempt, runUrl (https), actor.
  • batchIdOptional UUID, the same for every host of one run: it groups them on the CI/CD page.
  • linksOptional: how many links point at the host, for the CI/CD page.
  • privateOptional: whether a fresh scan's report is private. Default: the organization's setting.
  • bareIpAccepted and ignored (sent by the action 1.2). An IP address is asked first: if nothing answers it is unreachable, and costs no scan; an IP with a port is a host of its own (203.0.113.7:8000).
{
  "host": "cdn.example.org",
  "url": "https://cdn.example.org/",
  "verdict": "passed",
  "score": 8240,
  "risk": "low",
  "minScore": 3000,
  "threats": [],
  "scanId": "3f0c…",
  "reportUrl": "https://linkthreatscan.com/s/3f0c…",
  "scannedAt": "2026-11-12T09:41:07Z",
  "reused": true,
  "checkId": "a81d…"
}

verdict is passed or failed against minScore — the organization's threshold, 3000 until it is changed on the CI/CD page — or skipped for a host switched off for the repository (no score, no report). Older clients may still send minScore and maxAge; they are ignored.

  • 400A malformed field; the message names it.
  • 401 / 402An invalid key / an organization without a subscription.
  • 403 organization_requiredA personal key: CI/CD checks are for organizations.
  • 422 unreachableThe host does not resolve, or not to a public address: nothing to scan.
  • 429Per-minute limits (600 checks, and the API's limit on fresh scans) answer with Retry-After; the daily volume without it.
  • 503The scanner is busy; retry after Retry-After. Nothing was counted.