Skip to content

chore(asm): update security rules #12975

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

Merged
merged 8 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
340 changes: 256 additions & 84 deletions ddtrace/appsec/rules.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/appsec/contrib_appsec/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1604,13 +1604,13 @@ def test_auto_user_events(
assert not any(tag.startswith("appsec.events.users.login") for tag in root_span()._meta)
assert not any(tag.startswith("_dd_appsec.events.users.login") for tag in root_span()._meta)
# check for fingerprints when user events
if asm_enabled and auto_events_enabled and mode != "disabled":
if asm_enabled:
assert get_tag(asm_constants.FINGERPRINTING.HEADER)
assert get_tag(asm_constants.FINGERPRINTING.NETWORK)
assert get_tag(asm_constants.FINGERPRINTING.ENDPOINT)
assert get_tag(asm_constants.FINGERPRINTING.SESSION)
else:
assert get_tag(asm_constants.FINGERPRINTING.HEADER) is None
# assert get_tag(asm_constants.FINGERPRINTING.HEADER) is None
assert get_tag(asm_constants.FINGERPRINTING.NETWORK) is None
assert get_tag(asm_constants.FINGERPRINTING.ENDPOINT) is None
assert get_tag(asm_constants.FINGERPRINTING.SESSION) is None
Expand All @@ -1627,7 +1627,7 @@ def test_fingerprinting(self, interface, root_span, get_tag, asm_enabled, user_a
assert self.status(response) == code
assert get_tag("http.status_code") == str(code)
# check for fingerprints when security events
if asm_enabled and user_agent == "dd-test-scanner-log-block":
if asm_enabled:
assert get_tag(asm_constants.FINGERPRINTING.HEADER)
assert get_tag(asm_constants.FINGERPRINTING.NETWORK)
assert get_tag(asm_constants.FINGERPRINTING.ENDPOINT)
Expand Down
4 changes: 4 additions & 0 deletions tests/contrib/django/test_django_appsec_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ def daphne_client(django_asgi, additional_env=None):
"metrics._dd.appsec.rasp.duration_ext",
"metrics._dd.appsec.rasp.rule.eval",
APPSEC_JSON_TAG,
"meta." + FINGERPRINTING.NETWORK,
"meta." + FINGERPRINTING.HEADER,
"meta." + FINGERPRINTING.ENDPOINT,
"meta." + FINGERPRINTING.SESSION,
]
)
def test_appsec_enabled():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"parent_id": 0,
"type": "web",
"meta": {
"_dd.appsec.event_rules.version": "1.13.3",
"_dd.appsec.event_rules.version": "1.14.2",
"_dd.appsec.json": "{\"triggers\":[\n {\n \"rule\": {\n \"id\": \"nfd-000-006\",\n \"name\": \"Detect failed attempt to fetch sensitive files\",\n \"tags\": {\n \"capec\": \"1000/118/169\",\n \"category\": \"attack_attempt\",\n \"confidence\": \"1\",\n \"cwe\": \"200\",\n \"type\": \"security_scanner\"\n }\n },\n \"rule_matches\": [\n {\n \"operator\": \"match_regex\",\n \"operator_value\": \"^404$\",\n \"parameters\": [\n {\n \"address\": \"server.response.status\",\n \"highlight\": [\n \"404\"\n ],\n \"key_path\": [],\n \"value\": \"404\"\n }\n ]\n },\n {\n \"operator\": \"match_regex\",\n \"operator_value\": \"\\\\.(cgi|bat|dll|exe|key|cert|crt|pem|der|pkcs|pkcs|pkcs[0-9]*|nsf|jsa|war|java|class|vb|vba|so|git|svn|hg|cvs)([^a-zA-Z0-9_]|$)\",\n \"parameters\": [\n {\n \"address\": \"server.request.uri.raw\",\n \"highlight\": [\n \".git\"\n ],\n \"key_path\": [],\n \"value\": \"/.git\"\n }\n ]\n }\n ]\n }\n]}",
"_dd.appsec.waf.version": "1.24.0",
"_dd.origin": "appsec",
Expand All @@ -23,7 +23,7 @@
"metrics": {
"_dd.appsec.enabled": 1.0,
"_dd.appsec.event_rules.error_count": 0,
"_dd.appsec.event_rules.loaded": 159,
"_dd.appsec.event_rules.loaded": 166,
"_dd.appsec.waf.duration": 204.672,
"_dd.appsec.waf.duration_ext": 280.3802490234375,
"_dd.top_level": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"parent_id": 0,
"type": "web",
"meta": {
"_dd.appsec.event_rules.version": "1.13.3",
"_dd.appsec.event_rules.version": "1.14.2",
"_dd.appsec.json": "{\"triggers\":[\n {\n \"rule\": {\n \"id\": \"nfd-000-006\",\n \"name\": \"Detect failed attempt to fetch sensitive files\",\n \"tags\": {\n \"capec\": \"1000/118/169\",\n \"category\": \"attack_attempt\",\n \"confidence\": \"1\",\n \"cwe\": \"200\",\n \"type\": \"security_scanner\"\n }\n },\n \"rule_matches\": [\n {\n \"operator\": \"match_regex\",\n \"operator_value\": \"^404$\",\n \"parameters\": [\n {\n \"address\": \"server.response.status\",\n \"highlight\": [\n \"404\"\n ],\n \"key_path\": [],\n \"value\": \"404\"\n }\n ]\n },\n {\n \"operator\": \"match_regex\",\n \"operator_value\": \"\\\\.(cgi|bat|dll|exe|key|cert|crt|pem|der|pkcs|pkcs|pkcs[0-9]*|nsf|jsa|war|java|class|vb|vba|so|git|svn|hg|cvs)([^a-zA-Z0-9_]|$)\",\n \"parameters\": [\n {\n \"address\": \"server.request.uri.raw\",\n \"highlight\": [\n \".git\"\n ],\n \"key_path\": [],\n \"value\": \"/.git\"\n }\n ]\n }\n ]\n }\n]}",
"_dd.appsec.waf.version": "1.24.0",
"_dd.origin": "appsec",
Expand All @@ -23,7 +23,7 @@
"metrics": {
"_dd.appsec.enabled": 1.0,
"_dd.appsec.event_rules.error_count": 0,
"_dd.appsec.event_rules.loaded": 159,
"_dd.appsec.event_rules.loaded": 166,
"_dd.appsec.waf.duration": 103.238,
"_dd.appsec.waf.duration_ext": 174.04556274414062,
"_dd.top_level": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"parent_id": 0,
"type": "web",
"meta": {
"_dd.appsec.event_rules.version": "1.13.3",
"_dd.appsec.event_rules.version": "1.14.2",
"_dd.appsec.json": "{\"triggers\":[\n {\n \"rule\": {\n \"id\": \"nfd-000-006\",\n \"name\": \"Detect failed attempt to fetch sensitive files\",\n \"tags\": {\n \"capec\": \"1000/118/169\",\n \"category\": \"attack_attempt\",\n \"confidence\": \"1\",\n \"cwe\": \"200\",\n \"type\": \"security_scanner\"\n }\n },\n \"rule_matches\": [\n {\n \"operator\": \"match_regex\",\n \"operator_value\": \"^404$\",\n \"parameters\": [\n {\n \"address\": \"server.response.status\",\n \"highlight\": [\n \"404\"\n ],\n \"key_path\": [],\n \"value\": \"404\"\n }\n ]\n },\n {\n \"operator\": \"match_regex\",\n \"operator_value\": \"\\\\.(cgi|bat|dll|exe|key|cert|crt|pem|der|pkcs|pkcs|pkcs[0-9]*|nsf|jsa|war|java|class|vb|vba|so|git|svn|hg|cvs)([^a-zA-Z0-9_]|$)\",\n \"parameters\": [\n {\n \"address\": \"server.request.uri.raw\",\n \"highlight\": [\n \".git\"\n ],\n \"key_path\": [],\n \"value\": \"/.git\"\n }\n ]\n }\n ]\n }\n]}",
"_dd.appsec.waf.version": "1.24.0",
"_dd.base_service": "tests.appsec.appsec",
Expand All @@ -25,7 +25,7 @@
"metrics": {
"_dd.appsec.enabled": 1.0,
"_dd.appsec.event_rules.error_count": 0,
"_dd.appsec.event_rules.loaded": 159,
"_dd.appsec.event_rules.loaded": 166,
"_dd.appsec.waf.duration": 126.022,
"_dd.appsec.waf.duration_ext": 203.3710479736328,
"_dd.top_level": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "web",
"error": 0,
"meta": {
"_dd.appsec.event_rules.version": "1.13.3",
"_dd.appsec.event_rules.version": "1.14.2",
"_dd.appsec.waf.version": "1.24.0",
"_dd.base_service": "",
"_dd.p.dm": "-0",
Expand Down Expand Up @@ -42,7 +42,7 @@
"metrics": {
"_dd.appsec.enabled": 1.0,
"_dd.appsec.event_rules.error_count": 0,
"_dd.appsec.event_rules.loaded": 159,
"_dd.appsec.event_rules.loaded": 166,
"_dd.appsec.waf.duration": 96.626,
"_dd.appsec.waf.duration_ext": 147.81951904296875,
"_dd.measured": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "web",
"error": 0,
"meta": {
"_dd.appsec.event_rules.version": "1.13.3",
"_dd.appsec.event_rules.version": "1.14.2",
"_dd.appsec.json": "{\"triggers\":[\n {\n \"rule\": {\n \"id\": \"nfd-000-006\",\n \"name\": \"Detect failed attempt to fetch sensitive files\",\n \"tags\": {\n \"capec\": \"1000/118/169\",\n \"category\": \"attack_attempt\",\n \"confidence\": \"1\",\n \"cwe\": \"200\",\n \"type\": \"security_scanner\"\n }\n },\n \"rule_matches\": [\n {\n \"operator\": \"match_regex\",\n \"operator_value\": \"^404$\",\n \"parameters\": [\n {\n \"address\": \"server.response.status\",\n \"highlight\": [\n \"404\"\n ],\n \"key_path\": [],\n \"value\": \"404\"\n }\n ]\n },\n {\n \"operator\": \"match_regex\",\n \"operator_value\": \"\\\\.(cgi|bat|dll|exe|key|cert|crt|pem|der|pkcs|pkcs|pkcs[0-9]*|nsf|jsa|war|java|class|vb|vba|so|git|svn|hg|cvs)([^a-zA-Z0-9_]|$)\",\n \"parameters\": [\n {\n \"address\": \"server.request.uri.raw\",\n \"highlight\": [\n \".git\"\n ],\n \"key_path\": [],\n \"value\": \"/.git\"\n }\n ]\n }\n ]\n }\n]}",
"_dd.appsec.waf.version": "1.24.0",
"_dd.base_service": "",
Expand Down Expand Up @@ -45,7 +45,7 @@
"metrics": {
"_dd.appsec.enabled": 1.0,
"_dd.appsec.event_rules.error_count": 0,
"_dd.appsec.event_rules.loaded": 159,
"_dd.appsec.event_rules.loaded": 166,
"_dd.appsec.waf.duration": 236.874,
"_dd.appsec.waf.duration_ext": 339.26963806152344,
"_dd.measured": 1,
Expand Down
Loading