Skip to content

fix: disallow SSRF via remote $ref#2224

Merged
daniel-kmiecik merged 3 commits intomasterfrom
bug-bounty-fix-redirections
Sep 1, 2025
Merged

fix: disallow SSRF via remote $ref#2224
daniel-kmiecik merged 3 commits intomasterfrom
bug-bounty-fix-redirections

Conversation

@daniel-kmiecik
Copy link
Contributor

@daniel-kmiecik daniel-kmiecik commented Aug 27, 2025

The current implementation of the URL validation logic bypasses the security controls of setSafelyResolveURL when an HTTP redirect is encountered. This allows a malicious OpenAPI specification to force the validator's host to connect to internal network resources, creating a significant security risk. This is a fix for this securrity issue.

@ewaostrowska ewaostrowska self-requested a review September 1, 2025 06:21
@ewaostrowska
Copy link
Contributor

Looks good :)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements security measures to prevent Server-Side Request Forgery (SSRF) attacks via remote $ref in the Swagger parser by introducing URL validation and restricting access to potentially dangerous network locations.

Key changes:

  • Adds PermittedUrlsChecker functionality to validate URLs before making remote requests
  • Implements redirect limits and protocol validation to prevent abuse
  • Updates test infrastructure to support HTTPS and handle URL security checks

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pom.xml Removes commented dependencies and adds system property for testing
RemoteUrl.java Refactors URL handling with redirect limits, security checks, and improved error handling
RefUtils.java Updates method signatures to include PermittedUrlsChecker parameter
Multiple test files Updates tests to use HTTPS, adds security validation, and improves test structure
PermittedUrlsCheckerAllowLocal.java New test utility class to allow local connections during testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@daniel-kmiecik daniel-kmiecik merged commit 5dc2aae into master Sep 1, 2025
5 checks passed
@daniel-kmiecik daniel-kmiecik deleted the bug-bounty-fix-redirections branch September 1, 2025 14:00
@rootxjs
Copy link

rootxjs commented Sep 25, 2025

Fixes #2206

@daniel-kmiecik
Copy link
Contributor Author

@rootxjs, thank you for bringing this to our attention! I am closing the issue :)

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