ansible/CVE-2020-1737.patch
starlet-dx c52b423a72 fix CVE-2019-14904 CVE-2020-10684 CVE-2020-10729 CVE-2020-1735-to-CVE-2020-1740 CVE-2020-1753 CVE-2021-20191
(cherry picked from commit ebf023f03ad09762c8147ad8c963a51b60de62ff)
2021-09-17 20:38:23 +08:00

29 lines
1.2 KiB
Diff

From 2d9910d0fe3a411f5bec96ecc1d082c9c6e34153 Mon Sep 17 00:00:00 2001
From: Sam Doran <sdoran@redhat.com>
Date: Tue, 25 Feb 2020 15:13:36 -0500
Subject: [PATCH] win_unzip - ensure extraction path ends withpath sep
---
lib/ansible/modules/windows/win_unzip.ps1 | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/ansible/modules/windows/win_unzip.ps1 b/lib/ansible/modules/windows/win_unzip.ps1
index abda148..7615784 100644
--- a/lib/ansible/modules/windows/win_unzip.ps1
+++ b/lib/ansible/modules/windows/win_unzip.ps1
@@ -54,6 +54,11 @@ Function Extract-Zip($src, $dest) {
$entry_target_path = [System.IO.Path]::Combine($dest, $archive_name)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
+ # Ensure directory ends with path separator to prevent path traversal
+ if (-not $entry_dir.EndsWith([System.IO.Path]::DirectorySeparatorChar.ToString())) {
+ $entry_dir += [System.IO.Path]::DirectorySeparatorChar.ToString()
+ }
+
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
$result.changed = $true
--
2.23.0