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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:14:43+00:00 2026-05-23T22:14:43+00:00

I get that JSON.parse() prevents an attacker from injecting javascript into the response since

  • 0

I get that JSON.parse() prevents an attacker from injecting javascript into the response since a JSON parser is just a text parser, not a script parser so please don’t close this is a dup of all the other questions that talk about that. This is a different question.

If an attacker can hijaack your Ajax call and put javascript into the Ajax call aren’t they just as likely to be able to hijack your actual webpage and put arbitrary javascript into your page from which they could accomplish the exact same attack?

Sure, you have nothing to lose by using JSON.parse() instead of eval() (unless you don’t have a JSON parser yet in your environment and have to add more code to get one), but what situations does it really add safety if your web page is being served by the same host as your ajax call?

  • 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-05-23T22:14:44+00:00Added an answer on May 23, 2026 at 10:14 pm

    Yes, it is really safer. Every precaution you do not take is a set of potential exploits you don’t prevent.

    An attacker might be able to have some control over your server’s output without being able to change it entirely. Nobody’s suggesting it’s a magic bullet, but it’s potentially faster and you’re not creating a potential vulnerability that could come back and hurt you.

    Maybe someone running your server is having a bad day, and does something silly like constructing JSON by concatenating unsanitized user input:

    <?php
        print '{"foo": ' . $_GET['bar'] . '}';
    ?>
    

    If you’re using JSON.parse, the worst they can do is shove a large object into your memory. If you’re using eval they can hijack everything.

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

Sidebar

Related Questions

I made php file that parse JSON object. here's an example of result from
I have several listboxes that get each of their data from a separate stored
I have a simple object that get's geocoding data from the Google Maps API
I have a simple call JSON.parse(Panda.get(/videos/#{self.panda_video_id}/encodings.json)) Which returns : can't convert Array into String
I parse some JSON from a web service, this gives me an NSDictionary, I
I am trying to get the JSON data from a Twitter search request such
I'm trying to get my JSON from my controller to my view. In my
I am upgrading from jQuery 1.3.2 to jQuery 1.5 and I can't get JSON
A simple function that serves a JSON string from a database result is broadcasted
I'm starting to investigate T4 for Code Generation. I get that you have a

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.