Skip to content

Commit abaa1f5

Browse files
authored
fix(detectors): Filter auto.db.otel. origin for sql injection detector (#97800)
1 parent d66b116 commit abaa1f5

18 files changed

+185
-45
lines changed

fixtures/events/performance_problems/sql-injection/sql-injection-event-body.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@
141141
"trace_id": "375a86eca09a4a4e91903838dd771f50",
142142
"status": "ok",
143143
"description": "SELECT * FROM users WHERE username = 'hello'",
144-
"origin": "auto.db.otel.mysql2",
145144
"sentry_tags": {
146145
"description": "SELECT * FROM users WHERE username = %s"
147146
},
@@ -154,8 +153,7 @@
154153
"net.peer.name": "localhost",
155154
"net.peer.port": 3306,
156155
"otel.kind": "CLIENT",
157-
"sentry.op": "db",
158-
"sentry.origin": "auto.db.otel.mysql2"
156+
"sentry.op": "db"
159157
},
160158
"hash": "45330ba0cafa5997"
161159
}

fixtures/events/performance_problems/sql-injection/sql-injection-event-gorm.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@
144144
"trace_id": "375a86eca09a4a4e91903838dd771f50",
145145
"status": "ok",
146146
"description": "SELECT * FROM \"user\" WHERE username = 'bob' AND \"user\".\"deleted_at\" IS NULL ORDER BY \"user\".\"id\" LIMIT 1",
147-
"origin": "auto.db.otel.mysql2",
148147
"sentry_tags": {
149148
"description": "SELECT * FROM \"user\" WHERE username = 'bob' AND \"user\".\"deleted_at\" IS NULL ORDER BY \"user\".\"id\" LIMIT 1"
150149
},
@@ -157,8 +156,7 @@
157156
"net.peer.name": "localhost",
158157
"net.peer.port": 3306,
159158
"otel.kind": "CLIENT",
160-
"sentry.op": "db",
161-
"sentry.origin": "auto.db.otel.mysql2"
159+
"sentry.op": "db"
162160
},
163161
"hash": "45330ba0cafa5997"
164162
}

fixtures/events/performance_problems/sql-injection/sql-injection-event-invalid-package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@
147147
"trace_id": "375a86eca09a4a4e91903838dd771f50",
148148
"status": "ok",
149149
"description": "SELECT * FROM users WHERE username = 'hello' ORDER BY username ASC",
150-
"origin": "auto.db.otel.mysql2",
151150
"data": {
152151
"db.system": "mysql",
153152
"db.connection_string": "jdbc:mysql://localhost:3306/injection_test",
@@ -157,8 +156,7 @@
157156
"net.peer.name": "localhost",
158157
"net.peer.port": 3306,
159158
"otel.kind": "CLIENT",
160-
"sentry.op": "db",
161-
"sentry.origin": "auto.db.otel.mysql2"
159+
"sentry.op": "db"
162160
},
163161
"hash": "45330ba0cafa5997"
164162
}

fixtures/events/performance_problems/sql-injection/sql-injection-event-nestjs-mikroorm.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"trace_id": "375a86eca09a4a4e91903838dd771f50",
3737
"status": "ok",
3838
"description": "SELECT * FROM \"user\" WHERE username = 'bob' AND \"user\".\"deleted_at\" IS NULL ORDER BY \"user\".\"id\" LIMIT 1",
39-
"origin": "auto.db.otel.mysql2",
4039
"sentry_tags": {
4140
"description": "SELECT * FROM \"user\" WHERE username = 'bob' AND \"user\".\"deleted_at\" IS NULL ORDER BY \"user\".\"id\" LIMIT 1"
4241
},
@@ -49,8 +48,7 @@
4948
"net.peer.name": "localhost",
5049
"net.peer.port": 3306,
5150
"otel.kind": "CLIENT",
52-
"sentry.op": "db",
53-
"sentry.origin": "auto.db.otel.mysql2"
51+
"sentry.op": "db"
5452
},
5553
"hash": "45330ba0cafa5997"
5654
}

fixtures/events/performance_problems/sql-injection/sql-injection-event-nestjs-typeorm.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"trace_id": "375a86eca09a4a4e91903838dd771f50",
3737
"status": "ok",
3838
"description": "SELECT * FROM \"user\" WHERE username = 'bob' AND \"user\".\"deleted_at\" IS NULL ORDER BY \"user\".\"id\" LIMIT 1",
39-
"origin": "auto.db.otel.mysql2",
4039
"sentry_tags": {
4140
"description": "SELECT * FROM \"user\" WHERE username = 'bob' AND \"user\".\"deleted_at\" IS NULL ORDER BY \"user\".\"id\" LIMIT 1"
4241
},
@@ -49,8 +48,7 @@
4948
"net.peer.name": "localhost",
5049
"net.peer.port": 3306,
5150
"otel.kind": "CLIENT",
52-
"sentry.op": "db",
53-
"sentry.origin": "auto.db.otel.mysql2"
51+
"sentry.op": "db"
5452
},
5553
"hash": "45330ba0cafa5997"
5654
}

fixtures/events/performance_problems/sql-injection/sql-injection-event-non-vulnerable.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@
139139
"trace_id": "375a86eca09a4a4e91903838dd771f50",
140140
"status": "ok",
141141
"description": "SELECT * FROM users WHERE username = ?",
142-
"origin": "auto.db.otel.mysql2",
143142
"data": {
144143
"db.system": "mysql",
145144
"db.connection_string": "jdbc:mysql://localhost:3306/injection_test",
@@ -149,8 +148,7 @@
149148
"net.peer.name": "localhost",
150149
"net.peer.port": 3306,
151150
"otel.kind": "CLIENT",
152-
"sentry.op": "db",
153-
"sentry.origin": "auto.db.otel.mysql2"
151+
"sentry.op": "db"
154152
},
155153
"hash": "45330ba0cafa5997"
156154
}
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
{
2+
"event_id": "5d6401994d7949d2ac3474f472564370",
3+
"platform": "node",
4+
"message": "",
5+
"datetime": "2025-05-12T22:42:38.642986+00:00",
6+
"breakdowns": {
7+
"span_ops": {
8+
"ops.db": {
9+
"value": 65.715075,
10+
"unit": "millisecond"
11+
},
12+
"total.time": {
13+
"value": 67.105293,
14+
"unit": "millisecond"
15+
}
16+
}
17+
},
18+
"request": {
19+
"url": "http://localhost:3001/vulnerable-login",
20+
"method": "POST",
21+
"data": {
22+
"username": "hello"
23+
}
24+
},
25+
"spans": [
26+
{
27+
"timestamp": 1747089758.567536,
28+
"start_timestamp": 1747089758.567,
29+
"exclusive_time": 0.536203,
30+
"op": "middleware.express",
31+
"span_id": "4a06692f4abc8dbe",
32+
"parent_span_id": "91fa92ff0205967d",
33+
"trace_id": "375a86eca09a4a4e91903838dd771f50",
34+
"status": "ok",
35+
"description": "corsMiddleware",
36+
"origin": "auto.http.otel.express",
37+
"data": {
38+
"express.name": "corsMiddleware",
39+
"express.type": "middleware",
40+
"sentry.op": "middleware.express",
41+
"sentry.origin": "auto.http.otel.express"
42+
},
43+
"sentry_tags": {
44+
"user": "ip:::1",
45+
"user.ip": "::1",
46+
"environment": "production",
47+
"transaction": "GET /vulnerable-login",
48+
"transaction.method": "GET",
49+
"transaction.op": "http.server",
50+
"browser.name": "Chrome",
51+
"sdk.name": "sentry.javascript.node",
52+
"sdk.version": "9.17.0",
53+
"platform": "node",
54+
"os.name": "macOS",
55+
"category": "middleware",
56+
"op": "middleware.express",
57+
"status": "ok",
58+
"trace.status": "ok"
59+
},
60+
"hash": "e6088cf8b370ed60"
61+
},
62+
{
63+
"timestamp": 1747089758.568761,
64+
"start_timestamp": 1747089758.568,
65+
"exclusive_time": 0.761032,
66+
"op": "middleware.express",
67+
"span_id": "92553d2584d250b8",
68+
"parent_span_id": "91fa92ff0205967d",
69+
"trace_id": "375a86eca09a4a4e91903838dd771f50",
70+
"status": "ok",
71+
"description": "jsonParser",
72+
"origin": "auto.http.otel.express",
73+
"data": {
74+
"express.name": "jsonParser",
75+
"express.type": "middleware",
76+
"sentry.op": "middleware.express",
77+
"sentry.origin": "auto.http.otel.express"
78+
},
79+
"sentry_tags": {
80+
"user": "ip:::1",
81+
"user.ip": "::1",
82+
"environment": "production",
83+
"transaction": "GET /vulnerable-login",
84+
"transaction.method": "GET",
85+
"transaction.op": "http.server",
86+
"browser.name": "Chrome",
87+
"sdk.name": "sentry.javascript.node",
88+
"sdk.version": "9.17.0",
89+
"platform": "node",
90+
"os.name": "macOS",
91+
"category": "middleware",
92+
"op": "middleware.express",
93+
"status": "ok",
94+
"trace.status": "ok"
95+
},
96+
"hash": "c81e963dad9ebc6c"
97+
},
98+
{
99+
"timestamp": 1747089758.569093,
100+
"start_timestamp": 1747089758.569,
101+
"exclusive_time": 0.092983,
102+
"op": "request_handler.express",
103+
"span_id": "435146ab0909419d",
104+
"parent_span_id": "91fa92ff0205967d",
105+
"trace_id": "375a86eca09a4a4e91903838dd771f50",
106+
"status": "ok",
107+
"description": "/vulnerable-login",
108+
"origin": "auto.http.otel.express",
109+
"data": {
110+
"express.name": "/vulnerable-login",
111+
"express.type": "request_handler",
112+
"http.route": "/vulnerable-login",
113+
"sentry.op": "request_handler.express",
114+
"sentry.origin": "auto.http.otel.express"
115+
},
116+
"sentry_tags": {
117+
"user": "ip:::1",
118+
"user.ip": "::1",
119+
"environment": "production",
120+
"transaction": "GET /vulnerable-login",
121+
"transaction.method": "GET",
122+
"transaction.op": "http.server",
123+
"browser.name": "Chrome",
124+
"sdk.name": "sentry.javascript.node",
125+
"sdk.version": "9.17.0",
126+
"platform": "node",
127+
"os.name": "macOS",
128+
"op": "request_handler.express",
129+
"status": "ok",
130+
"trace.status": "ok"
131+
},
132+
"hash": "872b0c84a6f1c590"
133+
},
134+
{
135+
"timestamp": 1747089758.637715,
136+
"start_timestamp": 1747089758.572,
137+
"exclusive_time": 65.715075,
138+
"op": "db",
139+
"span_id": "4703181ac343f71a",
140+
"parent_span_id": "91fa92ff0205967d",
141+
"trace_id": "375a86eca09a4a4e91903838dd771f50",
142+
"status": "ok",
143+
"description": "SELECT * FROM users WHERE username = 'hello'",
144+
"origin": "auto.db.otel.mysql2",
145+
"sentry_tags": {
146+
"description": "SELECT * FROM users WHERE username = %s"
147+
},
148+
"data": {
149+
"db.system": "mysql",
150+
"db.connection_string": "jdbc:mysql://localhost:3306/injection_test",
151+
"db.name": "injection_test",
152+
"db.statement": "SELECT * FROM users WHERE username = 'hello'",
153+
"db.user": "root",
154+
"net.peer.name": "localhost",
155+
"net.peer.port": 3306,
156+
"otel.kind": "CLIENT",
157+
"sentry.op": "db",
158+
"sentry.origin": "auto.db.otel.mysql2"
159+
},
160+
"hash": "45330ba0cafa5997"
161+
}
162+
]
163+
}

