Skip to content

Commit

Permalink
Fix possible XSS via repo branch
Browse files Browse the repository at this point in the history
  • Loading branch information
buunguyen committed Jun 13, 2016
1 parent 04f879c commit 3bf37ea
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
@@ -1,3 +1,7 @@
### v2.0.11
* Encode branch before displaying to avoid XSS
* Fix bug project ID not retrieved in latest GitLab layout

### v2.0.10
* Retain forward slashes in URLs
* Improve behavior of middle-click
Expand Down
Binary file modified dist/chrome.crx
Binary file not shown.
Binary file modified dist/chrome.zip
Binary file not shown.
Binary file modified dist/firefox.xpi
Binary file not shown.
Binary file modified dist/opera.nex
Binary file not shown.
Binary file modified dist/safari.safariextz
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "octotree",
"version": "2.0.10",
"version": "2.0.11",
"description": "Code tree for GitHub and GitLab",
"main": "inject.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/config/chrome/manifest.json
@@ -1,6 +1,6 @@
{
"name": "Octotree",
"version": "2.0.10",
"version": "2.0.11",
"manifest_version": 2,
"author": "Buu Nguyen",
"description": "Code tree for GitHub and GitLab",
Expand Down
2 changes: 1 addition & 1 deletion src/config/firefox/package.json
Expand Up @@ -9,7 +9,7 @@
"icon": "resource://jid1-Om7eJGwA1U8Akg-at-jetpack/data/icons/icon48.png",
"icon64": "resource://jid1-Om7eJGwA1U8Akg-at-jetpack/data/icons/icon64.png",
"license": "MIT",
"version": "2.0.10",
"version": "2.0.11",
"permissions": {
"cross-domain-content": ["https://api.github.com", "https://github.com", "https://gitlab.com"],
"private-browsing": true
Expand Down
4 changes: 2 additions & 2 deletions src/config/safari/Info.plist
Expand Up @@ -13,9 +13,9 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>2.0.10</string>
<string>2.0.11</string>
<key>CFBundleVersion</key>
<string>2.0.10</string>
<string>2.0.11</string>
<key>Chrome</key>
<dict/>
<key>Content</key>
Expand Down
6 changes: 5 additions & 1 deletion src/view.tree.js
Expand Up @@ -59,7 +59,7 @@ class TreeView {
'<a data-pjax href="/' + repo.username + '/' + repo.reponame + '">' + repo.reponame +'</a>' +
'</div>' +
'<div class="octotree_header_branch">' +
repo.branch +
this._deXss(repo.branch) +
'</div>'
)
.on('click', 'a[data-pjax]', function (event) {
Expand All @@ -68,6 +68,10 @@ class TreeView {
})
}

_deXss(str) {
return str && str.replace(/[<>'"&]/g, '-')
}

_sort(folder) {
folder.sort((a, b) => {
if (a.type === b.type) return a.text === b.text ? 0 : a.text < b.text ? -1 : 1
Expand Down

0 comments on commit 3bf37ea

Please sign in to comment.