HomeBlogHow to Conduct a Security Audit...

Engineering Guide · 9 min read · September 14, 2026

How to Conduct a Security Audit Before Launching a Website

Most launch-day breaches stem from rushed configuration drift rather than sophisticated zero-days. This hands-on pre-launch audit covers artifact hygiene, privilege isolation, webhook validation, DNS takeover checks, and indexation safeguards startups can execute in one afternoon.

Author
Smit Desai
Published
September 14, 2026
Read time
9 min read
Topic
Security & SEO
Services
Custom Web · Mobile Apps · All Services

Startups rarely suffer launch-week compromises because an attacker burned an exotic kernel exploit. Incidents happen because someone disabled SSL verification during an API integration on Wednesday, left a .git directory readable under the web root, or shipped an unauthenticated staging subdomain that Google indexed overnight.

Having shipped software since 2017 across 170+ client deliveries—and hardened server operations across a Finnish partner's fleet of 300+ WordPress installations—I treat the final 72 hours before public DNS cutover as a structured verification gate. Half a day of disciplined probing catches the flaws that actually break new products.

1. Lock Down DNS Records and Edge Certificates

Automated crawlers monitor Certificate Transparency feeds continuously. Within moments of issuing an HTTPS certificate for your brand domain, scanners begin enumerating subdomains and probing old endpoints.

Hunt Down Dangling CNAMEs

If your marketing team tested a third-party landing page builder at promo.yourdomain.com, deleted the SaaS trial, and forgot the CNAME record in Cloudflare or Route 53, an outsider can register that same tenant name and serve phishing pages on your domain.

# Audit every DNS record before opening public traffic
dig +noall +answer yourdomain.com ANY
dig +noall +answer staging.yourdomain.com A CNAME
dig +short yourdomain.com CAA

Remove orphaned CNAME entries immediately. Add a CAA record restricting certificate issuance solely to your chosen Certificate Authority (letsencrypt.org or amazon.com), and verify TLS 1.0 and 1.1 remain disabled at the load balancer.

Gate Staging Subdomains Properly

Never rely on an obscure hostname like beta-v2-internal.yourdomain.com for privacy. Protect non-production environments with HTTP Basic Auth or IP allowlists, and pair that with an X-Robots-Tag: noindex, nofollow response header so pre-release builds never leak into search results.

2. Inspect Build Artifacts and Environment Boundaries

Frontend bundlers and misconfigured Nginx blocks quietly leak credentials that backend engineers assume are private.

Strip Source Maps and Debug Tooling

Check whether vite build or next build publishes .js.map files to your public CDN. Source maps expose unreleased feature flags, internal endpoint paths, and proprietary business logic. Configure your bundler to upload maps only to your error tracker (such as Sentry) rather than serving them publicly.

At the same time, verify from an external cellular connection—never your office VPN—that diagnostic tools and dotfiles return 403 or 404:

for uri in "/.env" "/.git/config" "/composer.json" "/telescope" "/horizon" "/_debugbar"; do
  status=$(curl -sS -o /dev/null -w "%{http_code}" "https://yourdomain.com${uri}")
  printf "%-18s %s\n" "$uri" "$status"
done

Audit Public Prefixes and Git History

Inspect compiled client bundles for accidental secret inclusion (VITE_, NEXT_PUBLIC_, or REACT_APP_ variables containing private tokens). Run gitleaks detect --redact across your commit log; if an API key ever entered git history—even if deleted in a later commit—rotate that credential immediately before launch.

3. Verify Privilege Separation Across Users and Databases

Broken authorization remains the top risk tracked by the OWASP Top Ten, especially when founders rush multi-user dashboards out the door.

Boundary Layer Common Startup Oversight Hardened Launch Baseline
Tenant / Record Access Controller checks auth() only, skipping ownership validation Enforce policy checks comparing record.account_id === user.account_id on every read/write
Role Escalation Request body accepts role=admin via mass assignment Explicitly whitelist permitted fields in form requests or DTO schemas
Database Credentials Web app connects as postgres or schema-owner superuser Separate a DML-only runtime role (SELECT, INSERT, UPDATE, DELETE) from migration privileges
Session & Token Hygiene JWTs never expire or cookies omit SameSite flags Set HttpOnly, Secure, SameSite=Lax, rotate session IDs on login, and bound token TTLs
Cross-Origin Rules Access-Control-Allow-Origin reflects any incoming Origin Maintain a strict static array of approved frontend origins

Run a Two-Account Replay Test

Open two incognito sessions: Account A (organization admin) and Account B (basic viewer in a different workspace). Trigger sensitive mutations as Account A—exporting invoices, inviting teammates, updating billing emails—copy each request via browser DevTools as curl, replace only the session cookie or Bearer header with Account B's token, and verify the backend refuses every single call with 403.

4. Defend Webhooks, Uploads, and Metered Endpoints

Launch announcements attract automated abuse within hours: carding bots hammering checkout routes, credential stuffers hitting login forms, and spoofed webhook payloads attempting to mark unpaid orders as settled.

Enforce Constant-Time Webhook Verification

Never accept inbound billing or messaging callbacks solely because they arrive at an unlisted route. Validate the cryptographic signature header over the raw request body and enforce a tight timestamp tolerance:

