From 35fed418d1fb62e96e35f24578294bd54c5b65ca Mon Sep 17 00:00:00 2001 From: jjikky Date: Mon, 15 Jul 2024 11:20:58 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=94=A5=20userRouter=20=EC=9E=98?= =?UTF-8?q?=EB=AA=BB=EB=93=A4=EC=96=B4=EA=B0=84=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/user/user.route.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/routes/user/user.route.js b/src/routes/user/user.route.js index 09aed0c..1e7b620 100644 --- a/src/routes/user/user.route.js +++ b/src/routes/user/user.route.js @@ -44,7 +44,6 @@ userRouter.delete('/:searchTerm', isLoggedIn, delRecentSearch); // 최근 검색 //등록 요청 userRouter.post('/requests/:nickname/new', isLoggedIn, postWords); -module.exports = userRouter; // 요청 조회 userRouter.get('/requests', isLoggedIn, UserRequests); // 요청 목록 조회 userRouter.get('/requests/all', isLoggedIn, UserRequestsAll); // 모든 요청 목록 조회 From e5243839d10f6c923d39f65a9ece157eeb4f74d5 Mon Sep 17 00:00:00 2001 From: jjikky Date: Mon, 15 Jul 2024 11:21:23 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=8A=20api=20=EC=93=B0=EB=A1=9C?= =?UTF-8?q?=ED=8B=80=EB=A7=81=20TODO=20=EB=A1=9C=EA=B7=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/utils/rateLimit.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/utils/rateLimit.js b/src/common/utils/rateLimit.js index b29fdf9..4ebdda8 100644 --- a/src/common/utils/rateLimit.js +++ b/src/common/utils/rateLimit.js @@ -15,12 +15,13 @@ exports.postApiLimiter = rateLimit({ exports.commonLimiter = rateLimit({ windowMs: 60 * 1000, // 1분 간격 + // TODO : 100으로 줄이기 max: 1000, // windowMs동안 최대 호출 횟수 handler(req, res) { // 제한 초과 시 콜백 함수 res.status(this.statusCode).json({ code: this.statusCode, // statusCode 기본값은 429 - message: '1분에 50번만 요청 할 수 있습니다.', + message: '1분에 100번만 요청 할 수 있습니다.', }); }, }); From fb071975a6629d85fa50a8d0484ad6cef151d295 Mon Sep 17 00:00:00 2001 From: jjikky Date: Mon, 15 Jul 2024 22:04:05 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=ED=9A=8C=EC=9B=90?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20:=20=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83?= =?UTF-8?q?=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/user/user.controller.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/routes/user/user.controller.js b/src/routes/user/user.controller.js index a1f4aea..fdd6519 100755 --- a/src/routes/user/user.controller.js +++ b/src/routes/user/user.controller.js @@ -360,6 +360,17 @@ exports.updateRequestState = async (req, res) => { exports.deleteUser = async (req, res) => { try { + const refreshToken = req.cookies.refreshToken; + if (refreshToken) { + try { + const email = req.user.email; + await redisClient.del(email); + } catch (err) { + console.error('Redis error:', err); + } + } + res.clearCookie('refreshToken', config.cookieInRefreshTokenDeleteOptions); + const { _id } = req.user; await wordService.deleteWordContributor(_id); await userService.deleteUser(_id); From 88ebadd384d85e68eef40f5548ccddd32ce439d8 Mon Sep 17 00:00:00 2001 From: jjikky Date: Mon, 15 Jul 2024 22:32:14 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20eb=20=ED=97=AC?= =?UTF-8?q?=EC=8A=A4=EC=B2=B4=ED=81=AC=20origin=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/modules/express/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/common/modules/express/index.js b/src/common/modules/express/index.js index e67048a..03eee00 100644 --- a/src/common/modules/express/index.js +++ b/src/common/modules/express/index.js @@ -37,10 +37,14 @@ module.exports = expressLoader = (app) => { origin: (origin, callback) => { if ( // whitelist에 있는 origin 허용 - (origin && conf.corsWhiteList.indexOf(origin) !== -1) || - // postman 허용 - (!origin && - conf.corsUserAgent.split(',').some((agent) => req.headers['user-agent'].includes(agent))) + origin === undefined || + conf.corsWhiteList.indexOf(origin) !== -1 + // NOTE : EB Health Check도 origin undefind라 거부 당해서 임시 주석처리 + // // whitelist에 있는 origin 허용 + // (origin && conf.corsWhiteList.indexOf(origin) !== -1) || + // // postman 허용 + // (!origin && + // conf.corsUserAgent.split(',').some((agent) => req.headers['user-agent'].includes(agent))) ) { return callback(null, true); }