fix: validate FDP-supplied ids before building request URIs (SSRF) - #62
fix: validate FDP-supplied ids before building request URIs (SSRF)#62qplevier wants to merge 3 commits into
Conversation
task.uuid, task.UUID, and resourceId come from FDP server responses and were concatenated directly into outgoing request URIs. A malicious or compromised FDP instance could inject extra path segments or redirect the request elsewhere (CWE-918). Require these ids to be well-formed UUIDs before use. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
This PR hardens FdpClient against CWE-918-style URI construction issues by validating FDP-supplied identifiers before embedding them into outgoing request URIs.
Changes:
- Added a
validatedId(String)helper that requires well-formed UUIDs before use in request paths. - Applied UUID validation at the affected URI construction sites (
updateSchema,releaseSchema,fetchResource,updateResource).
Suppressed comments (1)
src/main/java/nl/healthri/fdp/uploadschema/integrations/FdpClient.java:284
- fetchResource() logs the FDP-supplied resourceId before it is validated. If the id is malicious/compromised, this can still cause log injection (newlines/control chars) even though URI building now validates the id. Log the validated id instead (or avoid logging untrusted ids).
URI uri = new URI(this.hostname + "/resource-definitions/" + validatedId(resourceId));
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
❌ The last analysis has failed. |
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/main/java/nl/healthri/fdp/uploadschema/integrations/FdpClient.java:68
- Catching NullPointerException here is avoidable and makes the intent less clear. A simple explicit null check keeps the exception handling focused on UUID parsing failures and avoids relying on NPE control flow.
private static String validatedId(String id) {
try {
return UUID.fromString(id).toString();
} catch (IllegalArgumentException | NullPointerException e) {
String safeId = id == null ? "null" : id.replaceAll("[\\r\\n\\t]", "_");



Summary
task.uuid,task.UUID, andresourceId— values returned by the remote FDP server — were concatenated directly into outgoing request URIs inFdpClient.validatedIdhelper that requires these ids to be well-formed UUIDs before use, so a malicious/compromised FDP response can't inject extra path segments or redirect requests elsewhere.updateSchema,releaseSchema,fetchResource,updateResource.🤖 Generated with Claude Code