Fix corrupted destination filename in Crop/Scale when source is a signed URL#1272
Merged
Merged
Conversation
…ned URL When an image loaded from an external storage provider (e.g. S3 with pre-signed URLs) was passed to Crop/Scale/Resize/Save, the destination blob name was derived from the full URL — including the query string — producing names like `image.png%3FX-Amz-Expires%3D...%26X-Amz-Signature%3D...`. The URL-to-filename normalization was gated on the absence of an external provider, which is exactly the scenario where signed URLs appear. Apply the normalization unconditionally for http/https inputs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Cherry pick to beta success |
The ImageUtilTest file is shared between DotNetUnitTest (net462) and DotNetCoreUnitTest (net10). Use the same #if NETCORE / System.Drawing pattern already in GXUtilsCommon so the new test compiles on both. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Cherry pick to beta success |
The previous assertion compared the resolved malicious path against Preferences.getBLOB_PATH() directly. When a prior test in the same process sets GxContext.IsHttpContext = true (via GxNetCoreStartup), the cached blobPath gets rooted at Directory.GetParent(GetStartupDirectory()) = bin/Release, while ResolveUri itself can still reresolve paths against the current working directory (bin/Release/net10.0), making the StartsWith check fail even when no real traversal occurred. Derive the comparison base from ResolveUri of a known-safe filename, so both sides go through the same code path and share any environment- dependent rooting. The security invariant checked is unchanged: resolved malicious inputs must stay inside the blob/multimedia directory. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Cherry pick to beta success |
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.
When an image loaded from an external storage provider (e.g. S3 with pre-signed URLs) was passed to Crop/Scale/Resize/Save, the destination blob name was derived from the full URL — including the query string — producing names like
image.png%3FX-Amz-Expires%3D...%26X-Amz-Signature%3D.... The URL-to-filename normalization was gated on the absence of an external provider, which is exactly the scenario where signed URLs appear.Apply the normalization unconditionally for http/https inputs.
Issue:208429