-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor] 매물 페이지 #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fa97a00
ecb0677
474fe5e
45f4d11
242a53f
e09d548
8016f89
129c2d6
921f4cf
cebbf84
21bfcc2
4bfab61
b0986a0
64ce3d0
1390870
9e0c538
f00258b
50b13b1
18ea69b
f6cf1b5
f8a0cbd
f9d44eb
2c02e07
d406ae9
ffbcc78
cf04320
7361f17
a5add29
0d6849f
4bc42d9
df28b50
237672e
31cb4c9
6b2e7c9
1478e07
742e2d8
0979b4f
81a97dc
ed9a86e
feaa781
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,6 +61,8 @@ public class HomeCreateDTO { | |
|
|
||
| private List<MaintenanceFeeDTO> maintenanceFees; | ||
|
|
||
| private String description; | ||
|
|
||
| @Data | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,6 +98,9 @@ public class HomeCreateRequestDto { | |
| @ApiModelProperty(value = "매물 이미지 목록") | ||
| private List<MultipartFile> images; | ||
|
|
||
| @ApiModelProperty(value = "상세 정보", example = "남향이라 햇살이 잘 들고, 근처에 공원이 있어 산책하기 좋습니다.") | ||
| private String description; | ||
|
|
||
| @ApiModel(description = "관리비 항목 DTO") | ||
| @Data | ||
| @NoArgsConstructor | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,7 +52,7 @@ public class HomeResponseDTO { | |
| private Boolean isParking; | ||
|
|
||
| private List<FacilityItem> facilities; | ||
|
|
||
| private String description; | ||
| private List<HomeMaintenanceFeeVO> maintenanceFees; | ||
|
|
||
| private List<String> imageUrls; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -37,6 +37,10 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| createDTO.getResidenceType(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| images != null ? images.size() : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ✨ 서비스에서 받은 DTO와 description 값 확인 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| log.info("서비스에서 받은 DTO: {}", createDTO); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| log.info("서비스에서 확인한 description 값: {}", createDTO.getDescription()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check failureCode scanning / CodeQL Log Injection High
This log entry depends on a
user-provided value Error loading related location Loading
Copilot AutofixAI 6 months ago To fix this log injection vulnerability, we need to sanitize the user-provided
Suggested changeset
1
src/main/java/org/scoula/domain/home/service/HomeServiceImpl.java
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HomeVO home = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HomeVO.builder() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -79,8 +83,13 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .isParking(createDTO.getIsParking()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .area(createDTO.getArea()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .landCategory(createDTO.getLandCategory()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .description(createDTO.getDescription()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .build(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ✨ DB에 저장할 객체의 description 값 최종 확인 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| log.info("DB에 저장할 HomeDetailVO 객체: {}", homeDetail); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| log.info("최종 DB 저장 직전의 description 값: {}", homeDetail.getDescription()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check failureCode scanning / CodeQL Log Injection High
This log entry depends on a
user-provided value Error loading related location Loading
Copilot AutofixAI 6 months ago To fix this log injection vulnerability, we need to sanitize the user-provided
Suggested changeset
1
src/main/java/org/scoula/domain/home/service/HomeServiceImpl.java
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| int detailResult = homeMapper.insertHomeDetail(homeDetail); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (detailResult != 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throw new BusinessException( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -158,7 +167,11 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return homeId; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (Exception e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| log.error("매물 등록 중 오류 발생: userId={}, error={}", userId, e.getMessage()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| log.error( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "매물 등록 중 오류 발생: userId={}, error={}", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| userId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| e.getMessage(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| e); // ⭐️ 예외 객체(e)를 함께 출력하여 스택 트레이스 확인 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throw new BusinessException( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CommonErrorCode.INTERNAL_SERVER_ERROR, "매물 등록 중 오류가 발생했습니다: " + e.getMessage()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -188,6 +201,12 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HomeDetailVO homeDetail = homeMapper.selectHomeDetailByHomeId(homeId); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ✨ 매퍼에서 반환된 객체와 description 값 확인 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| log.info("매퍼에서 반환된 HomeDetailVO: {}", homeDetail); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| log.info( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "매퍼에서 확인한 description 값: {}", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| homeDetail != null ? homeDetail.getDescription() : null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| List<HomeImageVO> images = homeMapper.selectHomeImagesByHomeId(homeId); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| List<String> imageUrls = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| images.stream().map(HomeImageVO::getImageUrl).collect(Collectors.toList()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -229,6 +248,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .isParking(homeDetail != null ? homeDetail.getIsParking() : null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .facilities(facilities) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .maintenanceFees(maintenanceFees) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .description(homeDetail != null ? homeDetail.getDescription() : null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .imageUrls(imageUrls) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .createdAt(home.getCreatedAt()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .updatedAt(home.getUpdatedAt()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,4 +24,5 @@ public class HomeDetailVO { | |
| private Boolean isParking; | ||
| private Float area; | ||
| private String landCategory; | ||
| private String description; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,11 +18,11 @@ | |
| <insert id="insertHomeDetail" parameterType="org.scoula.domain.home.vo.HomeDetailVO" useGeneratedKeys="true" keyProperty="homeDetailId"> | ||
| INSERT INTO home_detail ( | ||
| home_id, build_date, home_floor, building_total_floors, | ||
| home_direction, bathroom_count, is_pet, is_parking_available,area,land_category | ||
| home_direction, bathroom_count, is_pet, is_parking_available,area,land_category,description | ||
|
|
||
| ) VALUES ( | ||
| #{homeId}, #{buildDate}, #{homeFloor}, #{buildingTotalFloors}, | ||
| #{homeDirection}, #{bathroomCnt}, #{isPet}, #{isParking}, #{area}, #{landCategory} | ||
| #{homeDirection}, #{bathroomCnt}, #{isPet}, #{isParking}, #{area}, #{landCategory},#{description} | ||
| ) | ||
| </insert> | ||
|
|
||
|
|
@@ -63,7 +63,7 @@ | |
| <select id="selectHomeDetailByHomeId" parameterType="int" resultType="org.scoula.domain.home.vo.HomeDetailVO"> | ||
| SELECT | ||
| home_detail_id, home_id, build_date, home_floor, building_total_floors, | ||
| home_direction, bathroom_count as bathroomCnt, is_pet as isPet, is_parking_available as isParking | ||
| home_direction, bathroom_count as bathroomCnt, is_pet as isPet, is_parking_available as isParking, description as description | ||
| FROM home_detail | ||
| WHERE home_id = #{homeId} | ||
| </select> | ||
|
|
||
Check failure
Code scanning / CodeQL
Log Injection High
Copilot Autofix
AI 6 months ago
To fix this log injection vulnerability, we should sanitize all user-provided fields before logging them. The best approach is to avoid logging the entire
requestDtoobject directly. Instead, log only the fields that are necessary for debugging, and sanitize each field to remove newline characters and other potentially dangerous content. For string fields, replace any newline (\n,\r) characters with spaces or remove them entirely. For collections or nested objects, sanitize each string element. This can be done by creating a helper method to sanitize strings and applying it to each field before logging. The fix should be applied to line 46 insrc/main/java/org/scoula/domain/home/controller/HomeControllerImpl.java. We may need to add a private helper method in the controller to perform the sanitization.