forked from sheetjs/sheetjs
Fix for CVE-2023-30533 #1
15
test.js
15
test.js
@ -1769,6 +1769,21 @@ describe('invalid files', function() {
|
||||
wb.SheetNames.push(wb.SheetNames[0]);
|
||||
assert.throws(function() { X.write(wb, {type:'binary'}); });
|
||||
});
|
||||
it('should fail if sheet name is not valid', function() {
|
||||
var names = [
|
||||
"", // cannot be blank
|
||||
"abcdefghijklmnopqrstuvwxyz1234567890", // cannot exceed 31 chars
|
||||
"'sheetjs", "sheetjs'", // cannot start or end with apostrophe
|
||||
"History", // cannot be History
|
||||
"Sheet:JS", "Sheet]JS", "Sheet[JS", "Sheet*JS", // bad characters
|
||||
"Sheet?JS", "Sheet\\JS", "Sheet\/JS"
|
||||
];
|
||||
names.forEach(function(n) { assert.throws(function() {
|
||||
var wb = { SheetNames: [n], Sheets: {} };
|
||||
wb.Sheets[n] = X.utils.aoa_to_sheet([["SheetJS"]]);
|
||||
X.write(wb, {type:"binary", bookType:"xlsx"});
|
||||
}); });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user