fix(import-url)!: validate artifact URLs to prevent SSRF. Fixes #304#316
Open
rootp1 wants to merge 6 commits intomicrocks:masterfrom
Open
fix(import-url)!: validate artifact URLs to prevent SSRF. Fixes #304#316rootp1 wants to merge 6 commits intomicrocks:masterfrom
rootp1 wants to merge 6 commits intomicrocks:masterfrom
Conversation
Signed-off-by: rootp1 <[email protected]>
Signed-off-by: rootp1 <[email protected]>
Signed-off-by: rootp1 <[email protected]>
Signed-off-by: rootp1 <[email protected]>
Signed-off-by: rootp1 <[email protected]>
Signed-off-by: rootp1 <[email protected]>
Author
|
Hey, @yada @lbroudoux @Harsh4902 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
pkg/util/url_validation.gowithValidateArtifactURL()that enforces scheme allowlist and blocks private/internal IP ranges before any URL is sent to the Microcks serverhttps://is permitted by default;http://requires the new--allow-insecure-urlflag; all other schemes (file://,ftp://,gopher://, etc.) are always rejected127.0.0.0/8,::1), link-local (169.254.0.0/16- covers cloud metadata at169.254.169.254), RFC 1918 (10.0.0.0/8,172.16.0.0/12,192.168.0.0/16), carrier-grade NAT (100.64.0.0/10), unspecified (0.0.0.0,::), and well-known internal hostnames (localhost,host.docker.internal)--allow-insecure-urlflag toimport-urlcommand (defaultfalse) for users who needhttp://for internal artifact repositoriesallowInsecureparameter toDownloadArtifactinterface method so the flag propagates end-to-end through the validation layerReproduction results
Before fix - SSRF to cloud metadata:
After fix - Blocked:
Before fix - SSRF to localhost:
After fix - Blocked:
Before fix - No scheme validation:
After fix - Blocked:
Legitimate use still works:
Related issue(s)
Fixes Server-Side Request Forgery (SSRF) vulnerability in
import-urlcommand where unvalidated artifact URLs allow coercion of the Microcks server to fetch internal network resources, including cloud metadata endpoints.Fixes #304
BREAKING CHANGE
MicrocksClient.DownloadArtifactinterface signature now requires anallowInsecure boolparameter as the fourth argument. Any external implementations of this interface must be updated fromDownloadArtifact(artifactURL string, mainArtifact bool, secret string)toDownloadArtifact(artifactURL string, mainArtifact bool, secret string, allowInsecure bool).