-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(runner+browserstack): Mask sensitive data for Reporters (and more) #13938
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(runner+browserstack): Mask sensitive data for Reporters (and more) #13938
Conversation
onBeforeComand
& onAfterCommand
onBeforeComand
& onAfterCommand
eslint-plugin-wdio
@wdio/allure-reporter
@wdio/appium-service
@wdio/browser-runner
@wdio/browserstack-service
@wdio/cli
@wdio/concise-reporter
@wdio/config
@wdio/cucumber-framework
@wdio/dot-reporter
@wdio/firefox-profile-service
@wdio/globals
@wdio/jasmine-framework
@wdio/json-reporter
@wdio/junit-reporter
@wdio/lighthouse-service
@wdio/local-runner
@wdio/logger
@wdio/mocha-framework
@wdio/protocols
@wdio/repl
@wdio/reporter
@wdio/runner
@wdio/sauce-service
@wdio/shared-store-service
@wdio/smoke-test-cjs-service
@wdio/smoke-test-reporter
@wdio/smoke-test-service
@wdio/spec-reporter
@wdio/static-server-service
@wdio/sumologic-reporter
@wdio/testingbot-service
@wdio/types
@wdio/utils
@wdio/webdriver-mock-service
webdriver
webdriverio
commit: |
onBeforeComand
& onAfterCommand
onBeforeComand
& onAfterCommand
onBeforeComand
& onAfterCommand
f1c6a2e
to
13570dc
Compare
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.
Some comments
7a712fc
to
b6a4f6c
Compare
Just to note here: we are working with different logs:
It would be awesome if the solution:
I am open to how the mask option look like as long as it is intuitive. Maybe there is an NPM package that detects secrets and can give us an indication whether we should mask it. Otherwise aligning with what Appium does makes total sense to me. I don't think we can do anything about what the Vendor displays in their UI. Hope this makes sense. Please let me know. |
Let's settle this in the issue! #13937 (comment) |
33f944e
to
71c8369
Compare
71c8369
to
f7489c7
Compare
1fdd837
to
b9e3b25
Compare
7cf4895
to
3a088a9
Compare
Co-authored-by: Christian Bromann <[email protected]>
Co-authored-by: Christian Bromann <[email protected]>
480dd57
to
90647ae
Compare
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.
Should we add some documentation for the new property somewhere here? I think it would help folks to discover this feature much better. I think we can just copy the docs from the logger readme file.
In addition to your request (done in 0708a6d), I had considered that a new "Security" section on the wdio website would be helpful.
/**
* Set the logger level of the webdriver logger to 'error' before running a promise which is useful to hide sensitive information in the logs.
*/
export const withSilentLogger = async <T>(promise: () => Promise<T>): Promise<T> => {
const webdriverLogLevel = driver.options.logLevel ?? 'error';
try {
logger.setLevel('webdriver', 'silent');
return await promise();
} finally {
logger.setLevel('webdriver', webdriverLogLevel);
}
};
What do you think? |
Great idea! Let's do this. |
…n' into masked-sensible-information
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.
Amazing stuff 🙌
Hey dprevost-LMI 👋 Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution. We've sent you an email with further instructions on how to claim your expenses from our development fund. We are looking forward to more contributions from you in the future 🙌 Have a nice day, |
Proposed changes
To provide easier security, here is a PR which has two main goals:
On the
element.setValue
, add a new boolean mask option allowing to mask from everyone besides appium the value set in an input element. This allows with the simple{mask : true}
to hide the password, for example, of a real production user from wdio logs, any reporters, the performance tool and anyone listening on anyemit
. The cherry on top is the participation of appium's folks, where even in Appium's logs (see PR), this value continues to be masked with the simple boolean options. 🎉setValue
andaddValue
commands are supported. Not the getValue, for example.A regex expression can now be configured in the wdio logs to hide more sensitive information. For example, when using BrowserStack, the user's key is in plain text. Now we can pass a simple regex pattern like
maskingPattern: '--key=([^ ]*)'
, which will mask this value in the logs.See the issue for the history of the discussion that led to the PR decisions.
Example for case 1:

Logs:
Allure-reporter

Example for case 2:

Types of changes
Polish (an improvement for an existing feature)Bugfix (non-breaking change which fixes an issue)Breaking change (fix or feature that would cause existing functionality to not work as expected)Specification changes (updates to WebDriver command specifications)Internal updates (everything related to internal scripts, governance documentation and CI files)Checklist
Backport Request
v9
and doesn't need to be back-portedBack-ported PR at#XXXXX
Further comments
Reviewers: @webdriverio/project-committers
Related to issue #13937
Appium-related issue