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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:00:45+00:00 2026-06-02T16:00:45+00:00

we are looking at using the unparseable curft approach to our json as an

  • 0

we are looking at using the unparseable curft approach to our json as an extra level of security.

In looking at the approaches, I’ve come across google’s while(1); and facebook’s for(;;); and then another mention of {}&&

I’ve seen comments surrounding the while(1); that say the 1 being numeric can get clobbered, so my approach was going to be the for(;;);.

Then I came across the {}&&, which renders the json as invalid yet it can still be parsed/eval’ed. See this article for reference: http://www.sitepen.com/blog/2008/09/25/security-in-ajax/

What are your approaches? and what do your functions look like for making the ajax call with the unparseable curft?

  • 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-02T16:00:46+00:00Added an answer on June 2, 2026 at 4:00 pm

    I just always use a root object. As noted:

    It is only possible to hijack JSON data with a root that is an array.
    When the root is a primitive, primitive values do not trigger a
    constructor. When the root is an object, it is not valid JavaScript
    syntax, and therefore can’t be parsed.

    Note that having a root primitive (e.g. your response is just 5) is not valid JSON. Section 2 of the RFC says:

    A JSON text is a serialized object or array.

      JSON-text = object / array
    

    This isn’t much of a burden, as I (and many sites) typically use an envelope format. E.g.:

    {
      "header": {...},
      "data": {...}
    }
    

    or:

    {
      "status": {...},
      "data": {...}
    }
    

    etc.

    In that case, any array would just be the value of data, so you can serve syntactically valid JSON without any hijacking risk.

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

Sidebar

Related Questions

I'm looking into using parallel unit tests for our project(s) and was wondering about
We're looking at using actors in our Scala code quite soon. We're also thinking
Im currently looking at using min3d but came across a thread where the original
We're looking at using HTTPS in our ASP.NET webforms application for a shopping cart
I'm looking at using Elasticsearch to provide the search functions of our site. I've
I've been looking at using Bootstrap's Popover widget and while I like it's look
I've been looking into using the UIPageControl for a scrolling part of an application,
I've been looking at using ExtJS Direct with ASP.NET MVC but it doesn't seem
I'm looking into using the jQuery UI autocomplete widget to implement user lookup by
I'm looking at using the jQuery MetaData Plugin. Looks very interesting but... <li class=someclass

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.