2020-06-30 14:41:58 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
|
|
|
|
== Sensitive Code Example
|
|
|
|
|
|
|
|
Python 2 and Python 3
|
|
|
|
|
|
|
|
----
|
|
|
|
import sys
|
|
|
|
from sys import stdin, __stdin__
|
|
|
|
|
|
|
|
# Any reference to sys.stdin or sys.__stdin__ without a method call is Sensitive
|
|
|
|
sys.stdin # Sensitive
|
|
|
|
|
|
|
|
for line in sys.stdin: # Sensitive
|
|
|
|
print(line)
|
|
|
|
|
|
|
|
it = iter(sys.stdin) # Sensitive
|
|
|
|
line = next(it)
|
|
|
|
|
|
|
|
# Calling the following methods on stdin or __stdin__ is sensitive
|
|
|
|
sys.stdin.read() # Sensitive
|
|
|
|
sys.stdin.readline() # Sensitive
|
|
|
|
sys.stdin.readlines() # Sensitive
|
|
|
|
|
|
|
|
# Calling other methods on stdin or __stdin__ does not require a review, thus it is not Sensitive
|
|
|
|
sys.stdin.seekable() # Ok
|
|
|
|
# ...
|
|
|
|
----
|
|
|
|
|
|
|
|
Python 2 only
|
|
|
|
|
|
|
|
----
|
|
|
|
raw_input('What is your password?') # Sensitive
|
|
|
|
----
|
|
|
|
|
|
|
|
Python 3 only
|
|
|
|
|
|
|
|
----
|
|
|
|
input('What is your password?') # Sensitive
|
|
|
|
----
|
|
|
|
|
2021-01-27 13:42:22 +01:00
|
|
|
Function ``++fileinput.input++`` and class ``++fileinput.FileInput++`` read the standard input when the list of files is empty.
|
2020-06-30 14:41:58 +02:00
|
|
|
|
|
|
|
----
|
|
|
|
for line in fileinput.input(): # Sensitive
|
|
|
|
print(line)
|
|
|
|
|
|
|
|
for line in fileinput.FileInput(): # Sensitive
|
|
|
|
print(line)
|
|
|
|
|
|
|
|
for line in fileinput.input(['setup.py']): # Ok
|
|
|
|
print(line)
|
|
|
|
|
|
|
|
for line in fileinput.FileInput(['setup.py']): # Ok
|
|
|
|
print(line)
|
|
|
|
----
|
|
|
|
|
|
|
|
include::../see.adoc[]
|
2021-06-02 20:44:38 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
2021-09-20 15:38:42 +02:00
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2021-06-02 20:44:38 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|
2023-06-22 10:38:01 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|