Skip to content

Update PAT validation #148

Closed
Closed
@jennybc

Description

@jennybc

https://github.blog/changelog/2021-03-04-authentication-token-format-updates/

PATs are included in in "each of these token types" here:

For each of these token types we are making the following changes:

  • The character set is changing from [a-f0-9] to [A-Za-z0-9_]
  • The format is changing to include a prefix:
    • gp1_ for Personal Access Tokens
      ...

The overall length of our tokens will remain the same for now. However, GitHub tokens will likely increase in length in future updates, so integrators should plan to support tokens up to 255 characters after June 1, 2021.

This needs to change:

gh/R/gh_token.R

Lines 75 to 83 in 978cb6e

# validates PAT only in a very narrow, technical, and local sense
validate_gh_pat <- function(x) {
stopifnot(inherits(x, "gh_pat"))
if (x == "" || grepl("[[:xdigit:]]{40}", x)) {
x
} else {
throw(new_error("A GitHub PAT must consist of 40 hexadecimal digits"))
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions