Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

07-12-2017 , 10:46 PM
Why does it matter if CSRF or CORS is stateful or stateless? Is there really a need for manual intervention here?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2017 , 10:55 PM
Quote:
Originally Posted by daveT
Why does it matter if CSRF or CORS is stateful or stateless? Is there really a need for manual intervention here?
If your API is stateless, which to me implies no "session" cookie or other auto-keep-logged-in mechanism, you aren't at risk of CSRF, because requests made on a users behalf from another site won't have them logged in.

Suzzer specifically said he had problems getting CSRF to work with a stateless API, so I find that confusing.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2017 , 10:59 PM
Oh sorry. We have an exposure layer that they really wanted to be completely stateless, but there is still authentication going on and the exposure layer proxies to services behind it that could have user sessions. So they only thing they had to push to a stateful layer was CSRF. That's about all I know. I am not a CSRF expert.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2017 , 11:17 PM
I find the interchsnging of CSRF and CORS unsettling.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2017 , 11:20 PM
They're completely different things. CORS headers (and OPTIONS response) are required by the browser for certain cross-domain calls. CSRF is a kind of attack.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-12-2017 , 11:49 PM
Quote:
Originally Posted by RustyBrooks
If your API is stateless, which to me implies no "session" cookie or other auto-keep-logged-in mechanism, you aren't at risk of CSRF, because requests made on a users behalf from another site won't have them logged in.
This is not true. Any form taking POST params is open to CSRF. The CSRF token is basically a hidden <input> field. By default, CSRF tokens last for the individual form submission, and has to be reset before a form submit can be handled again.

It doesn't matter if the user is logged in or not. As long as a form can be submitted, the CSRF token is need to prevent CSRF attacks.

Quote:
Suzzer specifically said he had problems getting CSRF to work with a stateless API, so I find that confusing.
If, in effect, he is just trying to handle a POST param, then yes, it's arguably stateless. It sounds like his team is attempting to preserve the CSRF token for the next form submission, which is kind of strange and certainly an open attack vector. I have no clue why anyone would think preserving a token is a good idea, and certainly falls under rolling your own security, very poorly at that.

Last edited by daveT; 07-12-2017 at 11:54 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 01:06 AM
POST params....? i don't think i've ever made a POST with params...don't you just include everything in body as json?

are you writing native html in 2017?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 01:53 AM
JSON is the Bride of XML, yet somehow more horrific and ugly.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 04:42 AM
JSON is not worse than XML, you take that back.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 07:09 AM
Quote:
Originally Posted by suzzer99
They're completely different things. CORS headers (and OPTIONS response) are required by the browser for certain cross-domain calls. CSRF is a kind of attack.
Ok yes, I don't get how CSRF is a part of your app if it's an exploit.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 07:28 AM
I think people are generally talking about the tokens you use to protect yourself from CSRF attacks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 07:59 AM
Quote:
Originally Posted by Larry Legend
Ok yes, I don't get how CSRF is a part of your app if it's an exploit.
When I say CSRF I mean CSRF protection.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 08:31 AM
Quote:
Originally Posted by daveT
This is not true. Any form taking POST params is open to CSRF. The CSRF token is basically a hidden <input> field. By default, CSRF tokens last for the individual form submission, and has to be reset before a form submit can be handled again.
If by "attack" you mean "someone can post to my site" then, OK, fine, but that's not generally considered an attack. What csrf protection *protects* you from is someone posting a form that (accidentally) has additional state attached to it (namely, a session or something else). If there's no state, then there's no trick. I don't *need* to trick someone in clicking my POST button if I can click it myself just the same.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 08:32 AM
Quote:
Originally Posted by daveT
JSON is the Bride of XML, yet somehow more horrific and ugly.
I almost hate to ask, but what do you favor?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 08:43 AM
Quote:
Originally Posted by daveT
This is not true. Any form taking POST params is open to CSRF. The CSRF token is basically a hidden <input> field. By default, CSRF tokens last for the individual form submission, and has to be reset before a form submit can be handled again.

If, in effect, he is just trying to handle a POST param, then yes, it's arguably stateless. It sounds like his team is attempting to preserve the CSRF token for the next form submission, which is kind of strange and certainly an open attack vector. I have no clue why anyone would think preserving a token is a good idea, and certainly falls under rolling your own security, very poorly at that.

In terms of protecting from CSRF attacks, the token doesn't need to be reset for each request. You can imagine a case like you have a page that can make multiple ajax requests that change state but don't reload the page. You can reuse the same token for requests made on that page because its still doing its job of ensuring that the request is coming from a page you sent the client (and not a malicious page thats just tricking the user into making the post request).

There are other attacks that you need to protect against (like replay attacks / man in the middle / those types of things), but you need to handle those differently than the CSRF token anyway.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 08:43 AM
JSON is more horrific and ugly than XML...

The things I read in this thread...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 09:29 AM
XML for applications of scale, JSON for web development. But nothing beats binary stored to disk.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 09:38 AM
Why are we using XML for applications of scale?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 09:45 AM
Quote:
Originally Posted by jjshabado
Why are we using XML for applications of scale?
Probably to take advantage of it's slowness, inflexibility, requirement of buggy libraries for parsing and searching, and so forth?

XML can die in a grease fire.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 09:49 AM
Yeah, I don't think we use it anywhere and I don't really know of a use case where its the best option. But like I said, I'm not up-to-date on a lot of things.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 10:13 AM
I'm using it to save and transmit data from spread sheets, but I haven't figured out yet how to make it flat binary data.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 10:17 AM
Boost has a cool ptree library which works with XML, so potentially game trees. I am not sure how to take advantage of ptree w JSON.

But in hindsight I am still clueless. I do,t know what's good for large scale applications.

http://www.boost.org/doc/libs/1_55_0...e/parsers.html

Doc claims XML is an "industry standard", but I have very little experience outside the bubble.

Add: json can be used w ptrees. I even touched on it and forgot.

Thanks all for setting me straight on XML.

Last edited by leavesofliberty; 07-13-2017 at 10:44 AM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 10:31 AM
As someone who's had to work extensively with XML and JSON - **** XML. I can't imagine one scenario where I'd prefer it.

Also without XML there would be no SOAP - one of the most cumbersome horrible technologies ever.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 11:05 AM
SOAP would have been pretty great if it actually worked, but mostly it did not actually work.

And when it did work, a lot of the time it was auto-generated from stuff like, I dunno, Java API classes, and it was an unholy mess. I spent a few of the worst years of my life integrating with NetSuite via SOAP.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-13-2017 , 11:48 AM
We had a client who said they would provide us REST apis, and they last minute gave us SOAP apis and said it was basically the same thing so the problem was us.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m