0

the urlencode and urldecode functions are there, but if you have an encoded value that can be easily decoded using the urldecode function.

Is there any other method which can be used to make the query string stronger and less prone to attacks. using hashing would be fine but if can try not to use too much compute.

1
  • 2
    What type of security do you want? The consumption of the url-encoded arguments is where security needs to be addressed, and that's a matter of validating untrusted and untrustable inputs. Or, you could be trying to do what Oshawott is speaking to in his answer. Commented Apr 24, 2013 at 21:34

3 Answers 3

1

It sounds like you're talking about URL strings rather than query strings. The best way to secure variables which you don't want the user to see is to use POST actions instead of GET actions.

The purpose of urlencode is not to provide security, it's to encode strings which may contain special characters etc. to pass in a GET request.

POST does not store the variables as a part of the URL or in the browser history, so it's much better for sending sensitive information. If you want to actually secure the information against user manipulation, you'll have to hash or encrypt it (for example, passwords should be hashed before posting).

POST vs GET comparison

Sign up to request clarification or add additional context in comments.

3 Comments

I don't think using POST can save something
If thinking of security - use HTTPS (SSL) instead of http!
Totally different type of security (protecting against external sniffing rather than user manipulation), but also useful.
1

Keep in mind that even using POST, you're not really hiding anything from someone who wants to get at that data. Be very careful of what kind of data you allow to be sent in GET and POST. Know that no matter which you choose, it can still be manipulated by the end user.

2 Comments

how to secure at the user end... sanitizing the input can only be done at the server end
Sanitizing input is useful, but you really should be locking it down more than that (for instance, using CFQUERYPARAM in ColdFusion.)
0

Guessing this is what you're wanting to look at. This will show you how to "clean" input from users, whether it's from the query-string or not.

I'm not sure how POST'ing the variables is any safer at all... Chrome Dev Tools will get around that no problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.