robinloeffel / cosha Goto Github PK
View Code? Open in Web Editor NEWColorful shadows for your images. ๐จ
Home Page: https://robinloeffel.github.io/cosha
License: MIT License
Colorful shadows for your images. ๐จ
Home Page: https://robinloeffel.github.io/cosha
License: MIT License
First of all I must thank you for learning me an awesome trick that I didn't know about =)
I noticed that you are inserting the style tag as raw HTML with potentially unescaped parameters. Granted it is not likely this will be exploitable since the web page will need to allow users to set the class name, or any of the drop shadow parameters for this to be exploitable, but it is also relatively simple to fix it.
The fix is replacing
document.head.insertAdjacentHTML('beforeend', `<style>
styles here...
</style>`);
with
const styles = document.createElement('style');
styles.textContent = `
styles here...
`;
document.head.appendChild(styles);
I have attached a JSfiddle here which shows how you can exploit it... Just hit the submit button and you will get an alert.
Simply applying it to a div that has style background-image does nothing or could interfer because it wrapps it with a div and class.
I am impressed with how tiny the code is - and I see that a clone of the image is made and then some CSS is applied to it - which I do not understand.
Would it be possible to add a "How it works?" section to the readme? That would be very educational... Thanks for this!
Because this library is duplicating the node, a screen reader would pass over both the images and repeat the callout. Therefore you need to add the attribute 'aria-hidden' on the background image.
clone.setAttribute('aria-hidden', 'true');
If you open up PR's I can create one, if not I have implemented it on vue-cosha if you want to copy it over!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.