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

chore(asm): improve rasp call mechanism #9954

Conversation

christophe-papazian
Copy link
Contributor

@christophe-papazian christophe-papazian commented Jul 26, 2024

Unless explicitly disabled by an environment variable, the WAF is used for each supported exploit prevention endpoint. This PR enhances this behaviour by leveraging the WAF's "known addresses" feature, which, as of version 1.19.0, skips disabled rules, to prevent calling the WAF if unnecessary.
Now, calls to the WAF will only occur if at least one specific rule for that endpoint has been enabled via remote configuration.

Also:

  • add new Shell Injection address in the address list in appsec constants and corresponding property in appsec span processor
  • add regression tests in the hatch threat test for exploit prevention to check that no call and no telemetry is generated for disabled rules

APPSEC-54272

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, 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

@christophe-papazian christophe-papazian added enhancement ASM Application Security Monitoring labels Jul 26, 2024
Copy link
Contributor

github-actions bot commented Jul 26, 2024

CODEOWNERS have been resolved as:

releasenotes/notes/rasp_conditional_call-f700a122b82b4c4f.yaml          @DataDog/apm-python
tests/appsec/appsec/rules-rasp-disabled.json                            @DataDog/asm-python
ddtrace/appsec/_common_module_patches.py                                @DataDog/asm-python
ddtrace/appsec/_constants.py                                            @DataDog/asm-python
ddtrace/appsec/_processor.py                                            @DataDog/asm-python
tests/appsec/contrib_appsec/utils.py                                    @DataDog/asm-python
tests/appsec/rules.py                                                   @DataDog/asm-python

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

datadog-dd-trace-py-rkomorn bot commented Jul 26, 2024

Datadog Report

Branch report: christophe-papazian/APPSEC-54272_improve_rasp_call_mechanism
Commit report: 637a4d6
Test service: dd-trace-py

✅ 0 Failed, 109880 Passed, 3927 Skipped, 6m 11.25s Total duration (3m 21.04s time saved)

@codecov-commenter
Copy link

codecov-commenter commented Jul 26, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.

Project coverage is 10.56%. Comparing base (3237351) to head (637a4d6).
Report is 3 commits behind head on main.

Files Patch % Lines
ddtrace/appsec/_constants.py 0.00% 1 Missing ⚠️
ddtrace/appsec/_processor.py 91.66% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (3237351) and HEAD (637a4d6). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (3237351) HEAD (637a4d6)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #9954       +/-   ##
===========================================
- Coverage   73.94%   10.56%   -63.38%     
===========================================
  Files        1402     1367       -35     
  Lines      130460   127989     -2471     
===========================================
- Hits        96465    13520    -82945     
- Misses      33995   114469    +80474     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@christophe-papazian christophe-papazian marked this pull request as ready for review July 26, 2024 13:00
@christophe-papazian christophe-papazian requested review from a team as code owners July 26, 2024 13:00
@christophe-papazian christophe-papazian requested review from avara1986 and Yun-Kim and removed request for avara1986 July 26, 2024 13:00
@gnufede gnufede added the changelog/no-changelog A changelog entry is not required for this PR. label Jul 26, 2024
@pr-commenter
Copy link

pr-commenter bot commented Jul 26, 2024

Benchmarks

Benchmark execution time: 2024-07-26 13:41:01

Comparing candidate commit 13ccfe4 in PR branch christophe-papazian/APPSEC-54272_improve_rasp_call_mechanism with baseline commit 91af6f6 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 214 metrics, 2 unstable metrics.

@christophe-papazian christophe-papazian enabled auto-merge (squash) July 26, 2024 13:59
@christophe-papazian christophe-papazian merged commit b684af2 into main Jul 26, 2024
74 checks passed
@christophe-papazian christophe-papazian deleted the christophe-papazian/APPSEC-54272_improve_rasp_call_mechanism branch July 26, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ASM Application Security Monitoring changelog/no-changelog A changelog entry is not required for this PR. enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants