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

Conversation

@chrismwendt
Copy link
Contributor

Generated using:

cat package.json | jq --argjson icon "$(echo -n "data:image/png;base64,$(base64 < icon.png)" | jq -R -s .)" ".icon = \$icon" > package.json

Alternatively, this could be added during sourcegraph:prepublish. Pros/cons:

  • Pro: doesn't bloat package.json
  • Con: icon field not visible when viewing package.json in git
  • Con: no longer searchable

@felixfbecker
Copy link
Contributor

Does only data PNG work? http + SVG works for buttons:

"iconURL": "https://raw.githubusercontent.com/remojansen/logo.ts/5b4f0df433a5301aee0180582a8782bfbc9a0739/ts.svg?sanitize=true",

@chrismwendt
Copy link
Contributor Author

chrismwendt commented Aug 11, 2019

I think only data:image/png is allowed:

https://github.com/sourcegraph/sourcegraph/blob/758655e2777a096b00126d7a2c6e99d1ac02a168/web/src/extensions/ExtensionCard.tsx#L62-L64

                                /^data:image\/png(;base64)?,/.test(manifest.icon) && (
                                    <img className="extension-card__icon mr-2" src={manifest.icon} />
                                )}

@chrismwendt
Copy link
Contributor Author

IIRC we disallowed SVG because SVG can contain malicious code https://www.redteamsecure.com/evil-svg-project/ (which can be sanitized https://www.npmjs.com/package/@mattkrick/sanitize-svg but that's a separate issue).

@chrismwendt chrismwendt merged commit ff85c73 into master Aug 11, 2019
@chrismwendt chrismwendt deleted the icon branch August 11, 2019 19:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants