Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Allow SVG siteLogos to be specified as data: URIs #4181

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/static/dialog/js/modules/validate_rp_params.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ BrowserID.Modules.ValidateRpParams = (function() {
var dataMatches = null; // is this a valid data URI?
var outputLogoUri;
// Ideally we'd be loading this from a canonical constants library.
var imageMimeTypes = ['png', 'gif', 'jpg', 'jpeg', 'svg'];
var imageMimeTypes = ['png', 'gif', 'jpg', 'jpeg', 'svg+xml'];
// This regex converts valid input of the form:
// 'data:image/png;base64,iV...'
// into an array that looks like:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,17 @@
testExpectValidationFailure({siteLogo: URL});
});

asyncTest("get with data:image/svg+xml;... siteLogo - allowed", function() {
testExpectValidationSuccess({
siteLogo: "data:image/svg+xml;base64,FAKEDATA"
},
{
siteLogo: "data:image/svg+xml;base64,FAKEDATA"
}
);
});


Copy link
Contributor

Choose a reason for hiding this comment

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

Extra space I assume?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also wtf is with this new github comment style it's freaking me out

asyncTest("get with data:image/<whitelist>;... siteLogo - allowed", function() {
testExpectValidationSuccess({
siteLogo: "data:image/png;base64,FAKEDATA"
Expand All @@ -255,6 +266,11 @@
);
});

asyncTest("get with data:image/svg;... siteLogo - not allowed", function() {
var URL = "data:image/svg;base64,FAKEDATA";
testExpectValidationFailure({siteLogo: URL});
});

asyncTest("get with data:<not image>... siteLogo - not allowed", function() {
var URL = "data:text/html;base64,FAKEDATA";
testExpectValidationFailure({siteLogo: URL});
Expand Down