Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix XSS vulnerability #525

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 9 additions & 5 deletions angucomplete-alt.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
' <img ng-if="result.image && result.image != \'\'" ng-src="{{result.image}}" class="angucomplete-image"/>' +
' <div ng-if="!result.image && result.image != \'\'" class="angucomplete-image-default"></div>' +
' </div>' +
' <div class="angucomplete-title" ng-if="matchClass" ng-bind-html="result.title"></div>' +
' <div class="angucomplete-title" ng-if="matchClass" ng-bind="result.title"></div>' +
' <div class="angucomplete-title" ng-if="!matchClass">{{ result.title }}</div>' +
' <div ng-if="matchClass && result.description && result.description != \'\'" class="angucomplete-description" ng-bind-html="result.description"></div>' +
' <div ng-if="matchClass && result.description && result.description != \'\'" class="angucomplete-description" ng-bind="result.description"></div>' +
' <div ng-if="!matchClass && result.description && result.description != \'\'" class="angucomplete-description">{{result.description}}</div>' +
' </div>' +
' </div>' +
Expand Down Expand Up @@ -227,7 +227,7 @@
matches = target.match(re);
if (matches) {
result = target.replace(re,
'<span class="'+ scope.matchClass +'">'+ matches[0] +'</span>');
matches[0]);
}
else {
result = target;
Expand Down Expand Up @@ -688,6 +688,10 @@
};

scope.selectResult = function(result) {
console.log('result ', result);
console.log('scope matchClass', scope.matchClass);
console.log('scope clearSelected', scope.clearSelected);
console.log('scope ', scope);
// Restore original values
if (scope.matchClass) {
result.title = extractTitle(result.originalObject);
Expand Down Expand Up @@ -830,10 +834,10 @@
var startSym = $interpolate.startSymbol();
var endSym = $interpolate.endSymbol();
if (!(startSym === '{{' && endSym === '}}')) {
var interpolatedHtml = tElement.html()
var interpolatedHtml = tElement.text()
.replace(/\{\{/g, startSym)
.replace(/\}\}/g, endSym);
tElement.html(interpolatedHtml);
tElement.text(interpolatedHtml);
}
return link;
}
Expand Down
Loading