-
PROHARDVER!
JavaScript != Java (A JavaScript nem összekeverendő a Javával, két különböző programozási nyelvről van szó!)
Új hozzászólás Aktív témák
-
nevemfel
senior tag
válasz
Silεncε #9049 üzenetére
Igazad van, az innerHTML sem biztonságos:
There is one built-in safeguard in place, though. Just injecting a script element won’t expose you to attacks, because the section of the DOM you’re injecting into has already been parsed and run.
// This won't execute
var div = document.querySelector('#some-div');
div.innerHTML = '<script>alert("XSS Attack");</script>';
JavaScript that runs at a later time, though, will.
// This WILL run
div.innerHTML = '<script deferred>alert("XSS Attack");</script>';
// This will, too
div.innerHTML = '<img src=x onerror="alert(\'XSS Attack\')">';
Ez a megoldás viszont ígéretesnek tűnik:
If the third-party content is allowed to contain markup, a helper library like DOMPurify will remove any markup that’s not part of a secure whitelist before injecting it.
Új hozzászólás Aktív témák
- Intel Core i7-8700, i7-9700 CPU, processzor - Számla, garancia
- Xiaomi Redmi Note 14 Pro 256GB Kártyafüggetlen 1Év Garanciával
- Bomba ár! Fujitsu LifeBook U757 - i3-7GEN I 16GB I 256SSD I 15,6" FHD I HDMI I Cam I W11 I Garancia!
- ÁRGARANCIA! Épített KomPhone Ryzen 7 9800X3D 64GB RAM RTX 5090 32GB GAMER PC termékbeszámítással
- Eredeti, új Lenovo 330W töltők - ADL330SDC3A
Állásajánlatok
Cég: Promenade Publishing House Kft.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest