Skip to content

Commit

Permalink
Merge branch '2.13' into backport-10962-to-2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
taegyunkim authored Oct 29, 2024
2 parents 80246e1 + fdb023c commit 7ef54e3
Show file tree
Hide file tree
Showing 52 changed files with 465 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.templ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ commands:
description: "Install riot"
steps:
# Make sure we install and run riot on Python 3
- run: pip3 install riot==0.19.1
- run: pip3 install riot==0.20.0

setup_rust:
description: "Install rust toolchain"
Expand Down
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
name: Generate config
command: |
export GIT_COMMIT_DESC=$(git log -n 1 $CIRCLE_SHA1)
pip3 install riot==0.19.1
pip3 install riot==0.20.0
riot -P -v run --pass-env -s circleci-gen-config -- -v
- continuation/continue:
configuration_path: .circleci/config.gen.yml
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/generate-package-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
actions: read
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -45,7 +46,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand Down Expand Up @@ -76,7 +77,7 @@ jobs:
python -m pip install --upgrade pip
pip install packaging
pip install requests
pip install riot==0.19.1
pip install riot==0.20.0
- name: Run regenerate-riot-latest
run: scripts/regenerate-riot-latest.sh
Expand All @@ -98,4 +99,4 @@ jobs:
base: main
title: "chore: update ${{ env.VENV_NAME }} latest version to ${{ env.NEW_LATEST }}"
labels: changelog/no-changelog
body-path: .github/PULL_REQUEST_TEMPLATE.md
body-path: .github/PULL_REQUEST_TEMPLATE.md
2 changes: 1 addition & 1 deletion .github/workflows/requirements-locks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: pyenv global 3.10 3.7 3.8 3.9 3.11 3.12

- name: Install Dependencies
run: pip install --upgrade pip && pip install riot
run: pip install --upgrade pip && pip install riot==0.20.0

- name: Generate riot locks
run: scripts/compile-and-prune-test-requirements
Expand Down
94 changes: 30 additions & 64 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,24 @@ on:
- cron: '00 04 * * 2-6'

jobs:
needs-run:
runs-on: ubuntu-latest
outputs:
outcome: ${{ steps.run_needed.outcome }}
steps:
- uses: actions/checkout@v4
- id: run_needed
name: Check if run is needed
run: |
git fetch origin ${{ github.event.pull_request.base.sha || github.sha }}
export PATHS=$(git diff --name-only HEAD ${{ github.event.pull_request.base.sha || github.sha }})
python -c "import os,sys,fnmatch;sys.exit(not bool([_ for pattern in {'ddtrace/*', 'setup*', 'pyproject.toml', '.github/workflows/system-tests.yml'} for _ in fnmatch.filter(os.environ['PATHS'].splitlines(), pattern)]))"
continue-on-error: true

system-tests-build-agent:
runs-on: ubuntu-latest
needs: needs-run
steps:

- name: Checkout system tests
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'

- name: Build agent
id: build
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
run: ./build.sh -i agent

- name: Save
id: save
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
run: |
docker image save system_tests/agent:latest | gzip > agent_${{ github.sha }}.tar.gz
- uses: actions/upload-artifact@v4
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
with:
name: agent_${{ github.sha }}
path: |
Expand All @@ -56,7 +36,6 @@ jobs:

system-tests-build-weblog:
runs-on: ubuntu-latest
needs: needs-run
strategy:
matrix:
include:
Expand All @@ -78,13 +57,11 @@ jobs:
steps:

- name: Checkout system tests
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'

- name: Checkout dd-trace-py
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
uses: actions/checkout@v4
with:
path: 'binaries/dd-trace-py'
Expand All @@ -94,18 +71,14 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Build
id: build
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
run: ./build.sh -i weblog

- name: Save
id: save
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
run: |
docker image save system_tests/weblog:latest | gzip > ${{ matrix.weblog-variant}}_weblog_${{ github.sha }}.tar.gz
- uses: actions/upload-artifact@v4
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
with:
name: ${{ matrix.weblog-variant }}_${{ github.sha }}
path: |
Expand All @@ -114,7 +87,7 @@ jobs:

system-tests:
runs-on: ubuntu-latest
needs: [needs-run, system-tests-build-agent, system-tests-build-weblog]
needs: [system-tests-build-agent, system-tests-build-weblog]
strategy:
matrix:
weblog-variant: [flask-poc, uwsgi-poc , django-poc, fastapi, python3.12]
Expand All @@ -132,130 +105,126 @@ jobs:
steps:

- name: Checkout system tests
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'

- name: Build runner
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
uses: ./.github/actions/install_runner

- uses: actions/download-artifact@v4
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
with:
name: ${{ matrix.weblog-variant }}_${{ github.sha }}
path: images_artifacts/

- uses: actions/download-artifact@v4
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
with:
name: agent_${{ github.sha }}
path: images_artifacts/

- name: docker load
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
id: docker_load
run: |
docker load < images_artifacts/${{ matrix.weblog-variant}}_weblog_${{ github.sha }}.tar.gz
docker load < images_artifacts/agent_${{ github.sha }}.tar.gz
- name: Run DEFAULT
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'other'
run: ./run.sh DEFAULT

- name: Run SAMPLING
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'other'
run: ./run.sh SAMPLING

- name: Run INTEGRATIONS
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'other'
run: ./run.sh INTEGRATIONS

