Understanding Python Pickle Insecurity

前端 未结 4 1279
谎友^
谎友^ 2021-01-05 10:37

It states in the Python documentation that pickle is not secure and shouldn\'t parse untrusted user input. If you research this; almost all examples demonstrat

4条回答
  •  别那么骄傲
    2021-01-05 11:04

    Importing a module only adds it to the local namespace, which is not necessarily the one you're in. Except when it doesn't:

    >>> dir()
    ['__builtins__', '__doc__', '__name__', '__package__']
    >>> __import__('os')
    
    >>> dir()
    ['__builtins__', '__doc__', '__name__', '__package__']
    

提交回复
热议问题