MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / umask_secret

Method umask_secret

mitmproxy/certs.py:549–560  ·  view source on GitHub ↗

Context to temporarily set umask to its original value bitor 0o77. Useful when writing private keys to disk so that only the owner will be able to read them.

()

Source from the content-addressed store, hash-verified

547 @staticmethod
548 @contextlib.contextmanager
549 def umask_secret():
550 """
551 Context to temporarily set umask to its original value bitor 0o77.
552 Useful when writing private keys to disk so that only the owner
553 will be able to read them.
554 """
555 original_umask = os.umask(0)
556 os.umask(original_umask | 0o77)
557 try:
558 yield
559 finally:
560 os.umask(original_umask)
561
562 @staticmethod
563 def create_store(

Callers 2

test_umask_secretMethod · 0.80
create_storeMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_umask_secretMethod · 0.64