Giter Site home page Giter Site logo

robinloeffel / cosha Goto Github PK

View Code? Open in Web Editor NEW
987.0 11.0 19.0 1.21 MB

Colorful shadows for your images. ๐ŸŽจ

Home Page: https://robinloeffel.github.io/cosha

License: MIT License

JavaScript 3.17% TypeScript 96.83%
browser images shadows dom css-filters colorful-shadows css

cosha's Introduction

cosha's People

Contributors

robinloeffel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cosha's Issues

Potential XSS issue in the stylesheets

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.

How does this work?

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!

Hide background image for screen readers

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.