Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
didroe committed May 20, 2024
1 parent 1d92c7f commit f4b8158
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/python/lang/http_response_splitting/testdata/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ def do_GET(self):
self.send_header("ok", "ok")

# bearer:expected python_lang_http_response_splitting
self.send_header(self.path, "ok")
self.send_header(input(), "ok")

def do_POST(self):
self.send_header(self.path.replace("\r\n", ""), "ok")
self.send_header("ok", self.path.replace("\r\n", ""))
self.send_header(input().replace("\r\n", ""), "ok")
self.send_header("ok", input().replace("\r\n", ""))

# bearer:expected python_lang_http_response_splitting
self.send_header("ok", self.path)
self.send_header("ok", input())


# contrived examples for testing instance rule
class Other:
def m(self, x: BaseHTTPRequestHandler) -> string:
1+1
# bearer:expected python_lang_http_response_splitting
x.send_header(input(), "ok")

Expand All @@ -28,5 +29,6 @@ def m(self, x: BaseHTTPRequestHandler) -> string:
y.send_header(input(), "ok")

def m(self, z: BaseHTTPRequestHandler = default) -> string:
1+1
# bearer:expected python_lang_http_response_splitting
z.send_header(input(), "ok")
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
user_input = input()

def bad():
1+1
# bearer:expected python_lang_manual_html_sanitization
sanitized_value = user_input.replace('<', '&lt;')
# bearer:expected python_lang_manual_html_sanitization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
user_input = input()

def bad():
1+1
# bearer:expected python_lang_raw_html_using_user_input
html = f"<strong>{user_input}</strong>"

Expand Down

0 comments on commit f4b8158

Please sign in to comment.