-
Notifications
You must be signed in to change notification settings - Fork 10
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
APPSEC-55830 - SCA + Appsec Standalone #3436
Conversation
@cbeauchesne any clues as to why these
|
Becasue you imported some test classes : https://github.com/DataDog/system-tests/pull/3436/files#diff-b85606db77dfc3d56861c57eea9ce4af4d9e93bd4b21df3367f2ed8ef8fdd214R5 Test classes must not be imported from one folder to another. If some of them shares methods, the common bit must be placed in a utils.py file. |
what about now? |
Good, (failures are not related see #3498) |
Is there a way to ensure that |
You mean, checking the env var value inside the weblog container ? |
More like checking that the env var actually activates standalone appsec. The env var can still be in the container even when standalone appsec is not implemented (as this is just an env var after all). I know this is the whole point of the APPSEC_STANDALONE scenario, but here, changing the value of My question was, if the behaviour we want is really to pass these tests ONLY if Standalone Appsec is activated, is there anyway to know if it active, through telemetry for example ? If so, we should add a check for that in these tests. |
That's one aspect we want to test, that SCA behaviour is not affected by standalone But for what you say, we could check if traces contain |
I understand better now, thanks ! The problem is that, for versions of libraries that have not implemented Standalone Appsec yet (like dd-trace-rb v2.4.0 and lower) these tests will pass but not for the correct reason. It will not test that Standalone ASM does not affects SCA, as there is no Standalone Appsec implementation, so we are sure that it will not impact it. So these tests will be equivalent to Test_TelemetrySCAEnvVar::test_telemetry_sca_enabled_propagated and Test_Telemetry::test_app_dependencies_loaded. The fact that these tests ensures that Standalone ASM does not affects SCA behaviour reinforce my belief that they should not pass on versions/libraries where Standalone ASM is not implemented, thus we should check that they correctly implemented it (using _dd.p.appsec for example, or maybe adding a field in "app-started" telemetry event ? (But that would require to change the RFC and update current implementations of Standalone ASM)) |
Another example is the go tracer. I believe that they implemented SCA but not Standalone ASM yet. And yet the |
tests/appsec/test_asm_standalone.py
Outdated
for data, _trace, span in interfaces.library.get_spans(request=self.r): | ||
assert span["metrics"]["_sampling_priority_v1"] == 0 | ||
assert span["metrics"]["_dd.apm.enabled"] == 0 |
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.
what do you think @vpellan?
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.
I have included the check in both tests
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.
In Ruby, when the sampler decides to not sample a trace, it sets it to MANUAL_REJECT. So span["metrics"]["_sampling_priority_v1"]
will be equal to -1 (MANUAL_REJECT) instead of 0 (AUTO_REJECT). Maybe it is an error from our side (we still pass all the standalone ASM threats system-tests though) but if not, we should replace this line with:
assert span["metrics"]["_sampling_priority_v1"] <= 0
. Otherwise I think it's good !
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.
In node 0 is used for automatic resolutions (the agent decides it) and -1 when manual.drop
has been found or a rule has dropped the trace. But is OK for me to change the assert!
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.
LGTM!
Motivation
Check that SCA is still working when STANDALONE mode is on.
Changes
SCA_STANDALONE
scenario: SCA on, STANDALONE on, APPSEC off, IAST offTest_SCAStandalone_Telemetry
class with two new tests:test_telemetry_sca_enabled_propagated
: testing thatDD_APPSEC_SCA_ENABLED
config property is sent when STANDALONE mode is on. It is 'inspired' by Test_TelemetrySCAEnvVar::test_telemetry_sca_enabled_propagated parametric test.It gets the configuration from telemetry data and looks for the proper
DD_APPSEC_SCA_ENABLED
property taking into account the different languages.test_app_dependencies_loaded
: testing that dependencies are still sent via theapp-dependencies-loaded
telemetry request. It uses the same logic and endpoint than Test_Telemetry::test_app_dependencies_loaded.It makes a weblog request to
/load_dependency
endpoint which loads a dependency and gets theapp-dependencies-loaded
payload from telemetry trying to find the corresponding entry for the previously loaded dependencyWorkflow
codeowners
file quickly.🚀 Once your PR is reviewed, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist
[<language>]
, double-check that only<language>
is impacted by the changebuild-XXX-image
label is present