Skip to content
Permalink
Browse files

Add func to filter sensitive query string keys

  • Loading branch information...
fundead
fundead committed Jun 24, 2014
1 parent 1e25d65 commit 1fb84aaed826ca92ea34f252d8f7b05ed24f6e2a
Showing with 1,720 additions and 16 deletions.
  1. +33 −3 dist/raygun.js
  2. +2 −2 dist/raygun.min.js
  3. +37 −8 dist/raygun.vanilla.js
  4. +1 −1 dist/raygun.vanilla.min.js
  5. +1,615 −0 raygun.js
  6. +32 −2 src/raygun.js
@@ -1,4 +1,4 @@
/*! Raygun4js - v1.8.4 - 2014-06-09
/*! Raygun4js - v1.9.0 - 2014-06-24
* https://github.com/MindscapeHQ/raygun4js
* Copyright (c) 2014 MindscapeHQ; Licensed MIT */
;(function(window, undefined) {
@@ -1190,11 +1190,13 @@ window.TraceKit = TraceKit;
_raygunApiKey,
_debugMode = false,
_allowInsecureSubmissions = false,
_ignoreAjaxAbort = false,
_enableOfflineSave = false,
_customData = {},
_tags = [],
_user,
_version,
_filteredKeys,
_raygunApiUrl = 'https://api.raygun.io',
$document;

@@ -1217,6 +1219,8 @@ window.TraceKit = TraceKit;
if (options)
{
_allowInsecureSubmissions = options.allowInsecureSubmissions || false;
_ignoreAjaxAbort = options.ignoreAjaxAbort || false;

if (options.debugMode)
{
_debugMode = options.debugMode;
@@ -1288,6 +1292,10 @@ window.TraceKit = TraceKit;
_enableOfflineSave = enableOffline;
}

return Raygun;
},
filterSensitiveData: function (filteredKeys) {
_filteredKeys = filteredKeys;
return Raygun;
}
};
@@ -1321,6 +1329,14 @@ window.TraceKit = TraceKit;
(jqXHR.statusText || 'unknown') +' '+
(ajaxSettings.type || 'unknown') + ' '+
(truncateURL(ajaxSettings.url) || 'unknown');

// ignore ajax abort if set in the options
if (_ignoreAjaxAbort) {
if (!jqXHR.getAllResponseHeaders()) {
return;
}
}

Raygun.send(thrownError || event.type, {
status: jqXHR.status,
statusText: jqXHR.statusText,
@@ -1444,7 +1460,21 @@ window.TraceKit = TraceKit;
forEach(window.location.search.substring(1).split('&'), function (i, segment) {
var parts = segment.split('=');
if (parts && parts.length === 2) {
qs[decodeURIComponent(parts[0])] = parts[1];
var key = decodeURIComponent(parts[0]);
var value = parts[1];

if (Array.prototype.indexOf && _filteredKeys.indexOf === Array.prototype.indexOf) {
if (_filteredKeys.indexOf(key) === -1) {
qs[key] = value;
}
} else {
for (i = 0; i < _filteredKeys.length; i++) {
if (_filteredKeys[i] === key) {
qs[key] = value;
}
}
}

}
});
}
@@ -1501,7 +1531,7 @@ window.TraceKit = TraceKit;
},
'Client': {
'Name': 'raygun-js',
'Version': '1.8.5'
'Version': '1.9.1'
},
'UserCustomData': finalCustomData,
'Tags': options.tags,

Large diffs are not rendered by default.

@@ -1125,13 +1125,14 @@ window.TraceKit = TraceKit;
_raygun = window.Raygun,
_raygunApiKey,
_debugMode = false,
_ignoreAjaxAbort = false,
_allowInsecureSubmissions = false,
_ignoreAjaxAbort = false,
_enableOfflineSave = false,
_customData = {},
_tags = [],
_user,
_version,
_filteredKeys,
_raygunApiUrl = 'https://api.raygun.io',
$document;

@@ -1153,8 +1154,8 @@ window.TraceKit = TraceKit;

if (options)
{
_ignoreAjaxAbort = options.ignoreAjaxAbort || false;
_allowInsecureSubmissions = options.allowInsecureSubmissions || false;
_ignoreAjaxAbort = options.ignoreAjaxAbort || false;

if (options.debugMode)
{
@@ -1227,6 +1228,10 @@ window.TraceKit = TraceKit;
_enableOfflineSave = enableOffline;
}

return Raygun;
},
filterSensitiveData: function (filteredKeys) {
_filteredKeys = filteredKeys;
return Raygun;
}
};
@@ -1351,12 +1356,22 @@ window.TraceKit = TraceKit;
}
}

function localStorageAvailable(){
try {
return ('localStorage' in window) && window['localStorage'] !== null;
} catch(e){
return false;
}
}

function sendSavedErrors() {
for (var key in localStorage) {
if (key.substring(0, 9) === 'raygunjs=') {
sendToRaygun(JSON.parse(localStorage[key]));
if (localStorageAvailable() && localStorage.length > 0) {
for (var key in localStorage) {
if (key.substring(0, 9) === 'raygunjs=') {
sendToRaygun(JSON.parse(localStorage[key]));

localStorage.removeItem(key);
localStorage.removeItem(key);
}
}
}
}
@@ -1381,7 +1396,21 @@ window.TraceKit = TraceKit;
forEach(window.location.search.substring(1).split('&'), function (i, segment) {
var parts = segment.split('=');
if (parts && parts.length === 2) {
qs[decodeURIComponent(parts[0])] = parts[1];
var key = decodeURIComponent(parts[0]);
var value = parts[1];

if (Array.prototype.indexOf && _filteredKeys.indexOf === Array.prototype.indexOf) {
if (_filteredKeys.indexOf(key) === -1) {
qs[key] = value;
}
} else {
for (i = 0; i < _filteredKeys.length; i++) {
if (_filteredKeys[i] === key) {
qs[key] = value;
}
}
}

}
});
}
@@ -1438,7 +1467,7 @@ window.TraceKit = TraceKit;
},
'Client': {
'Name': 'raygun-js',
'Version': '1.9.0'
'Version': '1.9.1'
},
'UserCustomData': finalCustomData,
'Tags': options.tags,

Large diffs are not rendered by default.

0 comments on commit 1fb84aa

Please sign in to comment.
You can’t perform that action at this time.