Kiwibit
← All posts

Article

Did you know someone else’s code could run inside your website?

By Gustavo Costa•11/11/2026

A website creator sees a comment manipulating browser buttons like a puppet.

You built a website, launched a form, and watched everything work. Maybe you wrote every line yourself. Maybe you asked an AI for help and kept adjusting until the interface looked the way you imagined.

Now imagine discovering that a stranger managed to make your website run code you never put there. Visitors may still see your brand, your address, and your buttons. Yet something you never authorized is happening inside that page.

This kind of vulnerability has a name: XSS, short for cross-site scripting. The core idea is simple: content someone submits ends up being interpreted by the browser as instructions, instead of remaining content. OWASP describes this problem as injecting scripts into pages that appear trustworthy.

Your website can look great, pass your usual checks, and still need a review of what it allows to execute.

A surprised website creator sees a coral comment bubble pulling the buttons of a browser page like a puppet.

An illustrative metaphor: content that should be a comment starts controlling the page's behavior.

Sound unlikely? Think about a product review

Imagine a fictional shop called Aurora Store. Customers can write reviews. Someone submits a comment, the shop saves the text, and other visitors read it later.

So far, so normal.

The problem appears if the component displaying the review interprets part of that content as instructions for the browser. In this hypothetical scenario, someone might exploit a space meant for an opinion to introduce unexpected behavior.

The person visiting the product does not need to know who wrote the comment. They simply open a page on a shop they trust.

That is why even small features deserve a review: comments, biographies, messages, search results, and content previews. A seemingly minor field can become part of an important page.

This story is illustrative. It raises a practical question: in your project, what happens between someone submitting text and another person seeing it on screen?

What can that code do?

The impact depends on where the vulnerability exists and what the page and account can access. PortSwigger's Web Security Academy explains risks such as acting on behalf of a signed-in person, accessing information available to the application, and capturing credentials in certain circumstances.

Possible effect What it might look like for a visitor
Read data accessible on the page Information belonging to an account could be exposed
Capture input in an affected form Including a password, if it is entered into a field accessible to the code
Act through the person's session Perform actions that account is allowed to carry out
Change what the page displays Show a deceptive message, replace content, or present a fake form

This does not mean every vulnerability has all these effects. A limited account and an administrative area provide different contexts. But trusting a page's appearance is not sufficient protection when the unwanted behavior takes place inside it.

A visitor notices a coral sign-in form being manipulated by hidden strings inside a familiar green website.

A fake login can appear inside a familiar page. This illustration represents deception, not a real incident or automatic access to every saved password.

Can it “mess up” the user's computer?

It can disrupt the experience inside the page: change what appears, prompt an action, or display a deceptive interface. That can already be serious.

There is an important distinction, though: XSS alone does not mean total control of the computer. Browsers have security boundaries, and access to local files through dedicated APIs follows rules and permissions. MDN documents both separation between origins and file system access permissions.

It would be incorrect to conclude that XSS automatically reads every file, unlocks an entire password manager vault, or installs a program. Impacts beyond the permissions normally available to a page may require other vulnerabilities or additional actions by the person.

The concern makes sense without exaggerating its scope: data and actions within an application already deserve protection.

“But my website uses HTTPS and has a login”

Those features remain important. They solve different parts of the problem.

HTTPS protects communication between client and server against certain attacks during transport. It does not automatically analyze the security of everything your application delivers to the browser. MDN's TLS documentation explains this protection of the connection.

A login identifies an account. It does not turn everything submitted by an authenticated person into safe content.

When reviewing our fictional project, I would ask two separate questions:

  1. Who can sign in and perform each action?
  2. What does the interface do with the data it receives?

A good answer to the first question does not remove the need to answer the second.

Vibe coders need to know about this risk too

You do not need to give up AI to care about security. You need to make security a requirement you can verify in your project.

Here are questions I suggest using during a review, including one assisted by AI:

  • Which fields receive content from other people?
  • On which screens does that content appear again?
  • Is any part inserted as raw HTML?
  • Does the editor accept more features than the interface actually needs?
  • Are there tests showing what is allowed and what is removed?

A more useful request than simply “make it secure” would be:

Review how comments, biographies, and editor content are displayed. Show the places that interpret HTML, explain the policy being applied, and propose tests for allowed and forbidden content. Do not use real data or credentials in the examples.

This request is a suggested workflow, not a security guarantee. Ask for explanations, review the changes, and check the behavior in the browser. A confident answer from an assistant does not replace evidence.

How to protect your site without becoming an expert overnight

1. Let text remain text

If a field needs to display a message, it does not necessarily need to accept an entire HTML structure. MDN's documentation on innerHTML warns that this property interprets markup and is a sensitive injection point when it receives untrusted content.

For frontend developers, a useful review is to find the places where strings are turned into HTML. Understand why that conversion exists before copying it into other components.

2. When formatting is needed, decide what is allowed

A comment may need paragraphs and emphasis without needing access to every browser behavior. OWASP's guidance on preventing DOM-based XSS helps distinguish safe and unsafe ways to insert data into a page.

In practice, establish a policy for rich content and use maintained sanitization tools to enforce it. Sanitizing means examining content and removing or rejecting features the application does not allow. Avoid improvising a filter that only searches for one word or deletes a few familiar tags.

3. Centralize sensitive operations

If several screens accept HTML, consider reducing the number of places responsible for preparing it. The web.dev guide to Trusted Types presents an approach for concentrating transformations before certain browser injection operations.

You do not need to start by adopting every available mechanism. Begin by knowing where your boundaries are and who is responsible for them. Then assess additional protections against the project's libraries and supported browsers.

4. Test the actual path content takes

For Aurora Store, I would create test accounts and follow a review from submission through display to another person. I would repeat the test after editing the content and opening the preview.

My checklist would include ordinary text, accented characters, permitted formatting, unexpected links, and content the policy should reject. Seeing bold text does not prove XSS exists: the product might allow that formatting. The goal is to verify that the application prevents behavior outside its defined policy.

Run these tests in an environment you own or are authorized to test, using fictional data.

5. Make the review part of delivery

For your next interface feature, I would set aside a little time for this check:

Before publishing Question for the team
New form Where will submitted data be displayed?
Rich text editor Which elements and links are accepted?
New interface library Does it interpret HTML or change how content is rendered?
AI-generated change What changed, and how do we demonstrate that it follows the policy?

These questions are a starting point for organizing a review. Projects handling more sensitive data may require a specialist assessment.

A frontend creator installs a filter that lets friendly comments become content cards while stopping a coral bubble carrying puppet strings.

An illustrative metaphor for a content policy: accept what the feature needs and prevent content from becoming unauthorized behavior.

A question to take into your next project

Think about the last text field you added to your website.

Do you know which pages display that content? Do you know whether it is shown as text or interpreted as HTML? Do you know which test demonstrates that this choice works?

If you do not know yet, you have found a good place to begin your review.

Your users trust the page you launched. Make sure it only executes the behavior your project has chosen to allow.


Further reading

Image credits: original AI-generated editorial illustrations created for this article. They use visual metaphors to explain XSS and do not depict real incidents.

Suggested reading