
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
79 lines
1.5 KiB
Plaintext
79 lines
1.5 KiB
Plaintext
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
|
|
----
|
|
|
|
Function ``++fileinput.input++`` and class ``++fileinput.FileInput++`` read the standard input when the list of files is empty.
|
|
|
|
----
|
|
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[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|