Files
rpa_vision_v3/test_debug_input_validation.py
Dom a27b74cf22 v1.0 - Version stable: multi-PC, détection UI-DETR-1, 3 modes exécution
- Frontend v4 accessible sur réseau local (192.168.1.40)
- Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard)
- Ollama GPU fonctionnel
- Self-healing interactif
- Dashboard confiance

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:23:51 +01:00

121 lines
4.0 KiB
Python

)orrectly!"ng c is workisystemtion t valida Inpunt("\nit(1)
pri sys.ex)
.print_exc(ack traceb
aceback trport}")
imr: {eErroprint(f"❌ s e:
n atioexcept Excep)
="here. == elsewsue ising! The is tests work\n=== All print(")
essful"ution succtest execanual " M
print(
ection()l_injg_sqrinidate_sttest_valce._instan test)
sic(string_bavalidate_tance.test_t_insd()
tes_methosetupe.instanc test_or()
datpleInputVali= TestSimnstance est_iy
tlass manuallthe cst # Te
ly")
sfulined success def"✅ Test clas print(
.errors)r in resultr error fo" in errojectiony("SQL insert an ass_valid
ot result.i assert n
; --")rsseROP TABLE u'; Dng("ate_strior.validself.validatresult = n(self):
sql_injectiostring__validate_stf te de
o world"
e == "hellalunitized_vult.sa ressert asalid
s_vesult.i assert r )
lo world"g("helate_strintor.validelf.valida = s result self):
sic(_bae_stringest_validatdef t
True)e=odt_mtriclidator(sInputVa = Simpleidatoralf.v sel f):
sel_method(tup def ser:
tValidatompleInpuclass TestSi
")
..ation.test integrting py Tes"\nStep 2:int(
prnioegratt int test pytes # Now)
"! === passed basic tests"\n=== All
print( assed")
ation test ptiz HTML sani"✅t( prinlue
ed_vaanitizresult.sn " it;script&gt;assert "&l
_validrt result.is asset>')
scrip("xss")</pt>alertscring('<lidate_striidator.vavalsult = re tization
HTML sani: Test 3 # d")
est passetion t SQL injecint(" prlid
va result.is_rt not
asse; --")ersP TABLE usg("'; DROate_strinalid validator.v =ult
resoninjectiQL St 2: # Tes
ssed")nput test palid i" Varint( p
dis_valit result. asserorld")
"hello we_string(idattor.valult = valida
reslid input Va1:st
# Teue)
=Trodetrict_malidator(sputV SimpleIn =atorid
valalidatorest the v
# T ")
ccessfullysud inetor defalidaimpleInputV Sint("✅ pr
nings)
s, warized, errord, sanits_valit(iesullidationR return Va
errors) == 0en(= llid is_va
tized)
sanipe(= html.escad sanitize ow_html:
if not all L
HTMe Sanitiz #
)
rn"patteinjection tential SQL pons me} contaild_naf"{fiend(appes. error
rict_mode:.st if self :
h(value)ern.searc patt if rns:
l_patte in self._sqtternfor pa ons
ectiheck SQL inj # C
arnings)
, errors, walse, Nonesult(FValidationRern retu
) string" a bee} mustnamd_d(f"{fielrors.appen er
ue, str):ce(valisinstanif not
alue
ed = v sanitiz ings = []
warn []
= rs erro lt:
ationResu -> Validt")r = "inpueld_name: st= False, fi_html: bool llow a
nt = 1000, _length: ir, maxf, value: ste_string(sel validat
def TERNS]
ION_PAT_INJECT in self.SQLfor patternE) CASREre.IGNOn, (patter[re.compilepatterns = elf._sql_ s e
strict_mod_mode = f.strict sel ):
= True boolstrict_mode:, elf(s_init__ def _
]
";])"
([\'\ r",
ECUTE)\b)"EXR|EXEC|ATE|ALTEE|DROP|CRELETRT|UPDATE|DET|INSE(\b(SELEC r"[
NS = TERTION_PATSQL_INJECr:
nputValidatoass SimpleI
clpass
ion):
(ExceptationErrorlidInputVaclass
s: List[str]arning wt[str]
ors: Lis errny
ue: Ad_val sanitizel
id: boo is_val:
sultdationReValiss claataclass
@dtaclass
s import da dataclasse
fromst, Optionaly, LiAnimport ping m tyson
frore, html, j import os, ly
r directdatoputValiIn the Simple # Test)
onality..."ctifunng basic Testi: p 1print("Ste
")
try: ===tsTeslidation Vaut g Inp== Debuggin"=
print(cwd()))
, str(Path.h.insert(0h
sys.pat import Patfrom pathlibys
ort s"""
imp issue.
on testt validatipuinthe o isolate tript
Debug sc"""python3
nv n/esr/bi!/u#