Skip to content

Commit 0932e4a

Browse files
authored
Merge pull request #4345 from DataDog/appsec-fix-rc-apply-state
Fix remote config handling for AppSec
2 parents d0322ed + d9bcea9 commit 0932e4a

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

Diff for: .github/workflows/system-tests.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ on:
2424
env:
2525
REGISTRY: ghcr.io
2626
REPO: ghcr.io/datadog/dd-trace-rb
27-
# Broken system-test: https://github.com/DataDog/system-tests/pull/3904
28-
SYSTEM_TESTS_REF: 239c3eba6de0473817d3d88ebbc025c9d0c9574b
29-
# SYSTEM_TESTS_REF: main # This must always be set to `main` on dd-trace-rb's master branch
27+
# TODO: remove this change before merging to master
28+
SYSTEM_TESTS_REF: enable-ip-blocking-for-ruby
3029

3130
jobs:
3231
build-harness:

Diff for: lib/datadog/appsec/remote.rb

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ def receivers(telemetry)
104104
)
105105

106106
Datadog::AppSec.reconfigure(ruleset: ruleset, telemetry: telemetry)
107+
108+
repository.contents.each do |content|
109+
content.applied if ASM_PRODUCTS.include?(content.path.product)
110+
end
107111
end
108112

109113
[receiver]

Diff for: spec/datadog/appsec/remote_spec.rb

+20
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@
173173
receiver.call(repository, changes)
174174
end
175175

176+
it 'sets apply_state to ACKNOWLEDGED on content' do
177+
receiver.call(repository, transaction)
178+
179+
expect(content.apply_state).to eq(Datadog::Core::Remote::Configuration::Content::ApplyState::ACKNOWLEDGED)
180+
end
181+
176182
context 'content product' do
177183
before do
178184
# Stub the reconfigure method, so we do not trigger background reconfiguration
@@ -290,6 +296,13 @@
290296

291297
context 'ASM' do
292298
let(:path) { 'datadog/603646/ASM/whatevername/config' }
299+
let(:data) { {} }
300+
301+
it 'sets apply_state to ACKNOWLEDGED on content' do
302+
receiver.call(repository, transaction)
303+
304+
expect(content.apply_state).to eq(Datadog::Core::Remote::Configuration::Content::ApplyState::ACKNOWLEDGED)
305+
end
293306

294307
context 'overrides' do
295308
let(:data) do
@@ -405,6 +418,13 @@
405418

406419
context 'ASM_DATA' do
407420
let(:path) { 'datadog/603646/ASM_DATA/whatevername/config' }
421+
let(:data) { {} }
422+
423+
it 'sets apply_state to ACKNOWLEDGED on content' do
424+
receiver.call(repository, transaction)
425+
426+
expect(content.apply_state).to eq(Datadog::Core::Remote::Configuration::Content::ApplyState::ACKNOWLEDGED)
427+
end
408428

409429
context 'with rules_data information' do
410430
let(:data) do

0 commit comments

Comments
 (0)