You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Validate against max resolution before image generation - #4645
Static requests bypass general option validation and defaults
src/image_gen/imagegenutils.cpp:341
This early return skips ensureAcceptableForDynamic, which now contains checks and defaulting that previously ran for every request mode. Static requests can therefore bypass the num_inference_steps bounds (and the image-count bounds) and no longer receive defaultNumInferenceSteps. Run those general option checks after the static-shape validation instead of returning here.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Image-edit requests can still bypass the maximum-resolution limit when no explicit or configured default size is present.
0 open findings
Previously missed (1)
In code that hasn't changed since last review
Image edits bypass max-resolution validation at native size
src/image_gen/imagegenutils.cpp:435
The native-resolution fallback is only applied to create requests. getImageEditRequestOptions() still leaves width/height absent when no defaultResolution is configured, so an /images/edits request with an omitted or auto size passes ensureCommonValidations() without any max-resolution check and GenAI can generate at its native resolution even when that exceeds maxResolution. Please capture and validate the effective native resolution for image-to-image/inpainting requests as well, with multipart regression coverage.
The reason will be displayed to describe this comment to others. Learn more.
We shoudl also test for getImageGenerationRequestOptions with nativeResolution set above max and missing size in request?
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
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.
🛠 Summary
CWE-770
Fix for image generation api to validate requested size against configured maxResolution
🧪 Checklist
``