Skip to content

[FIX] Encode avatar url to prevent CSS injection - #6651

Merged
engelgabriel merged 1 commit into
developfrom
hotfix/encode-avatar-url
Apr 10, 2017
Merged

engelgabriel merged 1 commit into
developfrom
hotfix/encode-avatar-url

Conversation

@rodrigok

Copy link
Copy Markdown
Member

@RocketChat/core

@rodrigok
rodrigok requested a review from karlprieb April 10, 2017 19:29
@engelgabriel
engelgabriel temporarily deployed to rocket-chat-pr-6651 April 10, 2017 19:29 Inactive
{{else}}
<button class="thumb user-card-message" data-username="{{u.username}}" tabindex="1">
<div class="avatar">
<div class="avatar-image" style="background-image:url({{avatar}});"></div>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we save the URL encoded on the DB?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do this in the future, because we will need a migration to do that

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@engelgabriel I don't know now, cuz we save usernames there too, can be a problem

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do it in the client. The server should reject malformed messages with a proper error code.

@engelgabriel
engelgabriel merged commit 0dbff24 into develop Apr 10, 2017
@engelgabriel
engelgabriel deleted the hotfix/encode-avatar-url branch April 10, 2017 20:28

This branch was previously deployed

1 inactive deployment
rocket-chat-pr-6651 — e44e6125 Deployed Apr 10, 2017 by engelgabriel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants