Repository navigation
Conversation
|
Warning Socket is a tool Sentry Security team deployed to defend against supply chain attack. Please provide any feedback you have in #discuss-security slack channel ❤️
|
📲 Install BuildsAndroid
|
Run sentry-servlet against the minimum supported servlet container while keeping Servlet 3.1 as the production compile target. Exercise the service-loaded initializer through a real HTTP request and verify that request context reaches Sentry.
Reuse the real-container servlet integration test with a Tomcat 9 and Servlet 4 runtime classpath. Keep the Tomcat 8.5 run as the minimum-runtime check and attach both runs to the verification lifecycle.
db8bb6c to
6793b24
Compare
runningcode
left a comment
There was a problem hiding this comment.
there's a couple of gradle quirks in this that would be fixed by using the jvm test suite like we do for the spring boot matrix.
Replace the hand-built Tomcat 9 test task with isolated JVM test suites. Run the shared servlet integration test with independent Tomcat 8.5 and Tomcat 9 dependency graphs and attach both suites to check. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bc1635c. Configure here.
| sources { | ||
| java.setSrcDirs(sourceSets["integrationTest"].allJava.srcDirs) | ||
| resources.setSrcDirs(sourceSets["integrationTest"].resources.srcDirs) | ||
| } |
There was a problem hiding this comment.
Tomcat 9 suite skips Kotlin tests
Medium Severity
The integrationTestTomcat9 suite copies integrationTest's allJava.srcDirs, which is src/integrationTest/java, not the Kotlin tests in src/integrationTest/kotlin. Kotlin still compiles src/integrationTestTomcat9/kotlin, so that suite produces no classes and Gradle skips the task as NO-SOURCE. Tomcat 9 / Servlet 4.0 never actually runs.
Triggered by project rule: PR Review Guidelines for Cursor Bugbot
Reviewed by Cursor Bugbot for commit bc1635c. Configure here.
| } | ||
| } | ||
|
|
||
| tasks.check { |
There was a problem hiding this comment.
i don't think we run integration tests as part of the check task for other modules. we usually run them separately
|
|
||
| # tomcat libraries | ||
| tomcat85-embed-core = { module = "org.apache.tomcat.embed:tomcat-embed-core", version = "8.5.100" } | ||
| tomcat9-embed-core = { module = "org.apache.tomcat.embed:tomcat-embed-core", version = "9.0.108" } |
There was a problem hiding this comment.
we should probably extract 9.0.108 to a variable so that all the 9.x versions are updated together.
| testImplementation(projects.sentryTestSupport) | ||
| testImplementation(kotlin(Config.kotlinStdLib)) | ||
| testImplementation(libs.awaitility.kotlin) | ||
| testImplementation(libs.google.truth) |
runningcode
left a comment
There was a problem hiding this comment.
thanks for fixing this! i left some more comments but approving as well!
| implementation(libs.kotlin.test.junit) | ||
| implementation(libs.tomcat85.embed.core) | ||
| } | ||
| targets.all { |
There was a problem hiding this comment.
another option that would mean we don't have to compile the test twice is to adjust this to have a single test suite but with two targets. the two targets are tomcat 8.5 and tomcat 9.
here's what my agent thinks would work:
register<JvmTestSuite>("integrationTest") {
useJUnit()
dependencies {
implementation(project())
implementation(projects.sentryTestSupport)
implementation(libs.google.truth)
implementation(libs.kotlin.test.junit)
implementation(libs.tomcat85.embed.core)
}
targets.named("integrationTest") {
testTask.configure { /* Tomcat 8.5 system properties */ }
}
targets.register("integrationTestTomcat9") {
testTask.configure {
classpath = sourceSets["integrationTest"].output + tomcat9RuntimeClasspath
/* Tomcat 9 system properties */
}
}
}
Its mostly an opinion though. i'll approve this anyways.


PR Stack (Servlet API)
📜 Description
Add a real-container integration test for
sentry-servletand run it on both Tomcat 8.5 / Servlet 3.1 and Tomcat 9 / Servlet 4.0.The shared test loads
SentryServletContainerInitializerthroughServiceLoader, sends an HTTP request through embedded Tomcat, and verifies that the captured Sentry event contains the request method, URL, and query string.💡 Motivation and Context
Production code remains compiled against the minimum supported Servlet 3.1 API, preserving the compiler-enforced compatibility floor. Running the same test against Servlet 3.1 and Servlet 4.0 verifies both the minimum runtime and the latest
javax.servletruntime.💚 How did you test it?
make format api./gradlew :sentry-servlet:integrationTest :sentry-servlet:integrationTestTomcat9 --rerun-tasks --no-build-cachecompileClasspathresolvesjavax.servlet-api:3.1.0📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None.
#skip-changelog