-
Notifications
You must be signed in to change notification settings - Fork 50
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Logger] Add redact step #1610
[Logger] Add redact step #1610
Conversation
This commit adds redact step to a Logger. ONE-vscode-DCO-1.0-Signed-off-by: Dayoung Lee <[email protected]>
Redacted log exampleWhen running configuration, docker runs with a github token (in-office network only, though)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Samsung/one-vscode_committers PTAL :-D |
src/Utils/Logger.ts
Outdated
const redact = (msg: string) => { | ||
// Replace github tokens with ******** | ||
const prefix = "ghp_"; | ||
const regex = new RegExp(`${prefix}[a-zA-Z0-9]+`, "g"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about to add the regular expression for 'Fine Grained Personal Acess Token' either?
I'm not sure whether RegExp() supports 'ORed' expression, if so we can add it as OR-ed option as like,
const prefix_classic = "ghp_";
const prefix_fgp = "github_pat_";
`^(${prefix_classic}[a-zA-Z0-9]+|${prefix_fgp}_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59})`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@batcheu Look like a good idea to add the fine grained tokens :-D
BTW I didn't find the string length of classic token so I made it to redact all the strings starting with 'ghp_'.
And I cannot find the string length of fine grained token either, nowhere in github docs.
If you have found some, could you let me know the link?
If not, let me simply add find-grained Regex as github_pat_[_a-zA-Z0-9]+.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@batcheu PTAL:-D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I didn't notice that you added comments. 😮
Sorry for late reply 😢
I checked the regular expression of new type of access token in below link.
But it's personal blog, so it would not support up-to-date version of token format.
And today, I also found below GITHUB's official annoucement related with access token.
The length of our tokens is remaining 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.
So, I think that your suggestion is more proper than fixed length expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Samsung/one-vscode_committers PTAL :-D |
This commit adds redact step to a Logger.
ONE-vscode-DCO-1.0-Signed-off-by: Dayoung Lee [email protected]
For #1609