mitre / stixmarx

Data Markings API for STIX 1.x
Other
8 stars 7 forks source link

[Bug] Permission denied #13

Open TiiTcHY opened 2 years ago

TiiTcHY commented 2 years ago

Expected Behavior I would expect to be able to import the module with no issues.

Actual Behavior the module fails to import for the following reasons: [Errno 13] Permission denied: '/.stixmarx'

This is on a linux box. I have create a docket image with the following: mitreattack-python,pandas,pyattck,bs4,colour,openpyxl,stix2,taxii2-client,numpy,drawSvg,Pillow,tqdm,xlsxwriter,tabulate,stix2-elevator

When i run the python script against this docker image i get the error where it has failed to run due to permission denied.

The module is installed here "/usr/local/lib/python3.9/site-packages/stixmarx/" however, looking at the script i believe its this line which is casing me an issue " Line 33: user_path = os.path.join(os.path.expanduser("~"), ".stixmarx")" which is inside of stixmarx\fields\__init.py. This is then thinking that the user directory is root which is why the error is [Errno 13] Permission denied: '/.stixmarx' as i do not have permission to write in root.

I raised the issue here MITRE BUG

clenk commented 2 years ago

Hi @TiiTcHY, have you tried running your docker image as a different user other than root?

Let me know it that won't work for you.

TiiTcHY commented 2 years ago

Hello @clenk I am unable to change the user that its being run via a SOAR platform. I'm looking to automate the tasks within the palform but unable to due to this issue with the creation of the file.

rishabhsiitk commented 1 year ago

@TiiTcHY Here is a quick fix, it worked for me. Define a HOME environment variable with value of home directory of user or path where user has write access.

meirmedigate commented 1 month ago

This will solve the root cause, making it possible to define the directory that the files are stored in - https://github.com/mitre/stixmarx/pull/14