Prompt

How do I protect my website from SQL injection and XSS without changing the app?

Technology / Cybersecurity1 observationLast seen Oct 29, 2026

Latest observation

Oct 29, 2026OpenAI APIWeb search: off

If you truly can’t change the application code, your options are limited to controls in front of the app and hardening the environment. These can reduce risk a lot, but they are not a substitute for fixing the app.

1) Put a WAF / reverse proxy in front of the site

Use a web application firewall such as:

  • Cloudflare WAF
  • AWS WAF
  • Azure WAF
  • ModSecurity with OWASP Core Rule Set
  • Fastly / Akamai WAF

What it can do:

  • Block common SQL injection and XSS payloads
  • Normalize and inspect requests
  • Rate-limit suspicious traffic
  • Challenge bots and scanners

Important:

  • Start in log-only / detection mode, then tune rules
  • Watch for false positives on legitimate traffic
  • Don’t rely on WAF alone; it’s bypassable

2) Add strict security headers at the edge

If you can configure the web server, CDN, or reverse proxy, add:

Content Security Policy (CSP)

This is one of the best defenses for XSS if you can deploy it externally.

Example:

Content-Security-Policy: default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'

If the site uses inline scripts, you may need a more permissive policy, but tighter is better.

Other useful headers

X-Content-Type-Options: nosniff
Referrer-Policy: no-referrer-when-downgrade
Permissions-Policy: geolocation=(), camera=(), microphone=()
X-Frame-Options: DENY

Note:

  • These don’t stop SQL injection
  • CSP can greatly reduce impact of XSS, but only if configured well

3) Sanitize and validate at the perimeter

If you control a proxy/API gateway, you can reject obviously malicious input before it reaches the app.

Examples:

  • Block request bodies containing classic SQLi patterns like:
    • ' OR '1'='1
    • UNION SELECT
    • --
    • /* ... */
  • Block reflected XSS patterns like:
    • <script
    • javascript:
    • onerror=
    • onload=

Be careful:

  • Signature-based filtering is easy to evade
  • Avoid breaking legitimate requests
  • Prefer anomaly-based rules plus WAF managed rules

4) Restrict what the app can reach

Reduce blast radius if injection succeeds.

Database hardening

  • Use a least-privilege DB account
  • Remove DROP/ALTER/DELETE permissions if not needed
  • Separate read-only and write accounts
  • Restrict DB access by network/IP
  • Turn off dangerous stored procedures if possible

Server hardening

  • Run the app under a low-privilege OS account
  • Isolate the app in containers/VMs
  • Restrict outbound network access
  • Keep secrets out of the environment where possible

5) Use network segmentation and allowlists

  • Only allow the web server to talk to the DB on the needed port
  • Deny direct DB access from the internet
  • Put admin interfaces behind VPN or IP allowlists
  • Separate frontend, app, and database networks

6) Add monitoring and detection

Since you can’t fix the code, detection becomes more important.

Log and alert on:

  • Repeated 4xx responses
  • Requests containing suspicious keywords
  • Unusual query volume
  • Unexpected response size changes
  • Failed DB auth attempts
  • Unusual outbound connections

Useful tools:

  • SIEM alerts
  • IDS/IPS
  • WAF logs
  • Database audit logs

7) Disable dangerous browser-exposed features

If the app is vulnerable to XSS and you can’t code-fix it, reduce impact with edge config:

  • Set cookies as HttpOnly, Secure, SameSite
  • Prevent framing with X-Frame-Options or CSP frame-ancestors
  • Restrict script execution with CSP
  • Consider disabling features like inline script execution if feasible

8) If you only have hosting/server access, do these minimums

Priority order:

  1. Put the site behind a WAF/CDN
  2. Add CSP and other security headers
  3. Lock down DB permissions
  4. Restrict network access to DB/admin ports
  5. Add monitoring and alerts

Reality check

  • SQL injection is best fixed in application code using parameterized queries and ORM-safe queries.
  • XSS is best fixed by output encoding, input handling, and safe templating.
  • Without app changes, your protections are mostly mitigations, not true fixes.

If you want, I can help you design a no-code-change protection plan for your specific stack, like Apache/Nginx, Cloudflare, AWS, or IIS.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.