aws-samples / pcluster-manager

Manage AWS ParallelCluster through an easy to use web interface
https://pcluster.cloud
Apache License 2.0
65 stars 27 forks source link

Improved CSRF token handling with TimedSignature #495

Closed BarcoMasile closed 1 year ago

BarcoMasile commented 1 year ago

Description

This PR changes the way CSRF token (and cookie) are generated, moving from a URLSafeSerializer to a URLSafeTimedSerializer. Now CSRF tokens are valid for 30 seconds, after that they would throw bad signature exception. Now invocation of the /csrf token always returns (and sets as an expiring cookie) a new token.

How Has This Been Tested?

PR Quality Checklist

In order to increase the likelihood of your contribution being accepted, please make sure you have read both the Contributing Guidelines and the Project Guidelines

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.