- name: Run CROSSED_TRACING_LIBRARIES
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'other'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'other'
run: ./run.sh CROSSED_TRACING_LIBRARIES

- name: Run REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'remote-config'
run: ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_ASM_FEATURES

- name: Run REMOTE_CONFIG_MOCKED_BACKEND_LIVE_DEBUGGING
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'remote-config'
run: ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_LIVE_DEBUGGING

- name: Run REMOTE_CONFIG_MOCKED_BACKEND_ASM_DD
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'remote-config'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'remote-config'
run: ./run.sh REMOTE_CONFIG_MOCKED_BACKEND_ASM_DD

- name: Run APPSEC_MISSING_RULES
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_MISSING_RULES

- name: Run APPSEC_CUSTOM_RULES
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_CUSTOM_RULES

- name: Run APPSEC_CORRUPTED_RULES
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_CORRUPTED_RULES

- name: Run APPSEC_RULES_MONITORING_WITH_ERRORS
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_RULES_MONITORING_WITH_ERRORS

- name: Run APPSEC_LOW_WAF_TIMEOUT
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_LOW_WAF_TIMEOUT

- name: Run APPSEC_CUSTOM_OBFUSCATION
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_CUSTOM_OBFUSCATION

- name: Run APPSEC_RATE_LIMITER
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec'
run: ./run.sh APPSEC_RATE_LIMITER

- name: Run APPSEC_STANDALONE
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_STANDALONE

- name: Run APPSEC_RUNTIME_ACTIVATION
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_RUNTIME_ACTIVATION

- name: Run APPSEC_WAF_TELEMETRY
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_WAF_TELEMETRY

- name: Run APPSEC_DISABLED
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_DISABLED

- name: Run APPSEC_BLOCKING
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_BLOCKING

- name: Run APPSEC_BLOCKING_FULL_DENYLIST
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_BLOCKING_FULL_DENYLIST

- name: Run APPSEC_REQUEST_BLOCKING
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_REQUEST_BLOCKING

- name: Run APPSEC_RASP
if: (needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule') && matrix.scenario == 'appsec-1'
if: always() && steps.docker_load.outcome == 'success' && matrix.scenario == 'appsec-1'
run: ./run.sh APPSEC_RASP

# The compress step speed up a lot the upload artifact process
- name: Compress artifact
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
if: always() && steps.docker_load.outcome == 'success'
id: compress-artifact
run: tar -czvf artifact.tar.gz $(ls | grep logs)

- name: Upload artifact
uses: actions/upload-artifact@v4
if: steps.compress-artifact.outcome == 'success' || github.event_name == 'schedule'
if: always() && steps.docker_load.outcome == 'success'
with:
name: logs_${{ matrix.weblog-variant }}_${{ matrix.scenario }}
path: artifact.tar.gz
Expand All @@ -264,38 +233,35 @@ jobs:
parametric:
runs-on:
group: "APM Larger Runners"
needs: needs-run
env:
TEST_LIBRARY: python
steps:
- name: Checkout system tests
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
uses: actions/checkout@v4
with:
repository: 'DataDog/system-tests'
- name: Checkout dd-trace-py
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
uses: actions/checkout@v4
with:
path: 'binaries/dd-trace-py'
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Build runner
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
id: build_runner
uses: ./.github/actions/install_runner

- name: Run
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
if: always() && steps.build_runner.outcome == 'success'
run: ./run.sh PARAMETRIC

- name: Compress artifact
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
if: always() && steps.build_runner.outcome == 'success'
run: tar -czvf artifact.tar.gz $(ls | grep logs)

- name: Upload artifact
uses: actions/upload-artifact@v4
if: needs.needs-run.outputs.outcome == 'success' || github.event_name == 'schedule'
if: always() && steps.build_runner.outcome == 'success'
with:
name: logs_parametric
path: artifact.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build_base_venvs:
CMAKE_BUILD_PARALLEL_LEVEL: 24
PIP_VERBOSE: 1
script:
- pip install riot~=0.19.1
- pip install riot==0.20.0
- riot -P -v generate --python=$PYTHON_VERSION
artifacts:
name: venv_$PYTHON_VERSION
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ variables:
services:
- !reference [.services, ddagent]
script:
- pip install riot~=0.19.1
- pip install riot==0.20.0
- unset DD_SERVICE
- unset DD_ENV
- unset DD_TAGS
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/bm/iast_fixtures/str_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,10 @@ def do_join_generator(mystring: str) -> Text:
return "".join(gen)


def do_join_generator_as_argument(mystring: str, gen: Generator[str, None, None]) -> Text:
return mystring.join(gen)


def do_join_generator_2(mystring: str) -> Text:
def parts() -> Generator:
for i in ["x", "y", "z"]:
Expand Down
2 changes: 1 addition & 1 deletion ddtrace/appsec/_iast/_ast/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def _should_replace_with_taint_sink(self, call_node: ast.Call, is_function: bool
if function_name in self._taint_sink_replace_disabled:
return False

return any(allowed in function_name for allowed in self._taint_sink_replace_any)
return function_name in self._taint_sink_replace_any

def _add_original_function_as_arg(self, call_node: ast.Call, is_function: bool) -> Any:
"""
Expand Down
Loading

0 comments on commit 7ef54e3

Please sign in to comment.