-
Notifications
You must be signed in to change notification settings - Fork 675
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
feat: mask values typed into input[type=password] in a reporter #6191
Conversation
constructor (obj, validate) { | ||
super(); | ||
|
||
this.confidential = void 0; |
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.
It's better to put down the confidential
property to the basic classes and set the false
as a default value.
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.
void 0
is necessary as a default value. It's needed to indicate that a user didn't set this flag explicitly.
I've tried to use enum
for this flag, but it looks overcomplicated in my opinion (ts-hack to create 3-state boolean):
enum ConfidentialSetting {
False,
True,
CheckRequired
}
Now by default, this option will be shown in the "options" property of the command:
{
type: TYPE.typeText,
options: {
confidential: 2 // or the "CheckRequired" string (not better)
}
}
Whereas void 0
wouldn't be set at all. I think it's better to stick with the void 0
variant.
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.
It's not clear what the void 0
value means in the context of the confidential
option.
So, in my opinion, the enum ConfidentialSetting
is a good variant.
@AndreyBelym what do you think about it?
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.
IMHO:
TLDR; I'm against a tri-state enum:
-
In this enum, 2 of 3 values just replicate boolean options. For me, it's a sign of redundant complexity.
-
I can't see any case when I would want to specify
ConfidentialSetting.CheckRequired
manually. Why should we give it a name, if a user won't interact with it? -
I can describe easily the boolean configuration:
Iftrue
, we hide the input value
Iffalse
, we show the input value
By default, it'strue
when the target selector is input[type=password],false
otherwise.
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.
Well, about point 2: I see a case, if we implement some global-level options, you may want to reset this flag to default in some cases. But since undefined
is a common way to reset something to default in JS everywhere, I don't see it as a problem.
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.
Ok. Let it be.
constructor (obj, validate) { | ||
super(); | ||
|
||
this.confidential = void 0; |
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.
It's not clear what the void 0
value means in the context of the confidential
option.
So, in my opinion, the enum ConfidentialSetting
is a good variant.
@AndreyBelym what do you think about it?
"include": [ "../@types", "./"], | ||
"include": [ | ||
"../@types", | ||
"../ts-defs-src", |
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.
"../ts-defs-src"
Why does it necessary? I as remember we have a separate Gulp step for the TypeScript definitions.
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.
I guess it should test the compatibility between our end-user TS defs and our source-level defs.
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.
I've added the end user TS defs in order to reuse them in the source code and don't maintain two versions of the same TS defs.
For example NodeSnapshot
was already defined in the end-user TS defs:
interface NodeSnapshot { |
Also the
CompilerOptions
interface was defined too: type CompilerOptions = { |
constructor (obj, validate) { | ||
super(); | ||
|
||
this.confidential = void 0; |
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.
IMHO:
TLDR; I'm against a tri-state enum:
-
In this enum, 2 of 3 values just replicate boolean options. For me, it's a sign of redundant complexity.
-
I can't see any case when I would want to specify
ConfidentialSetting.CheckRequired
manually. Why should we give it a name, if a user won't interact with it? -
I can describe easily the boolean configuration:
Iftrue
, we hide the input value
Iffalse
, we show the input value
By default, it'strue
when the target selector is input[type=password],false
otherwise.
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.
Purpose
Values typed into input[type=password] should be replaced by a placeholder before sending action logs with these values to a reporter. Also the
pressKey
and thetypeText
actions have theconfidential
flag. If it set to 'true', then any typed text & pressed keys would be replaced by a placeholder in action logs.Approach
Detect what is the target element (either specified in the
typeText
action or current active element for thepressKey
action). If it's the input which type is 'password' or theconfidential
flag is set to true, then replace info with a placeholder.References
Closes #6014
Pre-Merge TODO