Skip to content

server side request forgery filter - #4

Merged
martyvona merged 7 commits into
mainfrom
feature/ssrf-filter
Oct 12, 2026
Merged

martyvona merged 7 commits into
mainfrom
feature/ssrf-filter

Conversation

@martyvona

@martyvona martyvona commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

harden URL handling in server side requests


Devin Review

@martyvona
martyvona requested review from flynnplatt and jl-0 October 12, 2026 20:02
@martyvona martyvona self-assigned this Oct 12, 2026

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 1 potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment on lines +35 to +38
if (!isSafeHost(u.getHost())) { //check host of the URL object we actually connect to
throw new IOException("blocked request to non-public host " + u.getHost());
}
HttpURLConnection c = (HttpURLConnection)u.openConnection();

@devin-ai-integration devin-ai-integration Bot Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟥 DNS rebinding reaches private hosts

With DNS caching disabled or expired, open can connect to a private address after validating a public one. HttpURLConnection resolves the hostname again for the socket, so an attacker-controlled DNS answer can change between resolutions.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@martyvona
martyvona marked this pull request as draft October 12, 2026 20:26
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@jl-0 jl-0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, added one update for S3 urls

@jl-0
jl-0 marked this pull request as ready for review October 12, 2026 21:14
…service into feature/ssrf-filter

# Conflicts:
#	src/main/java/jpl/mipl/mars/mis/MISParams.java

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

Comment on lines +549 to +551
int colon = host.indexOf(':');
if (colon >= 0) {
host = host.substring(0, colon); //strip port

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Explicit-port S3 images fail in CLI

For https://bucket.s3.amazonaws.com:443/image.IMG, isS3Url now selects S3 instead of HTTP. The CLI creates no S3 client for HTTPS inputs, so the image fails with S3 service required.

Learn more

The CLI builds an S3 client only for s3:// inputs in MISCLI. An HTTPS S3 address containing a port previously failed the old S3 hostname check and was read via HTTP. Stripping the port now makes it an S3 input, but MISTask rejects it because no S3 client exists.

Example: --image https://bucket.s3.amazonaws.com:443/image.IMG -l 1 -s 1 selects S3, then fails before reading the image. The same public HTTPS object was previously reachable through the HTTP reader.

Recommended fix: Align the CLI's client initialization with S3Helper.isS3Url for accepted S3 HTTPS addresses, or keep HTTPS addresses that the CLI cannot handle through S3 on the HTTP path. Check both explicit-port and ordinary S3 HTTPS URLs.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@sonarqubecloud

Copy link
Copy Markdown

@martyvona
martyvona merged commit efa41f7 into main Oct 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants