Cookies and jars or cookies in jars ?

Cookies and jars or cookies in jars ?

I came across this interesting bit of ACE/IIB code on LinkedIn as an example of how set headers in a HttpResponse.

https://www.dhirubhai.net/pulse/manipulating-http-headers-ibm-integration-bus-savio-barros

This is something that I haven't seen used in IIB development. IT is great, there is always something new to learn. So the article got me thinking about other things to consider when developing web services and web applications.?

One of the topics in developing web services and web applications that I have been reading about lately is cookie security.?

I found some good reading in the "Open Web Application Security Project" website (OWASP - I have used referred to their top 10 a number of times but I had to look up what OWASP actually stood for) around how cookies work, some best practices and threats you have be cognizant of. This article is mostly about the HttpOnly cookie and the secure cookie.

It got me interested in whether this was something that IIB could even do. I have written code in Java and C# to read and write cookies, but never ACE/IIB/WMB.

So after some trial and error I was able to use ESQL to respond to a Http request with a cookie (or many cookies with different settings).

The code in the end is pretty simple.

The first one is a "non-secure" cookie:

SET OutputRoot.HTTPResponseHeader."set-cookie"[1] = 'UnsecureCookie2=abc123; Expires=Thu, 31 Oct 2021 07:28:00 GMT;';        

The second is "secure" for "httponly"?

SET OutputRoot.HTTPResponseHeader."set-cookie"[2] = 'SecureCookie3=abc1234; Expires=Thu, 31 Oct 2021 07:28:00 GMT; Secure; HttpOnly';        

And the third has all the options.

SET OutputRoot.HTTPResponseHeader."set-cookie"[3] = 'PartiallySecureCookie8=abc1234; Domain=testdomain.com; Expires=Thu, 31 Nov 2021 07:28:00 GMT; HttpOnly; Secure; SameSite=Strict';        


Now one question is, should we be using IIB in this way to respond to http requests ?

There are tools that can provide alternatives if a cookie is needed.

Infrastructure like Webseal can provide a "cookie jar". The idea is that your application sits behind a reverse proxy. And rather then sending all your cookies over http/https back to the client browser, Webseal replaces all the cookies that your application wants to share with the client with a single cookie that Webseal manages.

So your application behind the proxy can set cookies that it needs and the proxy will replace them with a single cookie that it sends to the client, and then when the client sends the next request, the?proxy will replace the cookie that the client sent through with the original cookies that the application setup.

That way there's no chance of leaking information in the client session as there is no information about the state of the application shared with the client.

Other IAM/Proxy setups allow for this. I mostly have experience with using it from Webseal, but I understand that NGINX, F5 and others support this. It's something that could be done in the "cloud" world in Kubernetes with a WAF (maybe an Istio side car ?).

So there are strategies for securing cookies beyond the application.?

Following the principle of "defense in depth", we will still look to cover our bases and we should secure our cookies at an application level if possible.

To help with applying this an an application level for ACE/WMB/IIB code, we have added two new rules to our MB-Precise product to help identify where cookies are being set in the ESQL code. These two new rules are:

HttpOnly should be set on all cookies to protect against cross-site-scripting (XSS) (WMB)

and

Secure should be set on all cookies to prevent cookies being inspected (WMB)


So now our developers can identify where this could be an issue and then choose an appropriate strategy to protect our data and user interactions.


More information on our products and on pricing can be found on our website:

https://bettercodingtools.com

You can also reach me via email at:

[email protected]

Or contact me via the contact page on our website:

www.bettercodingtools.com/contact

Regards

Richard

要查看或添加评论,请登录

Richard Huegill的更多文章

  • Opaque parsing and performance

    Opaque parsing and performance

    A while back I was asked what our tooling could do to help improve performance for ACE/IIB code. Whether that means…

    6 条评论
  • Embedding DrawIO IIB/WMB/ACE flow diagrams in Confluence

    Embedding DrawIO IIB/WMB/ACE flow diagrams in Confluence

    Happy New Year My last demonstration was all the way back in time, 2024, almost 3 months and 4 hangovers ago. Or 3…

  • Apologies for the broken webinar

    Apologies for the broken webinar

    So last week we attempted to do a webinar on creating Confluence pages to summarize WMB/IIB/ACE code. Unfortunately…

  • Something I don't know too much about

    Something I don't know too much about

    It's ACE and Java classLoader's (but I'm sure friends will be able to point out many others). Actually this is only…

  • Confluence page generation for IIB/WMB/ACE applications

    Confluence page generation for IIB/WMB/ACE applications

    The larger an organization becomes, the more challenging that it is for an organization to manage is combined knowledge…

    2 条评论
  • WMB / IIB / ACE GitLab pages (with sound this time)

    WMB / IIB / ACE GitLab pages (with sound this time)

    The recent version 17 release of GitLab has added GitLab pages. Last week we did a live demo on using GitLab Pages to…

    2 条评论
  • GitLab Pages and IIB

    GitLab Pages and IIB

    The recent version 17 release of GitLab has added some enhancements and fixed some issues. On the of the newer features…

  • SonarQube 10.6 released

    SonarQube 10.6 released

    SonarSource recently a new version of their Sonarqube platform - SonarQube 10.6 For us, we have to update some of build…

  • Squid's (not the game)

    Squid's (not the game)

    When I develop code, I have never gotten it write first time. This is compounded when you work integration tooling.

  • Information radiators for IIB/ACE/WMB projects managed in GitLab

    Information radiators for IIB/ACE/WMB projects managed in GitLab

    Some of the functionality that we have in our plugin is more the "art" side of software engineering then the hard…

社区洞察

其他会员也浏览了