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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:05:04+00:00 2026-05-11T18:05:04+00:00

So, what is the best way to prevent an XSRF attack for a GAE

  • 0

So, what is the best way to prevent an XSRF attack for a GAE application? Imagine the following:

  1. Anyone can see a user’s public object, and the db.Model id is used in the request to figure out which object to show. Malicious user now has the id.
  2. Malicious user creates their own object and checks out the delete form. They now know how to delete an object with a certain id.
  3. Malicious user gets innocent user to submit a delete request for that user’s object.

What steps can I add to prevent #3? Note that when I say ID, I am using the actual ID part of the key. One idea I had was to use the full key value in delete requests, but would that prevent a malicious user from being able to figure this out? As far as I know, the key is some combination of the model class type, the app id, and the object instance id, so they could probably derive the key from the id if they wanted to.

Any other ideas? Jeff wrote a post about this, and suggested a couple methods – a hidden form value that would change on each request, and a cookie value written via js to the form. I won’t want to exclude non-javascript users, so the cookie solution is no good – for the hidden form value, I would have to do a datastore write on every request that displayed a deletable object – not an ideal situation for a scalable app!

Any other ideas out there?

  • 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-11T18:05:04+00:00Added an answer on May 11, 2026 at 6:05 pm

    When you generate the page that lets the user delete an object, generate a random token and include it in a hidden form field. Also set a HTTP-only cookie with that value. When you receive a delete request, check that the random token from the form and the value from the cookie match.

    Your random token shouldn’t just be a random number. You should encrypt the combination of a random number and the user’s identity, to make it difficult for attackers to forge their own tokens. You should also use different encryption keys for the value stored in the form and the value stored in the cookie, so if one of the tokens does leak, it is still difficult for an attacker to forge the other token.

    This approach verifies that the delete request originates from your form, by the presence of the security token in the form; and doesn’t require writing to the datastore.

    This approach is still vulnerable to cross-site scripting attacks, where an attacker could retrieve the hidden value from the form or submit the form, so thoroughly test your site for cross-site scripting vulnerabilities. This approach is also vulnerable to “clickjacking” attacks.

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

Sidebar

Related Questions

What's the best way to prevent javascript injections in a VB.NET Web Application? Is
What's the best way to prevent a user from making duplicate credit card transactions?
What's the best way to prevent a dictionary attack? I've thought up several implementations
What is the best way to show friends' posts? Each user can have maximum
What is the best way to ensure service robustness to prevent a service becoming
I need the best way to prevent any access to doc files when it
hi sirs what's the best way to prevent google from showing of a folder
In PHP, I know that using parameterized queries is the best way to prevent
What is the best way to prevent a Linux program/daemon from being executed more
What whould be the best way to prevent multiple users on a page? For

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.