Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8641395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:30:54+00:00 2026-06-12T11:30:54+00:00

I am looking to secure my code against XSS attacks, yet all of the

  • 0

I am looking to secure my code against XSS attacks, yet all of the examples I have been reading deal with direct user input validation (such as in a contact form or a login).

I’m a bit confused as to if I need to protect my code if there was no way to input directly (ie, my website was only reading from a database and not writing to it)? I’m still thinking I need to because I class my database as an external source, and data within the variables echoed are still coming from elsewhere.

Am I right in thinking that any data read still constitutes user input and should be treated accordingly? Also, if I then added a contact form, would I need to then validate/sanitise/escape every piece of information pulled from my database in every page, or only deal with it at the form itself?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:30:55+00:00Added an answer on June 12, 2026 at 11:30 am

    Forget the term “user input” and think in terms of “unknown strings”. Anything that you do not know for a fact what it contains is potentially dangerous or disruptive in the right context.

    It’s also important to remember there is no single solution for all cases. For example these all may require different types of sanitizing or escaping:

    • HTML attributes: <a href="$unknown">
    • HTML text content: <p>$unknown</p>
    • javascript: <script>var B = $unknown;</script>
    • SQL: SELECT * from $unknown
    • CSS: .myClass { color:$unknown; }

    In general you should (if possible) avoid using unknown data in HTML attributes, CSS, or Javascript – because those are places where it can get complicated. For most cases, simply escaping the HTML characters is all you need to do.

    The key word here is context, which is one reason why you never want to “sanitize” input, but output. The same data could be used in different contexts and require different measures of escaping or filtering.

    I highly suggest using OWASP as a resource to learn about XSS and security in general: https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been rebuilding my social network in code igniter and am looking for
I have been looking for an affordable solution for a client of mine. In
In my Firefox addon I'm looking for a secure way to let content code
I have the following code block which connects out to a secure service (payment
I have been looking for a good explanation of how to implement a password
I have to deploy my php/html/css/etc code to multiple servers and i am looking
I am looking for a secure solution for this particular scenario : I have
Looking at options for embedding the 3D Secure page inside my own order form,
I'm looking for a protocol to secure a connection between a mobile device and
I am looking to find a way to programatically (C++) control/secure access to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.