import crypto from "node:crypto";

export function verifyWebhookHmac(
  rawBody: Buffer,
  headerSig: string,
  secret: string
): boolean {
  const expected = crypto
    .createHmac("sha256", secret)
    .update(rawBody)
    .digest("hex");

  const sigBuffer = Buffer.from(headerSig, "hex");
  const expectedBuffer = Buffer.from(expected, "hex");

  if (sigBuffer.length !== expectedBuffer.length) {
    return false;
  }

  return crypto.timingSafeEqual(sigBuffer, expectedBuffer);
}

Combine signature checks with idempotency keys stored in Redis or PostgreSQL so replayed deliveries cannot double-credit a customer balance.

Throttle Costly Routes and Lock Down Uploads

  • Rate limiting: Apply sliding-window limits to login, password recovery, SMS OTP triggers, and any LLM-backed endpoint that incurs per-request vendor fees.
  • Upload isolation: Inspect file magic bytes server-side, rewrite filenames to random UUIDs, and store customer files on private object buckets served via short-lived signed URLs rather than inside executable web directories. For deeper PHP-specific protections, review the complete Laravel security audit checklist.
  • SSRF protection: If users submit profile URLs or webhook destinations that your backend fetches, block private IPv4/IPv6 ranges (169.254.169.254, 10.0.0.0/8, 127.0.0.1) at the HTTP client or egress proxy so attackers cannot query cloud instance metadata.

5. Check Infrastructure Ports, Backups, and Search Readiness

Before pointing production traffic at your stack, verify host networking and search-crawl fundamentals together.

  1. Close internal data ports: Confirm PostgreSQL (5432), MySQL (3306), and Redis (6379) bind exclusively to private VPC subnets or loopback interfaces—never 0.0.0.0. Disable password SSH logins and require key-based authentication or AWS SSM sessions.
  2. Test a live database restore: Snapshot schedules mean nothing until verified. Restore yesterday's backup into a disposable database instance to confirm encryption keys, permissions, and schema integrity actually work under pressure.
  3. Align security headers with SEO: Enable Strict-Transport-Security, X-Content-Type-Options: nosniff, and Referrer-Policy, then check rendered production pages against Google's SEO Starter Guide and Core Web Vitals benchmarks. Confirm robots.txt allows crawling on the live domain, canonical tags match https://, and security rules do not accidentally block Googlebot from fetching CSS or JS bundles.
  4. Automate dependency vulnerability checks: Wire composer audit or npm audit --omit=dev into CI so critical CVEs surface before merge. When operating CMS platforms rather than custom apps, server-level isolation matters even more—a lesson reinforced daily while managing 300+ WordPress sites at server level.

If your codebase runs on aging dependencies where patching headers or upgrading auth libraries breaks legacy templates, scheduling an old software upgrade alongside launch prep prevents compounding risk.

Ship Your Launch Review With SmitDev

Security reviews fail when treated as a 200-row spreadsheet nobody finishes. Through custom web application development and targeted pre-launch audits, I inspect live infrastructure, database permissions, webhook signatures, and CI gates directly in your codebase before traffic arrives.

Whether you need a lean $399 7-day business website built cleanly from day one, hands-on hardening sprints at $55/day (8–9 hours of senior engineering), or $1,999/month dedicated product delivery, SmitDev gives startups direct principal-level execution. Browse engineering services or contact SmitDev to schedule your pre-launch audit this week.

Written by Smit Desai · Principal Full-Stack & FDSE

8+ years shipping production systems · 171 case studies · 300+ WordPress servers managed for Finland partners.

Next Steps and Recommended Resources

Next Steps · Recommended Resources

Pillar 1 · Infrastructure Proof

300+ WordPress & Cloud Server Fleet

From server-level management of 300+ WordPress sites for a Finland client to PostgreSQL query tuning (3,982 -> 52 queries).

Pillar 2 · Legacy Rescue

Upgrade Old Software (10 Hrs Free)

Audit bottlenecks, eliminate security vulnerabilities, and stabilize production servers—starting with 10 free engineering hours.

01 — Frequently asked questions

security & seo

How early before DNS cutover should a startup execute a security review?

Schedule your review three to five days prior to public announcement, once production environment variables, payment endpoints, and DNS records sit in their final topology so fixes deploy calmly.

Should an early-stage startup pay for an external penetration test before MVP launch?

Hold off on formal pentest engagements until core access boundaries, credential handling, and server ports are hardened first. Fixing obvious configuration slips internally makes future third-party testing far more valuable.

Why are shipped JavaScript source maps a pre-launch security risk?

Uploading .map files alongside production bundles lets anyone reconstruct unminified frontend logic, discover hidden admin API routes, and inspect commented developer notes.

How can pre-launch security lapses damage organic search rankings?

Unauthenticated staging subdomains left crawlable create duplicate-indexation problems, while hacked forms or mixed-asset warnings cause browsers and search crawlers to flag your brand domain immediately.

03 — Have an engineering need?

hire the right expertise

Let's talk tech.

Deciding between an embedded forward deployed engineer or a senior full stack developer? Share your technical context and timeline.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.