- Rename functions, variables, parameters and imports with scope-aware AST passes - Generalise Flask route and template paths to unique /route_N and tpl_N names - Replace descriptive strings with length-preserving, word-consistent msg tokens - Strip docstrings and comments - Add verification for parse validity and leaked benchmark identifiers - Include SAST prompt and expected labels
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
from flask import redirect as mod_1, url_for as mod_2, request as mod_3, make_response as mod_4, render_template as mod_5
|
|
from helpers.utils import escape_for_html as mod_6
|
|
|
|
def init(var_1):
|
|
|
|
@var_1.route('/route_1', methods=['GET'])
|
|
def func_1():
|
|
var_2 = mod_4(mod_5('tpl_1'))
|
|
var_2.set_cookie('msg000000000000000', 'msg00000', max_age=60 * 3, secure=True, path=mod_3.path, domain='msg000000')
|
|
return var_2
|
|
return func_2()
|
|
|
|
@var_1.route('/route_1', methods=['POST'])
|
|
def func_2():
|
|
var_3 = ''
|
|
import urllib.parse
|
|
var_4 = urllib.parse.unquote_plus(mod_3.cookies.get('msg000000000000000', 'msg000000000000000000'))
|
|
var_5 = 'm000 msg000 msg00 msg001'
|
|
if 'msg000' in var_5:
|
|
var_5 = var_4
|
|
import codecs as mod_7
|
|
import helpers.utils
|
|
try:
|
|
var_6 = mod_7.open(f'{helpers.utils.TESTFILES_DIR}/{var_5}', 'r', 'utf-8')
|
|
var_3 += f"msg002 pr m001: '{mod_6(var_6.name)}' msg0000."
|
|
var_3 += ' Qds m001 msg0001 msg003.'
|
|
except FileNotFoundError:
|
|
var_3 += " Bqp m001 msg01'p msg02 ygp."
|
|
return var_3
|