Skip to content

Commit

Permalink
feat: limit max num of files in zip
Browse files Browse the repository at this point in the history
  • Loading branch information
damikael committed Oct 25, 2023
1 parent be7cba7 commit 30b79b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions spid-validator/server/api/metadata-sp.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const config_dir = require('../../config/dir.json');
const config_idp = require("../../config/idp.json");
const config_test = require("../../config/test.json");
const moment = require('moment');

const ZIP_MAX_NUM_FILES = 100;

module.exports = function(app, checkAuthorisation, getEntityDir, database) {

Expand Down Expand Up @@ -221,6 +223,12 @@ module.exports = function(app, checkAuthorisation, getEntityDir, database) {

let metadata_list = [];
const files = Utility.readDir(getEntityDir(config_dir.TEMP));

if(files.length>ZIP_MAX_NUM_FILES) {
res.status(400).send(`Il pacchetto zip può contenere massimo ${ZIP_MAX_NUM_FILES} file`);
return;
}

const saveFilePromises = files.map(async (file) => {

Utility.log("CHECK METADATA FILE from ZIP: ", file);
Expand Down
2 changes: 1 addition & 1 deletion spid-validator/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spid-validator",
"version": "1.10.1",
"version": "1.10.2",
"description": "Tool for validating Service Provider compliance to SPID response from Identity Provider",
"main": "spid-validator",
"author": "Michele D'Amico (damikael) - AgID",
Expand Down

0 comments on commit 30b79b0

Please sign in to comment.