Skip to content
This repository was archived by the owner on Dec 6, 2018. It is now read-only.

Commit 284aad8

Browse files
committed
Resolved vulnerability with using unsanitized strings
1 parent dbbd24b commit 284aad8

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,6 @@ This package lives in the npm index.
5151

5252
**Current builds are not working on Windows ([#261](https://github.com/googlevr/vrview/issues/261))**
5353

54-
Relevant commands:
55-
```shell
56-
$ npm run build # builds the iframe embed and JS API (full and minified versions).
57-
58-
# Building
59-
60-
This project uses `browserify` to manage dependencies and build. `watchify` is
61-
especially convenient to preserve the write-and-reload model of development.
62-
This package lives in the npm index.
63-
6454
Relevant commands:
6555
```shell
6656
$ npm run build # builds the iframe embed and JS API (full and minified versions).
@@ -77,3 +67,7 @@ $ npm run watch-api # auto-builds the JS API code whenever any source changes.
7767
```
7868
As of 2017/06/13, the pre-built js artifacts have been removed from source
7969
control. You must run `npm run build` prior to trying any of the examples.
70+
71+
# Release Notes
72+
## 2.0.2
73+
Close vulnerability with unsanitized user strings being injected into DOM

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vrview",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "Embed VR content into your webpage.",
55
"main": "index.js",
66
"dependencies": {

src/embed/main.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,20 @@ function onRenderError(message) {
300300
showError('Render: ' + message);
301301
}
302302

303-
function showError(message, opt_title) {
303+
function showError(message) {
304304
// Hide loading indicator.
305305
loadIndicator.hide();
306306

307+
// Sanitize `message` as it could contain user supplied
308+
// values. Re-add the space character as to not modify the
309+
// error messages used throughout the codebase.
310+
message = encodeURI(message).replace(/%20/g, ' ');
311+
307312
var error = document.querySelector('#error');
308313
error.classList.add('visible');
309314
error.querySelector('.message').innerHTML = message;
310315

311-
var title = (opt_title !== undefined ? opt_title : 'Error');
312-
error.querySelector('.title').innerHTML = title;
316+
error.querySelector('.title').innerHTML = 'Error';
313317
}
314318

315319
function hideError() {

src/embed/scene-info.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ function SceneInfo(opt_params) {
4242
muted: opt_params.muted
4343
};
4444

45-
this.image = params.image;
46-
this.preview = params.preview;
47-
this.video = params.video;
45+
this.image = params.image !== undefined ? encodeURI(params.image) : undefined;
46+
this.preview = params.preview !== undefined ? encodeURI(params.preview) : undefined;
47+
this.video = params.video !== undefined ? encodeURI(params.video) : undefined;
4848
this.defaultYaw = THREE.Math.degToRad(params.defaultYaw || 0);
4949

5050
this.isStereo = Util.parseBoolean(params.isStereo);

0 commit comments

Comments
 (0)