8000 feat(base-driver): Use `markSensitive` to mask password input field value by dprevost-LMI · Pull Request #21118 · appium/appium · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(base-driver): Use markSensitive to mask password input field value #21118

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

Merged

Conversation

dprevost-LMI
Copy link
Contributor
@dprevost-LMI dprevost-LMI commented Mar 16, 2025

Proposed changes

appium-log

As shown in the image above, when entering a value in a field like a password, appium leaks the value at the debug and info level. Since the above can also happen in a cloud provider like BrowserStack, leaking it even at the debug log level can compromise an actual production user account.

Since this approach would be the simplest and quickest, I would like to explicitly exclude it before going into full implementation of the dynamic regular expression to filter the logs as specified here

By using markSensitive to leverage the header X-Appium-Is-Sensitive from the clever solution of PR #21123. We can now mask the password value and safely enter the passwords in input fields without worrying about leaks in logs (when no plugins are used 😉 ).

Pros:

  • Built-in with Appium
  • Easy to use by users: need to pass a simple header
  • No need to keep sensitive data (or part of it as a RegExp) in memory, which is a security OWASP point. See here

Cons:

  • A new line of code could expose the sensitive data without using the new markSensitive function.
  • A third-party plugin could not check this header and leak the password values in the logs.

Remaining tasks:

  • Add unit tests
  • Test in my enterprise app
  • Reveiw wdio PR to use the new header
  • Finish the below template
  • Set PR to ready

These are draft changes, and if the idea is accepted, I will implement all required unit tests

Types of changes

What types of changes does you 8000 r code introduce to Appium?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the Contributing Guide
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@KazuCocoa
Copy link
Member

Would using Settings API be nice for leveraging this feature for all clients?
https://appium.io/docs/en/latest/guides/settings/

@dprevost-LMI
Copy link
Contributor Author
dprevost-LMI commented Mar 17, 2025

Would using Settings API be nice for leveraging this feature for all clients? https://appium.io/docs/en/latest/guides/settings/

Interesting. Using a setting would require a call before (to enable) and after (to disable) the setting API, so there would be three requests if we also count the setValue one.

My main goal is to mask secrets on demand since, for example, in our case, we only require this feature for each test when entering the user's account password. We do not want masking to apply when filling in all other inputs.

Therefore, a header makes it concise to a single request and easier to manage. I would see it as a setting if all the requests of the entire test case needed masking, but this is not necessary for now.

@dprevost-LMI dprevost-LMI changed the title [POC] WIP - Optional mask param to set value [POC] WIP - Optional mask param to set value for sensitive data Mar 17, 2025
@mykola-mokhnach
Copy link
Collaborator

@dprevost-LMI I've tried to collect all findings we've made so far in #21123
Would that work for your purpose?

@mykola-mokhnach
Copy link
Collaborator

@dprevost-LMI We have recently switched the master branch, since we do not maintain Appium 2 anymore and only want to contribute to Appium 3. Could you please recreate this PR with master?

@dprevost-LMI
Copy link
Contributor Author

@dprevost-LMI We have recently switched the master branch, since we do not maintain Appium 2 anymore and only want to contribute to Appium 3. Could you please recreate this PR with master?

🤔 I can, it's unfortunate; I didn't know that otherwise I would have pushed myslef a bit 😅 Moreover, the other part you did was already merged, anyway not sure we can do a release just for that 😄

@dprevost-LMI dprevost-LMI force-pushed the optional-mask-param-to-setValue branch from 41681fe to 92680d9 Compare June 3, 2025 23:35
@dprevost-LMI dprevost-LMI changed the base branch from appium2 to master June 3, 2025 23:45
@github-actions github-actions bot added chore refactoring, overhead, tests, etc. and removed @appium/types @appium/support labels Jun 3, 2025
@mykola-mokhnach mykola-mokhnach marked this pull request as ready for review June 4, 2025 17:52
@mykola-mokhnach mykola-mokhnach changed the title [POC] WIP - Use markSensitive to mask password input field value feat(base-driver): Use markSensitive to mask password input field value Jun 4, 2025
@mykola-mokhnach mykola-mokhnach merged commit aa5d794 into appium:master Jun 4, 2025
9 of 10 checks passed
9E81
@dprevost-LMI
Copy link
Contributor Author

Thanks a lot for your help and patience @mykola-mokhnach

dprevost-LMI added a commit to dprevost-LMI/webdriverio that referenced this pull request Jun 5, 2025
- Dependant [Appium PR](appium/appium#21118) got merge and be available only in v3
- Fix missing main title in page + missing end tag for info sections
- Readjust some documentation
- Add Best Practice section
christian-bromann added a commit to webdriverio/webdriverio that referenced this pull request Jun 6, 2025
…wing PR merge (#14547)

* Fix doc glitches + update Appium required version following PR merge

- Dependant [Appium PR](appium/appium#21118) got merge and be available only in v3
- Fix missing main title in page + missing end tag for info sections
- Readjust some documentation
- Add Best Practice section

* Make log example more visible

* Update website/docs/Security.md

---------

Co-authored-by: Christian Bromann <git@bromann.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@appium/base-driver chore refactoring, overhead, tests, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0