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

Capturing sensitive data : hiding the value in the report #2972

Closed
glb-cblin opened this issue Jun 27, 2024 · 11 comments · Fixed by #3538, #3630, #3631, #3636 or #3638
Closed

Capturing sensitive data : hiding the value in the report #2972

glb-cblin opened this issue Jun 27, 2024 · 11 comments · Fixed by #3538, #3630, #3631, #3636 or #3638
Labels
enhancement New feature or request topic: secret
Milestone

Comments

@glb-cblin
Copy link

glb-cblin commented Jun 27, 2024

I'd like to capture sensitive data in my test and I do not want it to show up in the reports

Is that possible ?

Actual example

POST {{URL}}:/token
{
  "login": "{{LOGIN}}", 
  "password": "{{PASSWORD}}"
}

HTTP 200
[Captures]
access_token: jsonpath "$.access_token"

=> I do not want to be able to see this access_token in the report since it is a permanent token (yes I know, it's not correct from the server to return always the same token but I do not have the choice here ...)

I'd like to be able to do something like

 access_token: jsonpath "$.access_token" hidden
@glb-cblin glb-cblin added the bug Something isn't working label Jun 27, 2024
@jcamiel
Copy link
Collaborator

jcamiel commented Jun 27, 2024

Hi,
Yes we'll support this feature : hiding secrets in logs and reports.

See #2950

@glb-cblin
Copy link
Author

I'm sorry, I do not see how this is realted to #2950

@jcamiel jcamiel added enhancement New feature or request topic: secret and removed bug Something isn't working labels Jun 27, 2024
@jcamiel
Copy link
Collaborator

jcamiel commented Aug 9, 2024

Sorry for this, it should have been #2947

@jcamiel jcamiel added this to the 6.1.0 milestone Dec 19, 2024
@glb-cblin
Copy link
Author

hi @jcamiel

thanks for the fix but I do not understand how to use it in my use case :)

I was expecting something in https://hurl.dev/docs/capturing-response.html

In #2947, there is discussion about a --secret CLI option but this is not my use case

@glb-cblin
Copy link
Author

from what I can see in the MR, you implemented the --secret CLI option, but this is not my use case

my use case would be to use a "directive" during the capture

POST {{URL}}:/token
{
  "login": "{{LOGIN}}", 
  "password": "{{PASSWORD}}"
}

HTTP 200
[Captures]
access_token: secret jsonpath "$.access_token"

@jcamiel
Copy link
Collaborator

jcamiel commented Dec 19, 2024

Let's say your token value is "ABCD", you can declare a secret with --secret token=ABCD and the value will be redacted from any logs and HTML reports (other report are due to be implemented). It's not necessary a variable (also it can be used as a variable), secrets are just list of strings that you want to be redacted.

Note: it doesn't work if you don't know your value before running your test or if your value is dynamically constructed. Noted, I will see how to address this use case.

@glb-cblin
Copy link
Author

@jcamiel yes I undesrtand that but this is not my use case

In my use case, login and password are secrets and I can use --secret => ok

But, the API return a 10 days long access_token, so I want to consider this captured variable also a secret (but I cannot passed it in the CLI command) => ko

@jcamiel
Copy link
Collaborator

jcamiel commented Dec 20, 2024

Yes noted, we need to address how to redact dynamic value.

@glb-cblin
Copy link
Author

can you reopen this issue or do you prefer to open a new (clearer) one ?

@jcamiel
Copy link
Collaborator

jcamiel commented Dec 20, 2024

I will open another one, I can't unlink this one to the PR! I will put the new issue number here => #3543

@jcamiel
Copy link
Collaborator

jcamiel commented Jan 24, 2025

Hi, secrets are merged on master and will be available on 6.1.0:

  • via command line with a --secret option: hurl --secret token=1234 --test *.hurl
  • via redact keyword for captured variables
GET https://foo.com
HTTP 200
[Captures]
token: header "X-Token" redact

Secrets are redacted from HTML/JSON/JUnit report and logs

Feedbacks are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment