Score:0

community.windows.win_unzip shows Filename contains relative paths which would extract outside the destination error message

uz flag

I'm trying to unzip a zip file in a remote server
This file was download first from jFrog repository
The following task should handle the unzip:

- name: Unzip Config.zip file
  community.windows.win_unzip:
    src: C:\files\config.zip
    dest: C:\files\
    recurse: no
    delete_archive: yes
  when: "'center_primary_appservers' in group_names"

But produced the following error

TASK [jfrog : Unzip Config.zip file] **************************************************************************************************************************************task path: /ansible/roles/jfrog/tasks/unzip_config.yml:1
redirecting (type: modules) ansible.builtin.win_unzip to community.windows.win_unzip
Using module file /usr/local/lib/python3.6/site-packages/ansible_collections/community/windows/plugins/modules/win_unzip.ps1
Pipelining is enabled.
<vm1.domain.com> ESTABLISH WINRM CONNECTION FOR USER: DOMAIN\hiddai on PORT 5985 TO vm1.domain.com
fatal: [vm1.domain.com]: FAILED! => {
    "changed": false,
    "dest": "C:\\files\\",
    "msg": "Error unzipping 'C:\\files\\config.zip' to 'C:\\files\\'! Filename contains relative paths which would extract outside the destination: \\src\\Build\\Trunk\\Src\\BuildProcess\\BuildMessageTemplates\\BuildAlertTemplate.htm",
    "removed": false,
    "src": "C:\\files\\config.zip"
}
META: 
META: 
META: 
META: 
META: 
META: 
META: 
META: ran handlers
META: ran handlers

I installed 7Zip on the remote machine and ran the task again - same result
To mention that:

  • this zip folder is extract with 7Zip tool only and not with the Windows built-in unzip tool...
  • the Expand-Archive command managed to extract the zip folder

What should I do in order the file to be unzip successfully with ansible win_unzip module?

Michael Hampton avatar
cz flag
Report the problem to whoever created the zip file. This is a serious security risk.
uz flag
@MichaelHampton - may you clarify about the security risk and how it is solve my issue?
Michael Hampton avatar
cz flag
A naïve unzip tool could overwrite any file in the disk because of that. If the zip file were malicious then this could compromise or destroy your installed OS. In this case it would just put the files in unexpected locations, and possibly overwrite something important.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.