-
Notifications
You must be signed in to change notification settings - Fork 160
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
Add http.route tag to SymfonyIntegration.php #2992
base: master
Are you sure you want to change the base?
Changes from all commits
9dde3bf
a40badc
ca38a54
9fbe7c6
537f1f1
7010b37
04884ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ import com.datadog.appsec.php.docker.InspectContainerHelper | |
import com.datadog.appsec.php.model.Span | ||
import com.datadog.appsec.php.model.Trace | ||
import org.junit.jupiter.api.MethodOrderer | ||
import org.junit.jupiter.api.Order | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.TestMethodOrder | ||
import org.junit.jupiter.api.condition.EnabledIf | ||
|
@@ -45,12 +44,6 @@ class Symfony62Tests { | |
www: 'symfony62', | ||
) | ||
|
||
@Test | ||
@Order(1) | ||
void 'reported telemetry integrations are not repeated'() { | ||
|
||
} | ||
|
||
@Test | ||
void 'login success automated event'() { | ||
//The user [email protected] is already on the DB | ||
|
@@ -113,5 +106,32 @@ class Symfony62Tests { | |
assert span.metrics."_dd.appsec.waf.duration" > 0.0d | ||
assert span.meta."_dd.appsec.event_rules.version" != '' | ||
assert span.meta."appsec.blocked" == "true" | ||
assert span.meta."http.route" == '/dynamic-path/{param01}' | ||
} | ||
|
||
@Test | ||
void 'symfony http route disabled'() { | ||
try { | ||
def res = CONTAINER.execInContainer( | ||
'bash', '-c', | ||
'''echo export DD_TRACE_SYMFONY_HTTP_ROUTE=false >> /etc/apache2/envvars; | ||
service apache2 restart''') | ||
assert res.exitCode == 0 | ||
|
||
HttpRequest req = container.buildReq('/dynamic-path/someValue').GET().build() | ||
def trace = container.traceFromRequest(req, ofString()) { HttpResponse<String> re -> | ||
assert re.statusCode() == 200 | ||
assert re.body().contains('Hi someValue!') | ||
} | ||
|
||
Span span = trace.first() | ||
assert span.meta."http.route" != '/dynamic-path/{param01}' | ||
} finally { | ||
def res = CONTAINER.execInContainer( | ||
'bash', '-c', | ||
'''sed -i '/export DD_TRACE_SYMFONY_HTTP_ROUTE=/d' /etc/apache2/envvars; | ||
service apache2 restart''') | ||
assert res.exitCode == 0 | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
framework: | ||
test: true | ||
session: | ||
storage_id: session.storage.mock_file | ||
storage_factory_id: session.storage.factory.mock_file |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,13 +21,12 @@ public function homeAction(Request $request) | |
); | ||
} | ||
|
||
/** | ||
* @Route("/dynamic-path/{param01}", name="dynamic-path") | ||
*/ | ||
public function dynamicAction(Request $request) | ||
#[Route("/dynamic-path/{param01}", locale: "en")] | ||
#[Route("/caminho-dinamico/{param01}", locale: "pt")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is the PT route reported if locale is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't report the routes and I don't hit this route, only then |
||
public function dynamicAction(Request $request, string $param01) | ||
{ | ||
return new Response( | ||
'Hi!' | ||
"Hi $param01!" | ||
); | ||
} | ||
} |
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.
Why are we removing those tests from PHP 8.1 up to PHP 8.3? 🤔
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.
Symfony 5.2 doesn't actually work with those PHP versions. The tests fail with: