That will be a great enhancement to have.

Regards

Jalaj P Asher

-----Original Message-----
From: Polina Georgieva <poli.m.georgi...@gmail.com>
Sent: Thursday, August 26, 2021 10:49 AM
To: Tomcat Users List <users@tomcat.apache.org>
Subject: Improve logging in 
org.apache.catalina.filters.RestCsrfPreventionFilter ?

[You don't often get email from poli.m.georgi...@gmail.com. Learn why this is 
important at http://aka.ms/LearnAboutSenderIdentification.]

Attention! - This email has originated from an External Source outside of 
eClinicalWorks. Always use caution when opening attachments, clicking links, or 
when responding to this email. If you feel this is a phishing scam, please use 
the Phish Alert Report button in Outlook.


Hello,



Currently the RestCsrfPreventionFilter is responding with 403 response when the 
csrf token sent in the request is different from the one stored in the session.

However except the 403 response code visible in the http access log file, 
there's no indication what happened and why is the error response.

So I think introducing some logs in this filter would be beneficial at least 
from two points of view:

   1. Troubleshooting

It would be easier to troubleshoot problems with clients that did not integrate 
with the csrf prevention mechanism properly or could give more clues for other 
situations - for example cases of session invalidation (done by other filter 
for example) before the request reaches the filter.
Currently such requests are also responded with 403 though the client seems to 
have sent valid session cookie and  csrf token. That's why I believe it would 
be of great help to add log(s) stating:

   - if the requested session is found
   - if there's token stored in it
   - if there's token and session cookie sent in the request

without revealing their actual values or other security sensitive data.

And this information could be logged only in cases of 403 responses, i.e.
would appear only when needed.

   1. Improve identifying/tracking security related incidents

According to OWASP guidelines it's recommended to have probable malicious 
attacks indicated in the logs to better identify security incidents. For more 
details please refer to [1].



If you agree with these ideas, I'll be happy to propose a patch?



Best Regards,

Polina



[1]
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcheatsheetseries.owasp.org%2Fcheatsheets%2FLogging_Cheat_Sheet.html%23which-events-to-log&amp;data=04%7C01%7Cjalaj.asher%40eclinicalworks.com%7C6cc1405176314999ce0d08d968a0af18%7C7ce747e48f6d4e0697efa9b76a063808%7C1%7C0%7C637655862166690290%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=ZKENhmdqWfpNGijcGbHz2usa%2FJzJiq%2FNUtvtN91%2FDBA%3D&amp;reserved=0

CONFIDENTIALITY NOTICE TO RECIPIENT: This transmission contains confidential 
information belonging to the sender that is legally privileged and proprietary 
and may be subject to protection under the law, including the Health Insurance 
Portability and Accountability Act (HIPAA). If you are not the intended 
recipient of this e-mail, you are prohibited from sharing, copying, or 
otherwise using or disclosing its contents. If you have received this e-mail in 
error, please notify the sender immediately by reply e-mail and permanently 
delete this e-mail and any attachments without reading, forwarding or saving 
them. Thank you.

CONFIDENTIALITY NOTICE TO RECIPIENT: This transmission contains confidential 
information belonging to the sender that is legally privileged and proprietary 
and may be subject to protection under the law, including the Health Insurance 
Portability and Accountability Act (HIPAA). If you are not the intended 
recipient of this e-mail, you are prohibited from sharing, copying, or 
otherwise using or disclosing its contents. If you have received this e-mail in 
error, please notify the sender immediately by reply e-mail and permanently 
delete this e-mail and any attachments without reading, forwarding or saving 
them. Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to