最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Very Confused (And Worried) about security with JSON and Javascript - Stack Overflow

programmeradmin2浏览0评论

I've been attempting to do some research on this topic for a while, and even cite the following Stack Overflow threads :

Javascript Hijacking - When and How Much Should I Worry

JSON Security Best Practices

But my basic problem is this.

When I am building my web applications, I use tools like Fiddler, Chrome Developer Tools, Firebug, etc. I change things on the fly to test things. I can even seem to use fiddler to change the data that gets sent to the server.

What stops someone else from just opening up my webpage and doing this too? All of the jQuery validation in the world is useless if a user can just hit F12 and open up Chrome Developer tools, and change the data being sent over the wire, right?

I'm still relatively new in this field and this just has me very concerned as I see "Open" Protocols bee more and more ubiquitous. I don't understand SSL yet (which is on my list of things to begin researching), so perhaps that is the answer and I just haven't dug deep enough. But the level of flexibility I have over manipulating my pages seems very extreme - which has me very concerned about what someone malicious could do.

I've been attempting to do some research on this topic for a while, and even cite the following Stack Overflow threads :

Javascript Hijacking - When and How Much Should I Worry

JSON Security Best Practices

But my basic problem is this.

When I am building my web applications, I use tools like Fiddler, Chrome Developer Tools, Firebug, etc. I change things on the fly to test things. I can even seem to use fiddler to change the data that gets sent to the server.

What stops someone else from just opening up my webpage and doing this too? All of the jQuery validation in the world is useless if a user can just hit F12 and open up Chrome Developer tools, and change the data being sent over the wire, right?

I'm still relatively new in this field and this just has me very concerned as I see "Open" Protocols bee more and more ubiquitous. I don't understand SSL yet (which is on my list of things to begin researching), so perhaps that is the answer and I just haven't dug deep enough. But the level of flexibility I have over manipulating my pages seems very extreme - which has me very concerned about what someone malicious could do.

Share Improve this question edited May 23, 2017 at 11:56 CommunityBot 11 silver badge asked Feb 1, 2013 at 16:34 CielCiel 17.8k25 gold badges107 silver badges202 bronze badges 1
  • 2 You do not even need to hijack the page, I can open up a mand line on linux and submit anything to your server. Validation on server is needed. – epascarello Commented Feb 1, 2013 at 16:37
Add a ment  | 

6 Answers 6

Reset to default 9

Your concerns are indeed justified. This is why you should always validate everything on the server. Client-side validation should only be used for UX.

JavaScript's security is, in a nutshell, based around a trusted server. If you always trust what code the server sends you, it should be safe. It's impossible for a third party (like an ad supplier) to fetch data from the domain it's included on.

If the server also sends you user generated content, and in particular user generated code, then you have a potential security problem. This is what XSS attacks focus on (running a malicious script in a trusted environment).

Client side validation should focus on easy of use, make it easy to correct mistakes or guide the user so no mistakes are made. The server should always do validation, but validation of a more strict nature.

Validation should always happen Server Side, Client Side Validation is only valuable to make for a more convenient experience for the user. You can never trust a user to not manipulate the data on their end. (Javascript is ClientSide)

Next if you are wanting to secure your service so that only user1 can edit user1's profile you'll need to sign you JSON request with OAuth (or similar protocol).

yeah nothing can stop anybody from interfering the data that is being sent from the browser to your server and that's the reason you shouldn't trust it
always check the data from the user for authenticity and validity

also with it you can check and interfere with the data that big sites like google and microsoft send back and you might get an idea.

You have to assume that the client is malicious-- using SSL does not prevent this at all. All data validation and authorization checking needs to be done server side.

Javascript isn't going to be you only line of defense against hackers, in fact it shouldn't be used for security at all. Client side code can be used to verify form input so that users trying to use the page can have faster response times, and the page runs nice. Anyone who is trying to hack your page isn't going to care if your page works or not. No matter what, everything ing into your server should be verified and never assumed as safe.

发布评论

评论列表(0)

  1. 暂无评论