Skip to content
This repository has been archived by the owner on Sep 15, 2020. It is now read-only.
Permalink
Browse files Browse the repository at this point in the history
[sos_collector] Set umask for all files created
Sets a umask of 0077 for all files created by sos-collector. This
ensures collected sosrpeorts are not world readable and maintains the
original permissions of the sos archives.

Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
  • Loading branch information
TurboTurtle committed Sep 25, 2018
1 parent a89ab38 commit 72058f9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions soscollector/sos_collector.py
Expand Up @@ -41,6 +41,7 @@ class SosCollector():
'''Main sos-collector class'''

def __init__(self, config):
os.umask(0077)
self.config = config
self.threads = []
self.workers = []
Expand Down

2 comments on commit 72058f9

@abergmann
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CVE-2018-14650 was assigned to this issue.

@bmr-cymru
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want to use PEP3127 integer literal syntax here, or this will break on Python3:

Py2:

>>> baz = 0o77
>>> qux = 0077
>>> baz == qux
True

Py3:

>>> baz = 0o77
>>> qux = 0077
  File "<stdin>", line 1
    qux = 0077
             ^
SyntaxError: invalid token

Python2 still allows leading zero notation for octal literals, but Python3 requires either o or O (the letter).

Please sign in to comment.