-
Notifications
You must be signed in to change notification settings - Fork 309
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
Activate AVM OSS via environment variable #4119
Conversation
Overall package sizeSelf size: 6.45 MB Dependency sizes
🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4119 +/- ##
===========================================
+ Coverage 83.11% 95.76% +12.65%
===========================================
Files 244 97 -147
Lines 10255 3259 -6996
Branches 33 33
===========================================
- Hits 8523 3121 -5402
+ Misses 1732 138 -1594 ☔ View full report in Codecov by Sentry. |
BenchmarksBenchmark execution time: 2024-05-03 07:59:56 Comparing candidate commit 6ec04c5 in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 260 metrics, 5 unstable metrics. scenario:plugin-graphql-with-depth-on-max-18
|
886c9ba
to
9fa7c3f
Compare
3fcb83c
to
18f0c63
Compare
de68728
to
64b35df
Compare
@@ -544,6 +546,8 @@ class Config { | |||
this._setValue(env, 'appsec.rateLimit', maybeInt(DD_APPSEC_TRACE_RATE_LIMIT)) | |||
this._setString(env, 'appsec.rules', DD_APPSEC_RULES) | |||
this._setValue(env, 'appsec.wafTimeout', maybeInt(DD_APPSEC_WAF_TIMEOUT)) | |||
// DD_APPSEC_SCA_ENABLED is never used locally, but only sent to the backend | |||
this._setBoolean(env, 'appsec.sca.enabled', DD_APPSEC_SCA_ENABLED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we avoid the 384 line _setValue
and the changes on telemetry/index.js
if we check the env value and only set it if not undefined
?
Or can there be no env config property without its correspondent default value?
this._setBoolean(env, 'appsec.sca.enabled', DD_APPSEC_SCA_ENABLED) | |
if (DD_APPSEC_SCA_ENABLED) { | |
this._setBoolean(env, 'appsec.sca.enabled', DD_APPSEC_SCA_ENABLED) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ummm there is a comment in config.js
// for _merge to work, every config value must have a default value
so I guess that answers my questions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. The _merge
function goes through all the defaults to extract changes, so every configuration must have a default.
Can we include the system test enablement PR link in the description ? |
@CarlesDD sorry for the system-tests PR i meant the PR where we enable the test 👍 |
1d35c6f
to
e7e3042
Compare
@@ -284,6 +285,7 @@ describe('Config', () => { | |||
{ name: 'appsec.blockedTemplateJson', value: undefined, origin: 'default' }, | |||
{ name: 'appsec.eventTracking.enabled', value: true, origin: 'default' }, | |||
{ name: 'appsec.eventTracking.mode', value: 'safe', origin: 'default' }, | |||
{ name: 'appsec.sca.enabled', value: undefined, origin: 'default' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this supposed to be value: null then ? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and if i'm right, why is it not failing in the CI ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
You are right Simon. The expected value is null.
The CI is not failing because this assertion was not correctly implemented.
expect(updateConfig.getCall(0).args[0]).to.deep.include(
{ name: 'service', value: 'node', origin: 'default' },
{ name: 'logInjection', value: false, origin: 'default' },
{ name: 'headerTags', value: [], origin: 'default' },
...
It checks that first argument of the first call to updateConfig
includes { name: 'service', value: 'node', origin: 'default' }
(the first argument for deep.include
call), ignoring the rest. 😕
This test, and others in this file must be revisited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this regex (?<!assert)\.include\(($|.+,)
I found 3 similar cases in the whole repo, all in this file, line 235, 503, 761.
We need to fix this before merging the current PR. Would you agree with that but in a different PR ? 😆
I think we can fix it by just adding an array around the objects, and changing to deep equal ? like done so in line 1401:
expect(updateConfig.getCall(1).args[0]).to.deep.equal([
{ name: 'sampleRate', value: 0, origin: 'remote_config' }
])
e7e3042
to
6034f1b
Compare
* Add SCA enabled to configuration * Add comment to new config * Fix test for telemtry after app-extended-heartbeat behaviour change * Do not send sca enabled in telemetry messages when not informed * Fix lint * Rename sca.enabled to appsec.sca.enabled * Prevent sending some configuration in telemetry message when it has not been set * Improve loggers naming * Appsec SCA default to null. Avoid stripping config entry off when no set. * Fix sca default value assertion * Fix config sorting
* Add SCA enabled to configuration * Add comment to new config * Fix test for telemtry after app-extended-heartbeat behaviour change * Do not send sca enabled in telemetry messages when not informed * Fix lint * Rename sca.enabled to appsec.sca.enabled * Prevent sending some configuration in telemetry message when it has not been set * Improve loggers naming * Appsec SCA default to null. Avoid stripping config entry off when no set. * Fix sca default value assertion * Fix config sorting
* Add SCA enabled to configuration * Add comment to new config * Fix test for telemtry after app-extended-heartbeat behaviour change * Do not send sca enabled in telemetry messages when not informed * Fix lint * Rename sca.enabled to appsec.sca.enabled * Prevent sending some configuration in telemetry message when it has not been set * Improve loggers naming * Appsec SCA default to null. Avoid stripping config entry off when no set. * Fix sca default value assertion * Fix config sorting
* Add SCA enabled to configuration * Add comment to new config * Fix test for telemtry after app-extended-heartbeat behaviour change * Do not send sca enabled in telemetry messages when not informed * Fix lint * Rename sca.enabled to appsec.sca.enabled * Prevent sending some configuration in telemetry message when it has not been set * Improve loggers naming * Appsec SCA default to null. Avoid stripping config entry off when no set. * Fix sca default value assertion * Fix config sorting
* Add SCA enabled to configuration * Add comment to new config * Fix test for telemtry after app-extended-heartbeat behaviour change * Do not send sca enabled in telemetry messages when not informed * Fix lint * Rename sca.enabled to appsec.sca.enabled * Prevent sending some configuration in telemetry message when it has not been set * Improve loggers naming * Appsec SCA default to null. Avoid stripping config entry off when no set. * Fix sca default value assertion * Fix config sorting
* Add SCA enabled to configuration * Add comment to new config * Fix test for telemtry after app-extended-heartbeat behaviour change * Do not send sca enabled in telemetry messages when not informed * Fix lint * Rename sca.enabled to appsec.sca.enabled * Prevent sending some configuration in telemetry message when it has not been set * Improve loggers naming * Appsec SCA default to null. Avoid stripping config entry off when no set. * Fix sca default value assertion * Fix config sorting
What does this PR do?
Adds a new configuration
DD_APPSEC_SCA_ENABLED
, used to enable AVM OSS.The value of this new configuration is sent via telemetry to the backend in the
configuration
payload for the following telemetry messages:app-started
,app-extended-heartbeat
andapp-client-configuration-change
.If
DD_APPSEC_SCA_ENABLED
is not set explicitly, then the value is not sent in telemetry messages.Motivation
Customers need a way to enable AVM OSS via an environment variable, just as they enable APM or other products or features, instead of having to do it exclusively through the UI.
Plugin Checklist
Additional Notes
System Test PR
Security
Datadog employees:
@DataDog/security-design-and-guidance
.Unsure? Have a question? Request a review!
APPSEC-17141