Skip to content

Commit

Permalink
Merge branch 'master' into di-demo
Browse files Browse the repository at this point in the history
* master:
  Move marking of remote config content as applied to the end
  Switch system tests to a temp branch
  Fix remote config handling for AppSec
  • Loading branch information
p committed Feb 5, 2025
2 parents 4096cbb + 0932e4a commit be68d37
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ on:
env:
REGISTRY: ghcr.io
REPO: ghcr.io/datadog/dd-trace-rb
# Broken system-test: https://github.com/DataDog/system-tests/pull/3904
SYSTEM_TESTS_REF: 239c3eba6de0473817d3d88ebbc025c9d0c9574b
# SYSTEM_TESTS_REF: main # This must always be set to `main` on dd-trace-rb's master branch
# TODO: remove this change before merging to master
SYSTEM_TESTS_REF: enable-ip-blocking-for-ruby

jobs:
build-harness:
Expand Down
4 changes: 4 additions & 0 deletions lib/datadog/appsec/remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ def receivers(telemetry)
)

Datadog::AppSec.reconfigure(ruleset: ruleset, telemetry: telemetry)

repository.contents.each do |content|
content.applied if ASM_PRODUCTS.include?(content.path.product)
end
end

[receiver]
Expand Down
20 changes: 20 additions & 0 deletions spec/datadog/appsec/remote_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@
receiver.call(repository, changes)
end

it 'sets apply_state to ACKNOWLEDGED on content' do
receiver.call(repository, transaction)

expect(content.apply_state).to eq(Datadog::Core::Remote::Configuration::Content::ApplyState::ACKNOWLEDGED)
end

context 'content product' do
before do
# Stub the reconfigure method, so we do not trigger background reconfiguration
Expand Down Expand Up @@ -290,6 +296,13 @@

context 'ASM' do
let(:path) { 'datadog/603646/ASM/whatevername/config' }
let(:data) { {} }

it 'sets apply_state to ACKNOWLEDGED on content' do
receiver.call(repository, transaction)

expect(content.apply_state).to eq(Datadog::Core::Remote::Configuration::Content::ApplyState::ACKNOWLEDGED)
end

context 'overrides' do
let(:data) do
Expand Down Expand Up @@ -405,6 +418,13 @@

context 'ASM_DATA' do
let(:path) { 'datadog/603646/ASM_DATA/whatevername/config' }
let(:data) { {} }

it 'sets apply_state to ACKNOWLEDGED on content' do
receiver.call(repository, transaction)

expect(content.apply_state).to eq(Datadog::Core::Remote::Configuration::Content::ApplyState::ACKNOWLEDGED)
end

context 'with rules_data information' do
let(:data) do
Expand Down

0 comments on commit be68d37

Please sign in to comment.