-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import fickling | ||
from fickling.fickle import PickleDecodeError, EmptyPickleError | ||
|
||
from os import environ, path | ||
import sys | ||
|
||
def is_pickle_unsafe(file_path): | ||
try: | ||
return not fickling.is_likely_safe(file_path) | ||
except (NotImplementedError, PickleDecodeError, EmptyPickleError): | ||
return False | ||
except Exception as e: | ||
# print exception on stderr | ||
print("%s: (%s) %s" % (e.__class__.__qualname__, file_path, e), file=sys.stderr) | ||
return False | ||
|
||
def main(): | ||
with open(path.join(environ["SCRIPTPATH"], "all_changed_files.txt")) as all_changed_files: | ||
all_changed_files = [f for f in all_changed_files.read().split("\x00")] | ||
|
||
for f in all_changed_files: | ||
if is_pickle_unsafe(f): | ||
print("""M:%s:0 This pickle might contain unsafe contructs\n""" % (f)) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Also alter semgrep self test yml | ||
semgrep~=1.95.0 | ||
pip-audit~=2.7.0 | ||
pip-audit~=2.7.0 | ||
fickling~=0.1.3 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters