Skip to content

Reject tokens with unusable characters before any request - #1

Open
snehal-thombare wants to merge 2 commits into
mainfrom
my-bugfix
Open

snehal-thombare wants to merge 2 commits into
mainfrom
my-bugfix

Conversation

@snehal-thombare

@snehal-thombare snehal-thombare commented Dec 3, 2026 •

Copy link
Copy Markdown

Problem

A token with a non-ASCII or control character is accepted by the client.
The mistake is not reported when the client is created.

Approach

token_value() now raises ValueError when the token is not printable ASCII.
The message does not include the token. Both clients use this check.

Reproduce (on main)

Create ProoflineClient("abc\x00", base_url="http://127.0.0.1:9"):
no error is raised for the invalid token.

Tests

  • Original 8 cases failed before the fix and passed after
  • tests/test_token.py now has 22 cases
  • python -m pytest -q tests/test_token.py
  • python3 scripts/check.py passes

Proofline review

Two warnings about test gaps. I accepted both and added tests in f6576f9.
The two-line fix itself did not change.

Related

prooflinedev#75 changes how errors before a request are
reported. This change rejects the bad token when the client is created.

AI use

I used an AI assistant to find the bug and draft the test, fix and description.

@prooflinedev prooflinedev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Proofline has 2 new findings to review.

View full review in Proofline

Comment thread tests/test_token.py Resolved
Comment thread tests/test_token.py Resolved
@prooflinedev

prooflinedev Bot commented Dec 3, 2026

Copy link
Copy Markdown

Finding commands

Proofline recorded 1 finding command on this pull request.

  • Marked fixed: 1

Affected findings

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.

1 participant