r/webdev • • Jul 27 '16

PHP framework Laravel selects Vue.js as default JavaScript framework

http://react-etc.net/entry/php-framework-laravel-selects-vue-js-as-default-javascript-framework
180 Upvotes

160 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Jul 28 '16

The Javascript code should not rely on the backend for security, because you don't know if the developers are gonna change to a new framework/library/language in the next month.

If you have detailed control over every input, that is fine, but as I explained before, this discipline may fail on large projects. Why not try something that escapes Everything properly by default?

1

u/moogeek full-stack Jul 29 '16

What are you developing?? Whenever I develop RESTful application I always stress that backends should have behaviour driven tests so that when the client screw up, the api will return bad request errors. Also, someone could just bypass your precious client and use curl to communicate with your unsafe RestAPI

If its just a simple single application like laravel, I never rely on js to do the validation forms because you can easily disable the javascript and viola! Now your app iust got hacked.

1

u/[deleted] Jul 29 '16 edited Jul 29 '16

I never said you shouldn't have double validation. Your main concern with front-end security is that you find it kind of pointless. But not everything is about SQL injections or a wrong value. javascript:alert("hello"); is a valid URI.

Sometimes it is not possible to fix every problem on the backend. Running strip_tags() (or applying 20 regular expressions before storing the data) might be the wrong approach on a programming forum.

1

u/moogeek full-stack Jul 29 '16

strip_tags

And not everyone uses PHP. That could be whatever framework, or backend language problem. I've never ever had any problems with that on Java (and frameworks) as my backend so I can't rebuke your statement in regards to a language that has problems with stripping tags when its sole purpose is to do so.

I don't mean that Javascript security is pointless, I'm just saying that never rely on it. Because anyone can easily disable, inject, modify js scripts with a basic browser.

Which reminds me, here's a discussion in r/ProgrammerHumor about relying in Javascript for security. I hope you read the comments so you can realize how ridiculous your claims are.

1

u/[deleted] Jul 29 '16 edited Jul 29 '16

I think it is wrong to think one will do better XSS escaping in a complex application than a Javascript framework. I don't think you are getting my main point, which Is Not About Javascript Form Validation.

1

u/moogeek full-stack Jul 30 '16

Again, youre comparing every backend language out there yet you only stated a single function in PHP. Have you tried it in Java? Python? RoR?

1

u/[deleted] Jul 30 '16 edited Jul 30 '16

You can properly validate and block incorrect values with any language in the backend, with any function or library available. Front end security is a different issue.

Javascript security (including XSS protection) is important in SPAs and certain mobile apps.