mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Escape input, fixes #3990
This commit is contained in:
parent
cf3d9d26fa
commit
f6ce49b586
2
public/v1/js/create_transaction.js
vendored
2
public/v1/js/create_transaction.js
vendored
File diff suppressed because one or more lines are too long
2
public/v1/js/edit_transaction.js
vendored
2
public/v1/js/edit_transaction.js
vendored
File diff suppressed because one or more lines are too long
@ -135,7 +135,17 @@ export default {
|
||||
aSyncFunction: function (query, done) {
|
||||
axios.get(this.accountAutoCompleteURI + query)
|
||||
.then(res => {
|
||||
done(res.data);
|
||||
// loop over data
|
||||
let escapedData = [];
|
||||
let current;
|
||||
for (const key in res.data) {
|
||||
if (res.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
|
||||
current = res.data[key];
|
||||
current.description = this.escapeHtml(res.data[key].description)
|
||||
escapedData.push(current);
|
||||
}
|
||||
}
|
||||
done(escapedData);
|
||||
})
|
||||
.catch(err => {
|
||||
// any error handler
|
||||
|
@ -94,7 +94,17 @@ export default {
|
||||
aSyncFunction: function (query, done) {
|
||||
axios.get(this.categoryAutoCompleteURI + query)
|
||||
.then(res => {
|
||||
done(res.data);
|
||||
// loop over data
|
||||
let escapedData = [];
|
||||
let current;
|
||||
for (const key in res.data) {
|
||||
if (res.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
|
||||
current = res.data[key];
|
||||
current.description = this.escapeHtml(res.data[key].description)
|
||||
escapedData.push(current);
|
||||
}
|
||||
}
|
||||
done(escapedData);
|
||||
})
|
||||
.catch(err => {
|
||||
// any error handler
|
||||
|
@ -83,12 +83,41 @@ export default {
|
||||
aSyncFunction: function (query, done) {
|
||||
axios.get(this.descriptionAutoCompleteURI + query)
|
||||
.then(res => {
|
||||
done(res.data);
|
||||
|
||||
// loop over data
|
||||
let escapedData = [];
|
||||
let current;
|
||||
for (const key in res.data) {
|
||||
if (res.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
|
||||
current = res.data[key];
|
||||
current.description = this.escapeHtml(res.data[key].description)
|
||||
escapedData.push(current);
|
||||
}
|
||||
}
|
||||
done(escapedData);
|
||||
})
|
||||
.catch(err => {
|
||||
// any error handler
|
||||
})
|
||||
},
|
||||
escapeHtml: function (string) {
|
||||
|
||||
let entityMap = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
'/': '/',
|
||||
'`': '`',
|
||||
'=': '='
|
||||
};
|
||||
|
||||
return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap(s) {
|
||||
return entityMap[s];
|
||||
});
|
||||
|
||||
},
|
||||
search: function (input) {
|
||||
return ['ab', 'cd'];
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user