Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore(utils): relax GitHub PAT validation (#380)#383

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
filipchristiansen wants to merge3 commits intomain
base:main
Choose a base branch
Loading
fromchore/380-relax-github-token-validation

Conversation

filipchristiansen
Copy link
Contributor

  • DropInvalidGitHubTokenError
  • validate_github_token now emits aUserWarning instead of raising
  • Update tests to:
    • assert no warnings for valid tokens (viarecwarn)
    • expectUserWarning for malformed tokens
  • Reduces false-positives and is future-proof if GitHub introduces new token formats

Closes#380

* Drop `InvalidGitHubTokenError`* `validate_github_token` now emits a `UserWarning` instead of raising* Update tests to:  * assert no warnings for valid tokens (via `recwarn`)  * expect `UserWarning` for malformed tokens* Reduces false-positives and is future-proof if GitHub introduces new token formatsCloses#380
"""
if not re.fullmatch(_GITHUB_PAT_PATTERN, token):
raise InvalidGitHubTokenError
warnings.warn(
Copy link
Contributor

@ix-56hix-56hJul 4, 2025
edited
Loading

Choose a reason for hiding this comment

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

We don't need to validate the token with pattern matching and the warning is useless here i guess.
When the token is invalid (malformed or just invalid) we correctly handle the error:
image

I don't see why we validate and log the validation result here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the validation is informative. Just a little message saying "this does not look like a proper token, tokens usually start with gh_ blablabla" because yeah, believe me, i've seen too many people struggle with access tokens and just put their plain password or something

ix-56h and filipchristiansen reacted with thumbs up emoji
@filipchristiansenfilipchristiansen marked this pull request as draftJuly 11, 2025 18:39
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@NicolasIRAGNENicolasIRAGNENicolasIRAGNE left review comments

@ix-56hix-56hix-56h requested changes

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

chore: chill out on Token validation
3 participants
@filipchristiansen@NicolasIRAGNE@ix-56h

[8]ページ先頭

©2009-2025 Movatter.jp