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

  • Home
  • SEARCH
  • 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 8160607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:17:58+00:00 2026-06-06T18:17:58+00:00

I am fixing code against the code audit report. It says PREVENT EXPOSURE OF

  • 0

I am fixing code against the code audit report. It says “PREVENT EXPOSURE OF SENSITIVE DATA” against the line having the syntax response.getWriter().write(xml.toString()). The whole code is below.

String alertId =  request.getParameter("alertId") != null ? request.getParameter("alertId") : "";
                    String desc=AAAA.getBBBB(Long.parseLong(AAAA.getCCCC(alertId)));
                    StringBuffer xml = new StringBuffer();

                    xml.append("<?xml version=\"1.0\"?>");
                    xml.append("<parent>");
                    xml.append("<child>");
                    xml.append("<alertDesc>");
                    xml.append(desc);
                    xml.append("</alertDesc>");
                    xml.append("</child>");
                    xml.append("</parent>");

                    response.getWriter().write(xml.toString());  // ISSUE IN THIS LINE
                    response.setContentType("text/xml");
                    response.setHeader("Cache-Control", "no-cache");

I have done sufficient home work and can fix it for the XSS attack and used ESAPI for the same. But dont know how to fix this one. Please give suggestions
The report has the below message against the reported issue.
“Leakage of toString() result (“xml”) via web page”

after the day long r&d i found that the sax parser can help me in this case. it is actually a memory leakage at the StringBuffer.toString() syntax, due to which sensitive data is getting exposed and lost. but i dont know how to implement that. also at some place i found the use of StringBuilder() class instead of StringBuffer() class. Can anybody help me or give their valuable suggestions.
Thanks in advance.

Also I have the same issue for another type of the code. it is below.

StringBuffer content = (StringBuffer)file.get("content");
response.setContentLength((int)content.length());
            response.getWriter().write(content.toString());

Again i dont know how to fix this one. THE issue is same leakage of sensitive data been reported by the tool.

  • 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-06T18:17:59+00:00Added an answer on June 6, 2026 at 6:17 pm

    The content.toString() needs to be properly validated. use ESAPI to validate it strictly. writing directly to response is really vulnerable and if if the data is output from a method having request as input then its twice vulnerable. major security issue.

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

Sidebar

Related Questions

I am fixing issues against the code audit report for my module. The issue
I am fixing code for the audit report for security issue-- SQL Injection. In
I am fixing some printing (plotter) problems in our java code(windows 32). The paper
i have this php code and keep on getting errors upon fixing each error.
We're doing some code cleanup, fixing signed/unsigned comparisons, running static analysis, etc, on the
I am working on fixing older code for my job. It is currently written
I have been struggling in fixing this code, wonder what is wrong at all...
when fixing mass spelling errors in my code base i have used this: find
I am fixing a bug on an existing code concerning DocumentBuilder.parse. I have the
I have the following code. I need help fixing it such that the Category

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.