변경 파일 목록
총 2개
Component (1)
Goods.phpGoods/Controller (1)
EventSaleConfigController.phpAdmin/Promotion/변경 파일 코드
추가삭제
변경 전Goods.php
| public function getDisplayEventThemeInfo($whereArray, $orderby='') | |
| { | |
| if(trim($orderby) !== ''){ | |
| $orderby = " ORDER BY " . $orderby; | |
| } | |
| $whereArray[] = "kind='event'"; | |
| $strWhere = gd_implode(" AND ", $whereArray); | |
| if (isset($sortCode[$sort]) === true) { | |
| return $sortCode[$sort]; | |
| } else { | |
| // SQLi 취약점 개선사항 sort 파라미터 변조 방지 | |
| preg_match('/(if|ifnull|isnull|case when|nvl)|([=,]+)/', $sort, $matches); | |
| if(gd_count($matches[0]) > 0) { | |
| $sort = 'g.regDt asc'; | |
| } | |
| return $sort; | |
| } | |
| } | |
| /** | |
변경 후Goods.php
| public function getDisplayEventThemeInfo($whereArray, $orderby='') | |
| { | |
| // 화이트리스트에 없는 값은 정렬 적용하지 않음 (SQL Injection 방지) | |
| $allowedOrderBy = ['regDt desc', 'themeNm asc', 'displayEndDate asc']; | |
| if (trim($orderby) !== '' && in_array($orderby, $allowedOrderBy, true)) { | |
| $orderby = " ORDER BY " . $orderby; | |
| } else { | |
| $orderby = ''; | |
| } | |
| $whereArray[] = "kind='event'"; | |
| $strWhere = gd_implode(" AND ", $whereArray); | |
| if (isset($sortCode[$sort]) === true) { | |
| return $sortCode[$sort]; | |
| } | |
| // 화이트리스트에 없는 값은 기본 정렬로 강제 (SQL Injection 방지) | |
| return 'g.regDt asc'; | |
| } | |
| /** | |
변경 전EventSaleConfigController.php
| gd_isset($data['otherEventDisplayFl'], 'n'); | |
| gd_isset($data['otherEventBottomFirstFl'], 'n'); | |
| gd_isset($data['otherEventSortType'], 'auto'); | |
| gd_isset($data['otherEventSortTypeTa'], 'regdt desc'); | |
| gd_isset($data['otherEventSortTypeTb'], 'top'); | |
| $data['otherEventSortTypeTaList'] = [ | |
| 'regdt desc' => '최근 등록순', | |
| 'themeNm asc' => '가나다순', | |
| 'displayEndDate asc' => '종료 임박순', | |
| ]; | |
변경 후EventSaleConfigController.php
| gd_isset($data['otherEventDisplayFl'], 'n'); | |
| gd_isset($data['otherEventBottomFirstFl'], 'n'); | |
| gd_isset($data['otherEventSortType'], 'auto'); | |
| gd_isset($data['otherEventSortTypeTa'], 'regDt desc'); | |
| gd_isset($data['otherEventSortTypeTb'], 'top'); | |
| $data['otherEventSortTypeTaList'] = [ | |
| 'regDt desc' => '최근 등록순', | |
| 'themeNm asc' => '가나다순', | |
| 'displayEndDate asc' => '종료 임박순', | |
| ]; | |