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(iast): avoid native module import if iast disabled #8564

Merged
merged 13 commits into from
Mar 4, 2024

Conversation

gnufede
Copy link
Member

@gnufede gnufede commented Mar 1, 2024

IAST: Forces an ImportError if the IAST _taint_tracking native module is imported when IAST is not enabled, to ensure there are no side_effects, like segmentation faults, if IAST is not enabled.

Fixes #8504

Checklist

  • Change(s) are motivated and described in the PR description
  • Testing strategy is described if automated tests are not included in the PR
  • Risks are described (performance impact, potential for breakage, maintainability)
  • Change is maintainable (easy to change, telemetry, documentation)
  • Library release note guidelines are followed or label changelog/no-changelog is set
  • Documentation is included (in-code, generated user docs, public corp docs)
  • Backport labels are set (if applicable)
  • If this PR changes the public interface, I've notified @DataDog/apm-tees.
  • If change touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.

Reviewer Checklist

  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Description motivates each change
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Change is maintainable (easy to change, telemetry, documentation)
  • Release note makes sense to a user of the library
  • Author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Mar 1, 2024

Datadog Report

Branch report: gnufede/avoid-native-load-if-iast-disabled
Commit report: 530e975
Test service: dd-trace-py

✅ 0 Failed, 129632 Passed, 42335 Skipped, 7h 45m 0s Total duration (3h 55m 5.53s time saved)

@pr-commenter
Copy link

pr-commenter bot commented Mar 1, 2024

Benchmarks

Benchmark execution time: 2024-03-04 18:58:08

Comparing candidate commit ba4841a in PR branch gnufede/avoid-native-load-if-iast-disabled with baseline commit 6592d5d in branch main.

Found 0 performance improvements and 7 performance regressions! Performance is the same for 194 metrics, 9 unstable metrics.

scenario:coreapiscenario-context_with_data_only_all_listeners

  • 🟥 max_rss_usage [+642.919KB; +788.633KB] or [+2.199%; +2.698%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • 🟥 max_rss_usage [+729.877KB; +865.105KB] or [+2.499%; +2.962%]

scenario:httppropagationinject-with_tags

  • 🟥 max_rss_usage [+672.818KB; +755.457KB] or [+2.300%; +2.583%]

scenario:otelspan-start-finish

  • 🟥 max_rss_usage [+681.333KB; +831.320KB] or [+2.224%; +2.714%]

scenario:otelspan-start-finish-telemetry

  • 🟥 max_rss_usage [+681.722KB; +800.621KB] or [+2.224%; +2.612%]

scenario:sethttpmeta-obfuscation-send-querystring-disabled

  • 🟥 max_rss_usage [+692.781KB; +806.764KB] or [+2.321%; +2.703%]

scenario:span-add-metrics

  • 🟥 max_rss_usage [+25.777MB; +25.878MB] or [+65.934%; +66.192%]

@gnufede gnufede marked this pull request as ready for review March 1, 2024 13:57
@gnufede gnufede requested review from a team as code owners March 1, 2024 13:57
@gnufede gnufede added bug ASM Application Security Monitoring backport 2.4 labels Mar 1, 2024
@gnufede gnufede enabled auto-merge (squash) March 4, 2024 08:15
@gnufede gnufede disabled auto-merge March 4, 2024 08:18
@gnufede gnufede enabled auto-merge (squash) March 4, 2024 08:18
@gnufede gnufede requested a review from emmettbutler March 4, 2024 17:41
@gnufede gnufede merged commit b4a1d97 into main Mar 4, 2024
159 checks passed
@gnufede gnufede deleted the gnufede/avoid-native-load-if-iast-disabled branch March 4, 2024 21:45
Copy link
Contributor

github-actions bot commented Mar 4, 2024

The backport to 2.4 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.4 2.4
# Navigate to the new working tree
cd .worktrees/backport-2.4
# Create a new branch
git switch --create backport-8564-to-2.4
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b4a1d979c7b85b91b9a31e0a763a043c74f97d78
# Push it to GitHub
git push --set-upstream origin backport-8564-to-2.4
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.4

Then, create a pull request where the base branch is 2.4 and the compare/head branch is backport-8564-to-2.4.

Copy link
Contributor

github-actions bot commented Mar 4, 2024

The backport to 2.5 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.5 2.5
# Navigate to the new working tree
cd .worktrees/backport-2.5
# Create a new branch
git switch --create backport-8564-to-2.5
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b4a1d979c7b85b91b9a31e0a763a043c74f97d78
# Push it to GitHub
git push --set-upstream origin backport-8564-to-2.5
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.5

Then, create a pull request where the base branch is 2.5 and the compare/head branch is backport-8564-to-2.5.

github-actions bot pushed a commit that referenced this pull request Mar 4, 2024
IAST: Forces an `ImportError` if the IAST `_taint_tracking` native
module is imported when IAST is not enabled, to ensure there are no
side_effects, like segmentation faults, if IAST is not enabled.

Fixes #8504

## Checklist

- [x] Change(s) are motivated and described in the PR description
- [x] Testing strategy is described if automated tests are not included
in the PR
- [x] Risks are described (performance impact, potential for breakage,
maintainability)
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [x] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.
- [x] If change touches code that signs or publishes builds or packages,
or handles credentials of any kind, I've requested a review from
`@DataDog/security-design-and-guidance`.

## Reviewer Checklist

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Description motivates each change
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] Release note makes sense to a user of the library
- [x] Author has acknowledged and discussed the performance implications
of this PR as reported in the benchmarks PR comment
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

(cherry picked from commit b4a1d97)
github-actions bot pushed a commit that referenced this pull request Mar 4, 2024
IAST: Forces an `ImportError` if the IAST `_taint_tracking` native
module is imported when IAST is not enabled, to ensure there are no
side_effects, like segmentation faults, if IAST is not enabled.

Fixes #8504

## Checklist

- [x] Change(s) are motivated and described in the PR description
- [x] Testing strategy is described if automated tests are not included
in the PR
- [x] Risks are described (performance impact, potential for breakage,
maintainability)
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [x] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.
- [x] If change touches code that signs or publishes builds or packages,
or handles credentials of any kind, I've requested a review from
`@DataDog/security-design-and-guidance`.

## Reviewer Checklist

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Description motivates each change
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] Release note makes sense to a user of the library
- [x] Author has acknowledged and discussed the performance implications
of this PR as reported in the benchmarks PR comment
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

(cherry picked from commit b4a1d97)
emmettbutler pushed a commit that referenced this pull request Mar 5, 2024
…#8599)

Backport b4a1d97 from #8564 to 2.7.

IAST: Forces an `ImportError` if the IAST `_taint_tracking` native
module is imported when IAST is not enabled, to ensure there are no
side_effects, like segmentation faults, if IAST is not enabled.

Fixes #8504

## Checklist

- [x] Change(s) are motivated and described in the PR description
- [x] Testing strategy is described if automated tests are not included
in the PR
- [x] Risks are described (performance impact, potential for breakage,
maintainability)
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [x] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.
- [x] If change touches code that signs or publishes builds or packages,
or handles credentials of any kind, I've requested a review from
`@DataDog/security-design-and-guidance`.

## Reviewer Checklist

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Description motivates each change
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] Release note makes sense to a user of the library
- [x] Author has acknowledged and discussed the performance implications
of this PR as reported in the benchmarks PR comment
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

Co-authored-by: Federico Mon <[email protected]>
emmettbutler pushed a commit that referenced this pull request Mar 5, 2024
…#8598)

Backport b4a1d97 from #8564 to 2.6.

IAST: Forces an `ImportError` if the IAST `_taint_tracking` native
module is imported when IAST is not enabled, to ensure there are no
side_effects, like segmentation faults, if IAST is not enabled.

Fixes #8504

## Checklist

- [x] Change(s) are motivated and described in the PR description
- [x] Testing strategy is described if automated tests are not included
in the PR
- [x] Risks are described (performance impact, potential for breakage,
maintainability)
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [x] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [x] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.
- [x] If change touches code that signs or publishes builds or packages,
or handles credentials of any kind, I've requested a review from
`@DataDog/security-design-and-guidance`.

## Reviewer Checklist

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Description motivates each change
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] Release note makes sense to a user of the library
- [x] Author has acknowledged and discussed the performance implications
of this PR as reported in the benchmarks PR comment
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)

Co-authored-by: Federico Mon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ASM Application Security Monitoring bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uWSGI Segmentation Fault
3 participants