29 lines
515 B
Plaintext
29 lines
515 B
Plaintext
![]() |
include::../description.adoc[]
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
----
|
||
|
from flask import request, current_app
|
||
|
import logging
|
||
|
|
||
|
@app.route('/log')
|
||
|
def log():
|
||
|
input = request.args.get('input')
|
||
|
current_app.logger.error("%s", input) # Noncompliant
|
||
|
----
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
from flask import request, current_app
|
||
|
import logging
|
||
|
|
||
|
@app.route('/log')
|
||
|
def log():
|
||
|
input = request.args.get('input')
|
||
|
if input.isalnum():
|
||
|
current_app.logger.error("%s", input) # Compliant
|
||
|
----
|
||
|
|
||
|
include::../see.adoc[]
|