Splunk Dev

How the Splunk APIs deal with files

jsun
New Member

Hi Everyone,

I am new to Splunk Cloud App development. I have got some Splunk Cloud warning messages after AppInspect from Splunk Cloud Team, which are mostly related to manage file access in Python code. After I searched the document and Google, I came out a way but not sure if it works. Could anyone point me out if the follwoing way works to avoid the warning message?

try:
    from splunk.clilib.bundle_paths import make_splunkhome_path
except ImportError:
    from splunk.appserver.mrsparkle.lib.util import make_splunkhome_path

_file = make_splunkhome_path(["var", "log", "splunk", log_file_name])
with open(_file, 'w') as filehandler:
    filehandler.write("content need to write to file")

 

FYI, the warning messages were refering the "Method used to write/manipulate/remove to/from files outside of the app dir".

Thanks.

John

Labels (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

This is one of the limitations of AppInspect.  Such warnings are supposed to be resolved during manual inspection by Splunk.

---
If this reply helps you, Karma would be appreciated.
0 Karma

jsun
New Member

Thanks.

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...