Skip to content
This repository was archived by the owner on Jul 8, 2022. It is now read-only.
This repository was archived by the owner on Jul 8, 2022. It is now read-only.

XSS Vulnerable - create archive of locally available CSS themes. #85

Open
@dambrogia

Description

@dambrogia

As you willingly inject a remote script into your slack app, you are vulnerable to XSS.

const cssPath = 'https://cdn.rawgit.com/widget-/slack-black-theme/master/custom.css';
let cssPromise = fetch(cssPath).then(response => response.text());

Realistically, I have no idea what is in that CSS file when my slack app starts. Since it loads every time I open slack (usually daily) if someone were to update that css file to something malicious, all of us would be screwed and theoretically they could be reading all of our messages that are sent.

Additionally, as slack versions change and CSS needs to update per version, it would be helpful to have an archive of readily available themes for that version of slack rather than hunt through the issues for people who have fixed it, but have no where to add their contributions within the repo.

Solutions:

  1. Tear down the CSS locally and do a good ole fashioned hardcoded const css = '<css string>';.

  2. Clone the archive directly in the resources\app.asar.unpacked\src\static directory and do something to the extent of:

    const css = require('./themes/my-theme.css');

  3. IMO this would be the correct solution (if possible) and adds on from step 2. Create an npm package that you can add to the main package.json of slack and by adding as single function call (ex: addTheme('my-theme.css', cssOverwrites);) with a function that will take two parameters: one to declare the css theme you want to use, and and the second to declare any :root {} overwrites you want to prepend.

  • This would resolve the XSS vulnerability of having no control of what is fetched in the remote script every time you log into your slack app.
  • It would allow for multiple people to create their own themes for slack.
  • And this also would be a seamless way to incorporate this for slack if they ever decide to provide the public with a dark theme. (It's been 4 years, pigs might fly before they give us what we want).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions