読み物Privacy · Security Basics

Level: Basic

Your First Website Security and Privacy Audit

A beginner's audit of a site you own: HTTPS, headers, cookies, sign-in, third-party scripts, personal data, and updates, with a checklist and a way to prioritize.

Edeeson Opina8 min read

A Basic lesson card: lesson 5 of the Security & Privacy series, Your First Website Security and Privacy Audit, with the Miso fox holding a bowl of miso.

What you’ll learn

  • Audit only systems you own or are authorized to test
  • Check transport security, headers, and cookies with curl and DevTools
  • Review sign-in, account recovery, and third-party scripts
  • Prioritize findings by impact and likelihood
On this page
  1. Before you start: permission and scope
  2. Step 1: transport security
  3. Step 2: security headers
  4. Step 3: cookies
  5. Step 4: sign-in and accounts
  6. Step 5: access control spot check
  7. Step 6: third-party scripts and data flows
  8. Step 7: personal data
  9. Step 8: dependencies and updates
  10. Step 9: exposed files and errors
  11. Step 10: prioritize
  12. The beginner audit checklist
  13. Common mistakes and troubleshooting
  14. Practical exercise: audit your own site
  15. Key takeaways
  16. References
  17. What's next

A first security and privacy audit doesn't need a penetration testing team. For a small site you own, an afternoon with curl, your browser's developer tools, and a checklist will find the most common problems: weak transport settings, careless cookies, sign-in gaps, unnecessary third-party scripts, personal data you didn't know you had, and outdated dependencies. This lesson gives you the order to work in, the commands to run, and a way to decide what to fix first.

Before you start: permission and scope

Audit only systems you own or have written permission to test. Even gentle checks, such as trying a few passwords on a login form or scanning for open ports, can be illegal against systems you don't control, and can trip intrusion alarms or lock real accounts. Everything in this lesson is passive or low-impact and meant for your own site, a local copy, or a staging environment.

You should have finished the earlier Basic lessons, especially How HTTPS, TLS, Cookies, and Browser Security Work and Passwords, Passkeys, and Multi-Factor Authentication Explained. Write down the scope before you begin: which domains, which environments, and which accounts you'll use.

Step 1: transport security

Start with how the site is reached:

Shell
# One permanent redirect from HTTP to HTTPS
curl -sI http://your-site.test/ | grep -iE '^(HTTP|location)'

# The HTTPS response: status and HSTS
curl -sI https://your-site.test/ | grep -iE '^(HTTP|strict-transport-security)'

Check that:

  • every HTTP URL redirects permanently (301 or 308) to HTTPS in one hop;
  • HTTPS responses include Strict-Transport-Security with a meaningful max-age;
  • the certificate is valid, covers every hostname you use, and renews automatically;
  • old protocols (TLS 1.0 and 1.1) are disabled. Free online TLS testers, such as the Qualys SSL Labs server test, report this for public sites.

Step 2: security headers

Response headers tell the browser what it may do with your page. Look at the main page and one signed-in page:

Shell
curl -sI https://your-site.test/ | grep -iE '^(content-security-policy|x-content-type-options|referrer-policy|permissions-policy|x-frame-options)'

A reasonable baseline:

  • Content-Security-Policy: limits which scripts can run. Even a basic policy with frame-ancestors 'none' or 'self' and object-src 'none' is a start; lesson 8 builds a strong one.
  • X-Content-Type-Options: nosniff: stops browsers from guessing file types.
  • Referrer-Policy: strict-origin-when-cross-origin (the modern browser default) or stricter, so full URLs aren't leaked to other sites.
  • Clickjacking protection with CSP frame-ancestors (or the older X-Frame-Options: DENY), unless your pages are meant to be embedded.

Missing headers are rarely critical on their own, but they're cheap to fix and limit the damage of other bugs. Lesson 12 covers the full set.

Step 3: cookies

Sign in, open developer tools, and inspect every cookie (Application panel in Chromium browsers, Storage panel in Firefox). For the session cookie, confirm Secure, HttpOnly, and SameSite=Lax or Strict. Then ask of every other cookie: who set it, what is it for, and does it need to exist? Third-party cookies from analytics or advertising scripts are both a privacy question and, in many jurisdictions, a consent question.

Step 4: sign-in and accounts

Using a test account you control:

  • Password rules: does a long passphrase work? Is a common password such as password1234567 refused?
  • Error messages: do the login, sign-up, and "forgot password" forms give the same response whether or not an email is registered?
  • Rate limiting: after a handful of failed attempts on your own test account, does the site slow down or temporarily block further attempts? Keep this to a few tries; don't run password-guessing tools.
  • Password reset: does the emailed link expire, and does it stop working after one use?
  • MFA: is it available, and is it required for administrators?
  • Sign-out: after signing out, does pressing Back or replaying the old cookie still show signed-in pages? It shouldn't.

Step 5: access control spot check

Create two test accounts, A and B. As A, open something that belongs to A, such as an order or a profile page, and note the URL or API request. Then, signed in as B, request the same URL. If B can see A's data, you've found the most common serious web vulnerability, broken access control. Lesson 9 explains how to fix it properly.

Step 6: third-party scripts and data flows

Open the Network panel, reload the page, and filter by third-party domains. List every external script, font, pixel, and API call. For each one, note what it does, what data it receives (often the page URL, IP address, and cookies), and whether you still need it. Every third-party script runs with the same power as your own code: if its provider is compromised, so is your page.

Step 7: personal data

Using the data inventory from lesson 4, Understanding Personal Data, Privacy, and Data Minimization, check:

  • every form field has a purpose, and optional fields are marked;
  • the privacy notice matches what the site actually collects and shares;
  • logs don't contain passwords, tokens, or full card numbers (search a sample log for password, token, and @);
  • old data is deleted on a schedule, not kept forever;
  • you can answer a user who asks what you hold about them, and delete it.

Step 8: dependencies and updates

Outdated components are one of the easiest problems to find and fix:

Shell
# In a Node.js project
npm audit --omit=dev
# or, with pnpm
pnpm audit --prod

Also check the platform underneath: the operating system, the web server, the database, and any CMS and its plugins. Make sure security updates are applied on a schedule, and that you'd hear about a critical one.

Step 9: exposed files and errors

Look for things that should never be public:

Shell
# These should all return 404 (or 403), never the file
for path in /.env /.git/config /backup.zip /phpinfo.php /server-status; do
  printf '%s %s\n' "$(curl -s -o /dev/null -w '%{http_code}' "https://your-site.test$path")" "$path"
done

Then trigger a harmless error, such as requesting a page that doesn't exist or submitting a form with an empty required field. The response should be a plain error page, not a stack trace, framework version, or database message.

Step 10: prioritize

A list of 40 findings with equal weight helps nobody. For each finding, estimate impact (what an attacker gains, or what harm a privacy failure causes) and likelihood (how easy and how likely it is to be found and used):

  1. Critical: one user can read or change another's data, admin accounts without MFA, secrets or backups publicly downloadable, sign-in without rate limiting.
  2. High: missing HTTPS redirect or HSTS, session cookies without HttpOnly or Secure, known-vulnerable dependencies with public exploits, stack traces in production.
  3. Medium: missing security headers, account enumeration through error messages, personal data kept without a retention period.
  4. Low: unnecessary third-party scripts with little data access, cosmetic header issues.

Fix critical findings first, then batch the rest by component. Re-run the same checks after fixing; an audit you can repeat is worth more than one perfect report.

The beginner audit checklist

  • HTTP redirects to HTTPS in one permanent hop, and HSTS is set.
  • The certificate is valid, covers all hostnames, and renews automatically.
  • Basic security headers are present: CSP, nosniff, Referrer-Policy, and framing protection.
  • Session cookies are Secure, HttpOnly, and SameSite.
  • Sign-in accepts long passphrases, refuses common passwords, limits attempts, and gives uniform errors.
  • Administrators use MFA.
  • User B can't see user A's data.
  • Every third-party script is known and needed.
  • Every personal data field has a purpose and a retention period.
  • Dependencies have no known high-severity vulnerabilities, and updates are scheduled.
  • No secrets, backups, or stack traces are publicly reachable.

Common mistakes and troubleshooting

  • Testing without permission. Even harmless-looking checks can break laws and contracts. Get it in writing, or test your own copy.
  • Starting with a scanner. Automated scanners find surface issues and miss logic flaws like broken access control. Do the manual checks too.
  • Testing only signed-out pages. Most serious bugs are behind the login.
  • Fixing one page at a time. If a header is missing everywhere, fix it once in the server or framework configuration.
  • Treating the audit as done. New code and new dependencies arrive every week. Schedule the next one.

If a check gives a confusing result, such as headers that appear in the browser but not in curl, check whether a CDN or proxy adds or strips them, and test the same URL, method, and signed-in state.

Practical exercise: audit your own site

Run steps 1 to 9 on a site you own or a local copy of one. Record each finding in a table with columns for the step, what you found, the evidence (command output or screenshot), impact, likelihood, priority, and the fix. Then write three sentences: the most serious finding, the quickest win, and what you'll check again next month.

Key takeaways

  • Audit only what you own or are authorized to test, and write down the scope.
  • Work in order: transport, headers, cookies, sign-in, access control, third parties, personal data, dependencies, exposed files.
  • Manual checks with two accounts catch the bugs scanners miss.
  • Prioritize by impact and likelihood, fix shared configuration once, and repeat the audit.

References

What's next

You've finished the Basic level. The Intermediate level begins with OWASP Top 10 Explained: The Security Risks Every Developer Should Know, a guided tour of the risk categories behind most of the findings you just looked for.

See every lesson in Security & Privacy: Building Secure Applications