-
-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge dev #3755
base: master
Are you sure you want to change the base?
merge dev #3755
Conversation
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
…many resolution changes
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
This reverts commit 57a80a7.
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Automatic Color Inpaint
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
files += [f.name for f in batch_files] | ||
if batch_folder is not None: | ||
files += [f.name for f in batch_folder] | ||
if batch_str is not None and len(batch_str) > 0 and os.path.exists(batch_str) and os.path.isdir(batch_str): |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 1 day ago
To fix the problem, we need to validate the batch_str
path to ensure it is within a safe root directory. This involves normalizing the path and checking that it starts with the intended base path. We will implement this validation in the batch
function before using the batch_str
variable.
- Define a safe root directory for the batch operations.
- Normalize the
batch_str
path usingos.path.normpath
. - Check that the normalized path starts with the safe root directory.
- Raise an exception if the path validation fails.
-
Copy modified lines R515-R519 -
Copy modified line R521
@@ -514,5 +514,9 @@ | ||
files += [f.name for f in batch_folder] | ||
if batch_str is not None and len(batch_str) > 0 and os.path.exists(batch_str) and os.path.isdir(batch_str): | ||
if batch_str is not None and len(batch_str) > 0: | ||
safe_root = '/server/static/images' # Define a safe root directory | ||
normalized_path = os.path.normpath(batch_str) | ||
if not normalized_path.startswith(safe_root) or not os.path.exists(normalized_path) or not os.path.isdir(normalized_path): | ||
raise Exception("Invalid batch_str path") | ||
from modules.files_cache import list_files | ||
files += list(list_files(batch_str, ext_filter=['.png', '.jpg', '.jpeg', '.webp'], recursive=recursive)) | ||
files += list(list_files(normalized_path, ext_filter=['.png', '.jpg', '.jpeg', '.webp'], recursive=recursive)) | ||
if len(files) == 0: |
files += [f.name for f in batch_files] | ||
if batch_folder is not None: | ||
files += [f.name for f in batch_folder] | ||
if batch_str is not None and len(batch_str) > 0 and os.path.exists(batch_str) and os.path.isdir(batch_str): |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 1 day ago
To fix the problem, we need to validate the batch_str
path before using it. The best way to do this is to normalize the path using os.path.normpath
and ensure it starts with a predefined safe root directory. This will prevent directory traversal attacks and ensure that the path is within the expected directory structure.
- Define a safe root directory.
- Normalize the
batch_str
path usingos.path.normpath
. - Check if the normalized path starts with the safe root directory.
- If the path is not valid, raise an exception or handle the error appropriately.
-
Copy modified lines R515-R522
@@ -514,5 +514,10 @@ | ||
files += [f.name for f in batch_folder] | ||
if batch_str is not None and len(batch_str) > 0 and os.path.exists(batch_str) and os.path.isdir(batch_str): | ||
from modules.files_cache import list_files | ||
files += list(list_files(batch_str, ext_filter=['.png', '.jpg', '.jpeg', '.webp'], recursive=recursive)) | ||
if batch_str is not None and len(batch_str) > 0: | ||
safe_root = '/server/static/images' # Define your safe root directory | ||
normalized_path = os.path.normpath(batch_str) | ||
if not normalized_path.startswith(safe_root): | ||
raise Exception("Invalid path") | ||
if os.path.exists(normalized_path) and os.path.isdir(normalized_path): | ||
from modules.files_cache import list_files | ||
files += list(list_files(normalized_path, ext_filter=['.png', '.jpg', '.jpeg', '.webp'], recursive=recursive)) | ||
if len(files) == 0: |
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
Signed-off-by: Vladimir Mandic <[email protected]>
No description provided.