fixtures/events/performance_problems/sql-injection/sql-injection-event-parameterized-query.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"trace_id": "375a86eca09a4a4e91903838dd771f50",
3535
"status": "ok",
3636
"description": "SELECT * FROM users WHERE uid = &uid and username in ('bob')",
37-
"origin": "auto.db.otel.mysql2",
3837
"sentry_tags": {
3938
"description": "SELECT * FROM users WHERE uid = &uid and username in ('bob')"
4039
},
@@ -47,8 +46,7 @@
4746
"net.peer.name": "localhost",
4847
"net.peer.port": 3306,
4948
"otel.kind": "CLIENT",
50-
"sentry.op": "db",
51-
"sentry.origin": "auto.db.otel.mysql2"
49+
"sentry.op": "db"
5250
},
5351
"hash": "45330ba0cafa5997"
5452
}

fixtures/events/performance_problems/sql-injection/sql-injection-event-query.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@
144144
"trace_id": "375a86eca09a4a4e91903838dd771f50",
145145
"status": "ok",
146146
"description": "SELECT * FROM users WHERE username = 'hello' ORDER BY username ASC",
147-
"origin": "auto.db.otel.mysql2",
148147
"sentry_tags": {
149148
"description": "SELECT * FROM users WHERE username = %s ORDER BY username ASC"
150149
},
@@ -157,8 +156,7 @@
157156
"net.peer.name": "localhost",
158157
"net.peer.port": 3306,
159158
"otel.kind": "CLIENT",
160-
"sentry.op": "db",
161-
"sentry.origin": "auto.db.otel.mysql2"
159+
"sentry.op": "db"
162160
},
163161
"hash": "45330ba0cafa5997"
164162
}

fixtures/events/performance_problems/sql-injection/sql-injection-laravel-query.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@
142142
"trace_id": "375a86eca09a4a4e91903838dd771f50",
143143
"status": "ok",
144144
"description": "SELECT * FROM users WHERE id IN (1000)",
145-
"origin": "auto.db.otel.mysql2",
146145
"data": {
147146
"db.system": "mysql",
148147
"db.connection_string": "jdbc:mysql://localhost:3306/injection_test",
@@ -152,8 +151,7 @@
152151
"net.peer.name": "localhost",
153152
"net.peer.port": 3306,
154153
"otel.kind": "CLIENT",
155-
"sentry.op": "db",
156-
"sentry.origin": "auto.db.otel.mysql2"
154+
"sentry.op": "db"
157155
},
158156
"sentry_tags": {
159157
"user": "ip:::1",

0 commit comments

Comments
 (0)