Codebase endpoint pre-screening extracts public domains from pull request diffs (.env templates, Terraform, Bicep, Helm charts, webhooks and app config) locally inside your CI runner, then queries outside-in risk APIs before merge. Checking domain age, RDAP expiry, dangling CNAMEs, DNSBL reputation and ASN routing catches supply-chain and takeover risks that SAST and SCA scanners never inspect.
- Who it is for
- AppSec, DevSecOps and platform teams reviewing PRs that add third-party APIs, webhooks or DNS records.
- What it covers
- A local PR diff extractor that screens new public hostnames against live RDAP, takeover, CT log and DNSBL checks.
- Why it matters
- SAST checks code and SCA checks packages, leaving typo-squatted APIs, expiring partner domains and dangling CNAMEs unverified.
- How to integrate
- Run a 30-line script in GitHub Actions, GitLab CI or Azure DevOps that sends only public hostnames to the middle.network API.
Test a partner hostname for domain age, dangling cloud CNAMEs or DNSBL listings before wiring it into CI.
- Your CI runner extracts public hostnames from the PR diff.
- middle.network checks RDAP age, takeovers and blocklists.
- High-risk domains annotate the PR before merge.
Why SAST and SCA miss external domain and endpoint risk
Repositories reference dozens of external hostnames: OAuth callbacks, payment webhooks, analytics scripts, object storage buckets and third-party SaaS APIs. SAST and SCA scan syntax and lockfiles, leaving every external domain in config and Infrastructure as Code unverified.
When someone mistypes a vendor hostname, pastes a staging URL pointing at a deleted cloud app, or wires up a four-day-old domain, every internal unit test still passes. The failure only shows up in production as data leakage, broken webhooks or subdomain takeover.
- Internal scanners check code and declared cloud templates.
- Middle.network sweeps every public internet layer from outside in.
What risks to flag before a pull request merges
| Risk signal | Why it matters | API check | Suggested PR gate |
|---|---|---|---|
| Newly registered domain (< 30 days) | Strong indicator of typo-squatting, lookalike SaaS domains or unvetted vendors. | domain-age | Warn or require AppSec approval |
| Imminent expiry (< 30 days) or NXDOMAIN | Hardcoded dead or expiring domains can be drop-caught by attackers to hijack traffic. | domain-age, whois | Fail PR build |
| Claimable dangling CNAME | Subdomains pointing at deleted Azure, AWS, GitHub Pages or Netlify resources can be taken over. | subdomains | Fail PR build |
| DNSBL / threat list hit | Indicates compromised infrastructure, active spam/malware or abusive hosting. | blacklist | Fail PR build |
| Unexpected ASN or jurisdiction | Flags endpoints routed through unapproved cloud providers or regions for regulated workloads. | asn, geoip | Warn for compliance review |
| Unexpected certificate issuer | Certificate Transparency logs reveal unauthorised or shadow subdomains and CAs. | ct-logs | Info / audit log |
How to wire privacy-preserving endpoint pre-screening in CI
Keep source code and secrets strictly inside your CI runner. Use a short Node.js script on git diff to extract candidate hostnames from added lines, strip private IP ranges and placeholder suffixes (.local, .test, .example, localhost), and call the middle.network API for each unique public domain.
// scripts/prescreen-diff.mjs - run on PR changed files
import { execSync } from 'node:child_process';
const API = 'https://api.middle.network/v1/tools';
const KEY = process.env.MN_API_KEY;
const IGNORE = /(?:localhost|\.local|\.internal|\.test|\.example|example\.(?:com|org|net))$/i;
// 1. Extract public hostnames only from added lines in the PR diff
const diff = execSync('git diff --unified=0 origin/main...HEAD', { encoding: 'utf8' });
const hosts = new Set();
for (const line of diff.split('\n')) {
if (!line.startsWith('+') || line.startsWith('+++')) continue;
for (const m of line.matchAll(/https?:\/\/([a-z0-9.-]+\.[a-z]{2,})/gi)) {
const h = m[1].toLowerCase().replace(/\.$/, '');
if (!IGNORE.test(h)) hosts.add(h);
}
}
// 2. Pre-screen each unique public domain via /v1/
const call = async (tool, input) => (await fetch(`${API}/${tool}`, {
method: 'POST',
headers: { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ input }),
})).json();
let failed = false;
for (const domain of hosts) {
const [age, bl, subs] = await Promise.all([
call('domain-age', { domain }),
call('blacklist', { target: domain }),
call('subdomains', { domain }),
]);
const issues = [];
if (age.data?.ageDays != null && age.data.ageDays < 30) issues.push(`domain only ${age.data.ageDays}d old`);
if (age.data?.expiresInDays != null && age.data.expiresInDays < 30) issues.push(`expires in ${age.data.expiresInDays}d`);
if (bl.status === 'fail') issues.push(bl.summary.plain);
if (subs.status === 'fail') issues.push(subs.summary.plain);
console.log(`${issues.length ? 'FAIL' : 'PASS'} ${domain} - ${issues.join(' | ') || age.summary.plain}`);
if (issues.length) failed = true;
}
if (failed) process.exit(1);# .github/workflows/endpoint-prescreen.yml
name: External Endpoint Pre-Screen
on:
pull_request:
paths: ['**/*.tf', '**/*.bicep', '**/*.yaml', '**/*.yml', '**/*.json', '**/.env*']
jobs:
prescreen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Pre-screen newly added public domains
env:
MN_API_KEY: ${{ secrets.MN_API_KEY }}
run: node scripts/prescreen-diff.mjsTurning raw findings into action for reviewers and auditors
Every middle.network response returns summary.plain for pull request comments and summary.tech plus raw data for security logs. When a check flags a risk, print summary.plain in the PR summary so the developer understands why the merge paused without decoding RDAP or DNSBL codes, and archive the JSON artifact alongside your release evidence for ISO 27001 A.5.19 and A.8.8.
How middle.network makes PR endpoint pre-screening practical
Stitching together RDAP clients, DNS resolvers, CT log scrapers and blocklists inside a CI runner is brittle and noisy. Our REST API puts live RDAP domain-age, cloud CNAME takeover fingerprinting, ASN/GeoIP and self-testing DNSBL checks behind one fast JSON contract - while your source code never leaves your runner.
Only public hostnames hit our API; private IPs, secrets and source files stay inside your build environment.
We resolve Certificate Transparency names live and match CNAME targets against claimable cloud-service fingerprints.
When public CT logs or registries rate-limit, limited: true lets your pipeline warn cleanly instead of failing blindly.
Questions people ask
Sources and further reading
Written by the middle.network engineering team (Middle Enterprises Pty Ltd, ABN 88 633 909 412), who build and operate these tools. Last reviewed 2026-11-27.