2020-06-30 12:50:28 +02:00
|
|
|
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[]
|
2021-09-20 15:38:42 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|