Skip to content

Commit 2891c6a

Browse files
authored
bugfix: update the RegExp to suit the new GitHub access tokens format. (#85)
See: https://github.blog/changelog/2021-03-04-authentication-token-format-updates/ The new format has a potentially useful prefix, but this should support both old and new tokens.
1 parent 5237e5c commit 2891c6a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bin/opm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ sub do_upload {
812812
err "$rc_file: no \"github_token\" specified.\n";
813813
}
814814

815-
if ($token !~ /^[a-f0-9]{40}$/i) {
815+
if ($token !~ /^[a-z0-9_]{40,255}$/i) {
816816
err "$rc_file: bad \"github_token\" value: $token\n";
817817
}
818818

web/lua/opmserver.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function _M.do_upload()
129129

130130
local token = ngx_var.http_x_token
131131

132-
if not re_find(token, [[^[a-f0-9]{40}$]], "ijo") then
132+
if not re_find(token, [[^[a-z0-9_]{40,255}$]], "ijo") then
133133
return log_and_out_err(ctx, 400, "bad github personal access token.")
134134
end
135135

0 commit comments

Comments
 (0)