Skip to main content
Bethemesh
GuideBest practices

Web security: understand the essential protections of a website

Understand the layers that protect a website: HTTPS, HTTP security headers, CSP, SRI, authentication, passwords and integrity.

Published 29 August 2026Reading : 2 minBy Bethemesh Team
Beginner
Show contents
  1. Think in layers, not in miracle settings
  2. Start with a simple threat model
  3. HTTPS is the foundation, not the whole building
  4. Reduce the attack surface
  5. Authentication, authorization and sessions differ
  6. Test behavior, not configuration files

Web security is not a single switch. It is a set of layers that reduce different risks: encrypted transport, browser restrictions, dependency integrity, authentication and authorization. This collection focuses on technical website security. Privacy and Local First answer a different question: where data goes and what it reveals.

Think in layers, not in miracle settings

HTTPS protects traffic in transit but does not fix vulnerable application code. A Content Security Policy can reduce the impact of some injections, but it does not replace output escaping or input validation. A strong password does not compensate for broken authorization.

A coherent baseline combines HTTPS, security headers, CSP, SRI where appropriate, sound authentication and sessions, and hashes for integrity checks.

Start with a simple threat model

Ask what you are protecting, from whom and on which surface. A static site, an account-based application and an administration panel do not expose the same risks. Identify sensitive data, privileged actions, third-party resources, embeddable pages and browser-accessible APIs.

HTTPS is the foundation, not the whole building

HTTPS encrypts traffic between browser and server and lets the browser authenticate the server certificate. It does not stop XSS, compromised credentials, broken access control or dangerous JavaScript dependencies. HSTS can then tell browsers to keep using HTTPS; the HTTP security headers guide explains the surrounding policy.

Reduce the attack surface

Remove unused dependencies, restrict iframe and browser permissions, never ship secrets in client code and keep components updated. Every third-party script expands what your page trusts. CSP controls permitted sources, while SRI can pin the expected bytes of selected static resources.

Authentication, authorization and sessions differ

Authentication asks who a user is; authorization asks what that user may do; a session carries identity between requests. JWT can be part of that design but does not replace authorization checks. See the JWT guide and password guide.

Test behavior, not configuration files

Inspect the headers actually returned, CSP violations, third-party loads, unauthenticated routes and expired-session behavior. A protection written in a configuration file but absent from the final response protects nothing.

For privacy-oriented processing, see Local First, PDF privacy and image metadata and privacy.

Related tools

Security & privacy

Security headers generator

Generate HTTP security headers for the protections you want to enable on your site.

100% local
Use this tool
Security & privacy

CSP generator

Create a Content Security Policy to strengthen your website security.

100% local
Use this tool
Security & privacy

SRI hash generator

Generate a Subresource Integrity hash for a file or pasted content.

100% local
Use this tool

Collection

Secure a website

  1. 01Web security: understand the essential protections of a website
  2. 02Content Security Policy (CSP): reduce XSS risks and unwanted loads
  3. 03HTTP security headers: which ones to enable and why
  4. 04Subresource Integrity (SRI): verify external resource integrity
  5. 05JWT: understand structure, signature, expiration and common mistakes
  6. 06Passwords: generation, strength and useful policies
  7. 07Hashes, integrity and fingerprint comparison: what a hash can really prove

Was this article useful?