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

fix(core): Handle null response_content before passing to findSensitiveValues #772

Merged
merged 2 commits into from
Apr 18, 2024

Conversation

kola-er
Copy link
Contributor

@kola-er kola-er commented Apr 16, 2024

No description provided.

@eliangcs
Copy link
Member

@kola-er can you add a test case in core/test/logger.js so we don't break it by accident in the future? Thanks!

Copy link
Member

@eliangcs eliangcs left a comment

Choose a reason for hiding this comment

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

The fix itself looks good! But to reproduce the exact same error, the test code needs a tweak.

resBody: JSON.stringify(null),
});

logger(message, data);
Copy link
Member

@eliangcs eliangcs Apr 17, 2024

Choose a reason for hiding this comment

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

I removed || {} temporarily, trying to reproduce this same error:

     TypeError: Cannot convert undefined or null to object
      at Function.entries (<anonymous>)
      at recurseExtract (/Users/eliang/Projects/zapier-platform/node_modules/@zapier/secret-scrubber/lib/utils.js:108:27)
      at findSensitiveValues (/Users/eliang/Projects/zapier-platform/node_modules/@zapier/secret-scrubber/lib/index.js:50:39)
      at attemptFindSecretsInStr (src/tools/create-logger.js:136:10)

I found that we need to add an await here. Otherwise, the error would be silently swallowed.

Suggested change
logger(message, data);
await logger(message, data);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I updated it @eliangcs

@kola-er kola-er merged commit aa3b23a into main Apr 18, 2024
13 checks passed
@kola-er kola-er deleted the PDE-4922 branch April 18, 2024 09:37
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.

2 participants