Kintyre / ksconf

Kintyre's Splunk Configuration tool
Apache License 2.0
50 stars 13 forks source link

Improve sanity checker (unarchive) path testing #9

Open lowell80 opened 6 years ago

lowell80 commented 6 years ago
def sanity_checker(iter):
    # Todo:  make this better....   write a regex for the types of things that are valid?
    for gaf in iter:
        if gaf.path.startswith("/") or ".." in gaf.path:
            raise ValueError("Bad path found in archive:  {}".format(gaf.path))
        yield gaf