Security Risks
Special care must be taken when using eval with data from an untrusted source. For instance, assuming that the get_data function gets data from the Internet, this Python code is insecure:
An attacker could supply the program with the string "session.update(authenticated=True)" as data, which would update the session dictionary to set an authenticated key to be True. To remedy this, all data which will be used with eval must be escaped, or it must be run without access to potentially harmful functions.
Read more about this topic: Eval
Famous quotes containing the words security and/or risks:
“The three great ends which a statesman ought to propose to himself in the government of a nation, are,1. Security to possessors; 2. Facility to acquirers; and, 3. Hope to all.”
—Samuel Taylor Coleridge (17721834)
“The amount of it is, if a man is alive, there is always danger that he may die, though the danger must be allowed to be less in proportion as he is dead-and-alive to begin with. A man sits as many risks as he runs.”
—Henry David Thoreau (18171862)