Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions backend/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3229,14 +3229,17 @@
"type" : "object",
"properties" : {
"title" : {
"type" : "string"
"type" : "string",
"maxLength" : 200,
"minLength" : 0
},
"items" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/Item"
},
"minItems" : 1
"maxItems" : 30,
"minItems" : 0
}
},
"required" : [ "items" ]
Expand All @@ -3245,10 +3248,14 @@
"type" : "object",
"properties" : {
"question" : {
"type" : "string"
"type" : "string",
"maxLength" : 500,
"minLength" : 0
},
"answer" : {
"type" : "string"
"type" : "string",
"maxLength" : 5000,
"minLength" : 0
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ private List<CoverLetterItem> parse(String json) {
try {
return JSON.readValue(json, ITEM_LIST);
} catch (JsonProcessingException e) {
log.warn("cover letter items parse failed, return empty. raw={}", json, e);
// 자소서 답변 본문(PII)은 로그에 남기지 않는다 — 길이만 기록.
log.warn("cover letter items parse failed, return empty. length={}", json.length(), e);
return List.of();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

import com.stackup.stackup.coverletter.application.dto.CoverLetterCreateCommand;
import com.stackup.stackup.coverletter.application.dto.CoverLetterItem;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import java.util.List;

// 서버측 입력 상한 — JSON @RequestBody 는 multipart 20MB 제한이 적용되지 않으므로
// 거대 payload(DoS·AI 비용 증폭)를 bean-validation 으로 차단한다. 상한은 프론트 입력 캡과 일치.
public record CoverLetterCreateRequest(
String title,
@NotEmpty List<Item> items
@Size(max = 200) String title,
@NotEmpty @Size(max = 30) List<@Valid Item> items
) {
public record Item(String question, String answer) {
public record Item(
@Size(max = 500) String question,
@Size(max = 5000) String answer
) {
}

public CoverLetterCreateCommand toCommand() {
Expand Down