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

Hide secret while reporting #244

Closed
leo-coco opened this issue May 24, 2024 · 2 comments
Closed

Hide secret while reporting #244

leo-coco opened this issue May 24, 2024 · 2 comments

Comments

@leo-coco
Copy link

Hello,

I would be nice to have a option to hide sensitive data aka password or token while reporting

  cy:request ✔  POST https://ids-dev.xxxx.xxx/connect/token
                        Status: 200
                        Response body: {
                          "access_token": "eyJjUnq2AwhQK9Qrz1sabHhhBKpxeUie6rfr-A",
                          "expires_in": 3600,
                          "token_type": "Bearer",
                          "scope": "email emisid openid profile"
                        }

Here we would need access_token to be hidden

@archfz
Copy link
Owner

archfz commented May 26, 2024

I am not sure how this can be implemented properly. You could use processLog config with some regex currently, although it would be costly. Any ideas or contribution is welcome.

@archfz
Copy link
Owner

archfz commented Jun 6, 2024

I recommend you use the following config for the support install:

processLog: ({type, message, severity}) => 
  type === 'cy:request' 
    ? {type, message.replace(/"access_token": "[^"]+"/g, "access_token": "***"), severity}
    : {type, message, severity}

This should have decent performance for your case.

@archfz archfz closed this as completed Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants