-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1226 from freedomofpress/check-paths
Check paths and ensure minimal perms
- Loading branch information
Showing
23 changed files
with
860 additions
and
132 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
rules: | ||
|
||
- id: tarfile-extractall-traversal | ||
languages: | ||
- python | ||
severity: ERROR | ||
message: Possible path traversal through tarfile.open($PATH).extractall() if the source tar is controlled by an attacker. | ||
patterns: | ||
- pattern: "....extractall(...)" | ||
- pattern-not-inside: | | ||
def safe_extractall(...): | ||
... | ||
- id: tarfile-extract-traversal | ||
languages: | ||
- python | ||
severity: ERROR | ||
message: Possible path traversal through tarfile.open($PATH).extract() if the source tar is controlled by an attacker. | ||
patterns: | ||
- pattern: "....extract(...)" | ||
|
||
- id: gzip-extract-traversal | ||
languages: | ||
- python | ||
severity: ERROR | ||
message: Possible path traversal through gzip.open if the source zip file is controlled by an attacker. | ||
patterns: | ||
- pattern: | | ||
with gzip.open(...) as $IN, open(...) as $OUT: | ||
... | ||
copyfileobj(...) | ||
- id: gzip-open-insecure | ||
languages: | ||
- python | ||
severity: ERROR | ||
message: Possible path traversal through gzip.open if the source zip file is controlled by an attacker. | ||
patterns: | ||
- pattern: | | ||
with gzip.open(...) as $IN, open(...) as $OUT: | ||
... | ||
- pattern-not-inside: | | ||
def safe_gzip_extract(...): | ||
... | ||
- id: mkdir-insecure | ||
languages: | ||
- python | ||
severity: ERROR | ||
message: Possible path traversal or insecure directory and file permissions through os.mkdir(). Use securedrop_client.utils.safe_mkdir instead. | ||
patterns: | ||
- pattern: "....mkdir(...)" | ||
- pattern-not-inside: | | ||
def safe_mkdir(...): | ||
... | ||
- id: makedirs-insecure | ||
languages: | ||
- python | ||
severity: ERROR | ||
message: Possible path traversal or insecure directory and file permissions through os.makedirs(). Use securedrop_client.utils.safe_mkdir instead. | ||
patterns: | ||
- pattern: "....makedirs(...)" | ||
- pattern-not-inside: | | ||
def safe_mkdir(...): | ||
... | ||
- id: copy-insecure | ||
languages: | ||
- python | ||
severity: ERROR | ||
message: Possible path traversal or insecure directory and file permissions through shutil.copy(). Use securedrop_client.utils.safe_copy instead. | ||
patterns: | ||
- pattern: "....shutil.copy(...)" | ||
- pattern-not-inside: | | ||
def safe_copy(...): | ||
... | ||
- id: copyfileobj-insecure | ||
languages: | ||
- python | ||
severity: ERROR | ||
message: Possible path traversal or insecure directory and file permissions through shutil.copyfileobj(). Use securedrop_client.utils.safe_copyfileobj instead. | ||
patterns: | ||
- pattern: "....shutil.copyfileobj(...)" | ||
- pattern-not-inside: | | ||
def safe_copyfileobj(...): | ||
... | ||
- id: move-insecure | ||
languages: | ||
- python | ||
severity: ERROR | ||
message: Possible path traversal or insecure directory and file permissions through shutil.move(). Use securedrop_client.utils.safe_move instead. | ||
patterns: | ||
- pattern: "....shutil.move(...)" | ||
- pattern-not-inside: | | ||
def safe_move(...): | ||
... |
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
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,6 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
umask 077 | ||
|
||
while [ -n "$1" ]; do | ||
param="$1" | ||
|
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 +1 @@ | ||
__version__ = "0.4.0" | ||
__version__ = "0.4.1" |
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
Oops, something went wrong.