fix(server): validate filename and emoji name to improve security
This commit is contained in:
parent
f599337320
commit
0d7256678e
2 changed files with 9 additions and 1 deletions
|
@ -81,6 +81,10 @@ export class ImportCustomEmojisProcessorService {
|
|||
|
||||
for (const record of meta.emojis) {
|
||||
if (!record.downloaded) continue;
|
||||
if (!/^[a-zA-Z0-9_]+?([a-zA-Z0-9\.]+)?$/.test(record.fileName)) {
|
||||
this.logger.error(`invalid filename: ${record.fileName}`);
|
||||
continue;
|
||||
}
|
||||
const emojiInfo = record.emoji;
|
||||
const emojiPath = outputPath + '/' + record.fileName;
|
||||
await this.emojisRepository.delete({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue