Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementation of the csrf signed double submit pattern #3409

Merged
merged 15 commits into from
May 7, 2024

Conversation

thoniTUB
Copy link
Collaborator

No description provided.

Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
@thoniTUB thoniTUB requested a review from awildturtok April 25, 2024 13:12
@thoniTUB
Copy link
Collaborator Author

Todo:

  • Signing the cookie value for signed double submit pattern
  • check template if custom rest-method is used everywhere

public static final String CSRF_TOKEN_PROPERTY = "csrf_token";
public static final int TOKEN_LENGTH = 30;

Random random = new SecureRandom();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private final?

Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
@thoniTUB thoniTUB changed the title naive implementation of the csrf double submit pattern implementation of the csrf signed double submit pattern Apr 29, 2024
@thoniTUB thoniTUB marked this pull request as ready for review April 29, 2024 12:48
@thoniTUB thoniTUB requested a review from awildturtok April 29, 2024 15:12
Copy link
Collaborator

@awildturtok awildturtok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Änderungen sind alles nits, kannst du gerade die admin-ui, bitte in einer staging instanz testen?

null,
0,
null,
3600,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic number auf der TTL?

final StopWatch stopwatch = new StopWatch("Generate csrf token");

stopwatch.start();
final Hash hash = Password.hash(csrfToken).addRandomSalt(32).with(HASH_FUNCTION);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic number?

Comment on lines 98 to 103
final StopWatch stopwatch = new StopWatch("Check csrf token");
stopwatch.start();
final boolean decision = Password.check(token, saltedHash).addSalt(salt).with(HASH_FUNCTION);
stopwatch.stop();

log.trace("Checked token in {}", stopwatch);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s.o.

thoniTUB and others added 4 commits April 30, 2024 07:29
…f/CsrfTokenSetFilter.java

Co-authored-by: awildturtok <1553491+awildturtok@users.noreply.github.com>
Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
order filter priorities
remove csrf-check property

Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
@thoniTUB
Copy link
Collaborator Author

thoniTUB commented May 6, 2024

@awildturtok mir war noch ein Problem, mit der Redirection nach einer Authentifizierung aufgefallen, welches ich jetzt gefixt habe.

Mergen werde ich aber erst nach dem heutigen release

thoniTUB added 2 commits May 6, 2024 13:13
Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
@thoniTUB thoniTUB enabled auto-merge May 7, 2024 09:01
@thoniTUB thoniTUB merged commit 85043bd into develop May 7, 2024
6 checks passed
@delete-merged-branch delete-merged-branch bot deleted the feature/crsf-filter branch May 7, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants