HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
프로그래머스 프론트엔드 데브코스 2기
프로그래머스 프론트엔드 데브코스 2기
/
📓
기동팀
/
💪
기동팀(CheQuiz)
/
📝
07.14 Strapi 공동작업 기록
📝

07.14 Strapi 공동작업 기록

TODO

API명세서 v2에 나와있는 대로 테스트
heroku?
Quizzes, QuizPack, Like, Comments

이슈

이슈1

⚠️ quiz-packs get 요청 시 user 객체 내부 민감 정보까지 전부 api에 노출됨
  • sanitize로 민감 정보를 처리하려고 하였으나, sanitize로 처리 시 1뎁스의 컨텐츠만 처리되는 문제가 존재
✅ 해결
[ 첫 번째 시도 ]
  • 1 depth attributes를 sanitize array.map을 이용하여 2 depth의 attributes 처리
  • quiz-pack에서 sanitize할 때 userSchema를 매개변수에 넣어줘서 sanitize가 됨을 확인했으나, nested attributes에 있는 user 객체의 민감 정보들이 그대로 노출되어 promise.all(), map() 처리를 하여 원하는 결과를 얻을 수 있었다.
  • 그러나 findOne method에서는 한번의 sanitize로도 원하는 결과를 얻을 수 있었다
    • 확인해 보니, quiz-pack schema를 넣어줬어야 하는데, userSchema를 넣어 주어서 원하는 방향으로 sanitized 되지 않았음을 확인
[ 두 번째 시도 ]
  • findOne에서는 한번의 sanitize로 원하는 수준의 sanitized가 되어, findMany에서도 같은 방법으로 다시 시도 → userSchema 대신 quizpackSchema를 매개변수로 넣어 주어 sanitize 시도
    • 한번의 sanitize로 원하는 수준의 sanitize가 되었음을 확인

출처

V4.0.0 Sanitize user data
System Information strapi version: 4.0.0 OS: Ubuntu 20.04.3 lts DB: Sqlite Node v 16.1.0 npm v 7.11.2 yarn: 1.17.3 Hi guys, I'm trying to enrich the data of a user with additional information. For this I have created a custom controller in which I get the user.
V4.0.0 Sanitize user data
https://forum.strapi.io/t/v4-0-0-sanitize-user-data/13326/7
V4.0.0 Sanitize user data