Skip to content

Handle failed token test without leaking token#1138

Merged
AttackingOrDefending merged 1 commit into
lichess-bot-devs:masterfrom
MarkZH:fix-token-leak-from-token-test
Oct 1, 2025
Merged

Handle failed token test without leaking token#1138
AttackingOrDefending merged 1 commit into
lichess-bot-devs:masterfrom
MarkZH:fix-token-leak-from-token-test

Conversation

@MarkZH
Copy link
Copy Markdown
Collaborator

@MarkZH MarkZH commented Sep 29, 2025

Type of pull request:

  • Bug fix
  • Feature
  • Other

Description:

If the line token_info = token_response[token] fails with a KeyError (due to an error response from lichess), the user's token will be printed in the error message. Use token_response.get() to prevent this.

Related Issues:

Checklist:

  • I have read and followed the contribution guidelines.
  • I have added necessary documentation (if applicable).
  • The changes pass all existing tests.

Screenshots/logs (if applicable):

If the line `token_info = token_response[token]` fails with a `KeyError`
(due to an error response from lichess), the user's token will be
printed in the error message. Use `token_response.get()` to prevent
this.

Also, use `.get()` on the resulting `token_info` to print a more useful
error message.
@AttackingOrDefending AttackingOrDefending merged commit c5bbdea into lichess-bot-devs:master Oct 1, 2025
23 checks passed
@MarkZH MarkZH deleted the fix-token-leak-from-token-test branch October 3, 2025 10:09
r0950336 pushed a commit to r0950336/lichess-bot that referenced this pull request Dec 31, 2025
If the line `token_info = token_response[token]` fails with a `KeyError`
(due to an error response from lichess), the user's token will be
printed in the error message. Use `token_response.get()` to prevent
this.

Also, use `.get()` on the resulting `token_info` to print a more useful
error message.
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