Skip to content
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

Added check to hide password in html reports #4054

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dikwickley
Copy link
Contributor

@dikwickley dikwickley commented Feb 26, 2024

fixes: #3935
Thanks in advance for your contribution. Please follow the below steps in submitting a pull request, as it will help us with reviewing it quicker.

Final result
before:
image

after:
image

  • Create a new branch from master (e.g. features/my-new-feature or issue/123-my-bugfix);
  • If you're fixing a bug also create an issue if one doesn't exist yet;
  • If it's a new feature explain why do you think it's necessary. Please check with the maintainers beforehand to make sure it is something that we will accept. Usually we only accept new features if we feel that they will benefit the entire community;
  • Please avoid sending PRs which contain drastic or low level changes. If you are certain that the changes are needed, please discuss them beforehand and indicate what the impact will be;
  • If your change is based on existing functionality please consider refactoring first. Pull requests that duplicate code will most likely be ignored;
  • Do not include changes that are not related to the issue at hand;
  • Follow the same coding style with regards to spaces, semicolons, variable naming etc.;
  • Always add unit tests - PRs without tests are most of the times ignored.

@dikwickley
Copy link
Contributor Author

@garg3133 you can review this.

Copy link

Status

  • ❌ No modified files found in the types directory.
    Please make sure to include types for any changes you have made. Thank you!.

@gravityvi
Copy link
Member

Hey @dikwickley the changes look good. However can you think of a better way to hide it. Right now if you see the command in verbose logs it would show the passkey passed to setPassword command

@garg3133
Copy link
Member

Right now if you see the command in verbose logs it would show the passkey passed to setPassword command

This would also appear in the "Raw HTTP log" tab of the report.

Comment on lines +449 to +453
// Masking passwords so they don't appear as plain text in reports.
if (command.name === 'setPassword') {
const newArgs = [command.args[0], '*'.repeat(command.args[1].length)];
command.args = newArgs;
}
Copy link
Member

@garg3133 garg3133 Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't add fix for a very specific case in a general method like this, it bloats these methods. We should always try to make our solution general so that we can easily expand it to other places as well (think if more commands were to use the redaction functionality, how the solution we're adding could help them as well without hard coding the command names).

See here how this functionality was approached earlier and try to make changes along the same lines and using the existing code: #2672

The above solution no longer works because while earlier we used to call TransportActions.post() to send HTTP requests directly, we now use Selenium methods (element.sendKeys() here) to do so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am looking into this only.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure, I just posted a message there so that other people can also try and find a solution to this, if they have no other issues to work on.

@garg3133 garg3133 marked this pull request as draft March 1, 2024 17:59
@garg3133
Copy link
Member

garg3133 commented Mar 1, 2024

Converted this to draft since it still requires work. Please feel free to mark it as ready for review when the PR is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

password visible in html output
3 participants