Skip to content

When capturing lambda payload, always cast number into string for sec… #422

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
merged 3 commits into from
Sep 11, 2023

Conversation

joeyzhao2018
Copy link
Contributor

@joeyzhao2018 joeyzhao2018 commented Sep 9, 2023

…urity reasons.

What does this PR do?

When the env DD_CAPTURE_LAMBDA_PAYLOAD set to true, the datadog-lambda-js library can capture the lambda's request and responses by parsing them and tagging the span with the keys and values.
This change is to make sure no values are tagged as number by casting them into strings.

Motivation

Treating the payloads values as string for this very payload capturing feature is expected behavior. This does't change the payload. This is strictly for the payload capturing feature and it does't imply other scenarios should follow the same pattern.

Testing Guidelines

This has been tested in our serverless sandbox us-west-2 region joey-node-hello-world lambda. For serverless teammates, feel free to check its environment setting and test

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@joeyzhao2018 joeyzhao2018 requested a review from a team as a code owner September 9, 2023 01:28
@codecov-commenter
Copy link

codecov-commenter commented Sep 9, 2023

Codecov Report

Merging #422 (1f75b35) into main (a44624f) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 1f75b35 differs from pull request most recent head 57e9275. Consider uploading reports for the commit 57e9275 to get more accurate results

@@           Coverage Diff           @@
##             main     #422   +/-   ##
=======================================
  Coverage   80.80%   80.80%           
=======================================
  Files          38       38           
  Lines        2001     2001           
  Branches      466      466           
=======================================
  Hits         1617     1617           
  Misses        323      323           
  Partials       61       61           
Files Changed Coverage Δ
src/utils/tag-object.ts 84.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

# Run the image by runtime tag, tar its generatd `node` directory to sdout,
# then extract it to a temp directory.
docker run --rm datadog-lambda-layer-node:$1 tar cf - /nodejs | tar -xf - -C $temp_dir
# Run the image by runtime tag and copy the output /nodejs to the temp dir
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For more information, check the python PR: DataDog/datadog-lambda-python@8f2686c

@joeyzhao2018 joeyzhao2018 merged commit e37336a into main Sep 11, 2023
@joeyzhao2018 joeyzhao2018 deleted the joey/cast-into-string branch September 11, 2023 15:11
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.

3 participants