Skip to content

Commit ad4d2ea

Browse files
committed
Fix remote config handling for AppSec
Before we were not setting `apply_state` to ACKNOWLEDGED on remote config content.
1 parent d0322ed commit ad4d2ea

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

lib/datadog/appsec/remote.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,15 @@ def receivers(telemetry)
7474
case content.path.product
7575
when 'ASM_DD'
7676
rules << parsed_content
77+
content.applied
7778
when 'ASM_DATA'
7879
data << parsed_content['rules_data'] if parsed_content['rules_data']
80+
content.applied
7981
when 'ASM'
8082
overrides << parsed_content['rules_override'] if parsed_content['rules_override']
8183
exclusions << parsed_content['exclusions'] if parsed_content['exclusions']
8284
custom_rules << parsed_content['custom_rules'] if parsed_content['custom_rules']
85+
content.applied
8386
end
8487
end
8588

spec/datadog/appsec/remote_spec.rb

Lines changed: 20 additions & 0 deletions
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)