Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]: User Snippets #1722

Open
G-Ambatte opened this issue Sep 30, 2021 · 6 comments
Open

[FEATURE]: User Snippets #1722

G-Ambatte opened this issue Sep 30, 2021 · 6 comments
Labels

Comments

@G-Ambatte
Copy link
Collaborator

From the subreddit today (https://www.reddit.com/r/homebrewery/comments/pyg427/your_own_code_snippets): a suggestion for Users to be able to add their own custom Snippets to the SnippetBar.

I suspect that this would be an ideal use case for the UserInfo framework.

@5e-Cleric 5e-Cleric changed the title Feature Suggestion: User Snippets [FEATURE]: User Snippets Jan 16, 2024
@dbolack-ab
Copy link
Collaborator

I have seen a lot of concern about exploits via remote CSS, etc. Should not the same concerns apply here? Even without snippet sharing it seems precarious.

@5e-Cleric
Copy link
Member

5e-Cleric commented Jan 17, 2024

As user snippets' CSS are scoped to the document iframe, there is no possibility of a CSS exfiltration or other kind of exploit. There is no data to steal apart from the url for our stylesheets, which is open anyway.

So that css would not touch the Homebrewery, just the rendered iframe.

@ericscheid
Copy link
Collaborator

ericscheid commented Jan 17, 2024

If a script is executed within the brew's preview iframe, then that script has access to both cookies and localStorage. The user's authentication is stored in a cookie. (Tested by hand-writing a <button> inside the preview iframe via the Inspector).

That said, I don't know in which context the script runs — is it the css file, is it the iframe, is it the exploit .htc pr .xbl file?

I don't know, and I really don't want us to find out the hard way.

https://stackoverflow.com/questions/476276/using-javascript-in-css

@5e-Cleric
Copy link
Member

But we sanitize the CSS and markdown anyway, this css or markdown for the user snippets is not a bigger vulnerability than the style tab itself!

@dbolack-ab
Copy link
Collaborator

I'm going to suggest we not touch this issue but users can do so with TamperMonkey. We can even go so far as to build a usable framework stub.

@dbolack-ab
Copy link
Collaborator

This should be covered adequately by #3870 once complete unless dynamic snippets are absolutely required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants