TMA-MYSQL-4.8
Ensure 'sql_mode' Contains 'STRICT_ALL_TABLES'
설명
When data changing statements are made (i.e., INSERT, UPDATE), MySQL can handle invalid or missing values differently depending on whether strict SQL mode is enabled. When strict SQL mode is enabled, data may not be truncated or otherwise "adjusted" to make the data changing statement work. Runs mysql -NBe with the client defaults: put an administrative account in ~/.my.cnf (mode 0600) or a mysql_config_editor login path, not MYSQL_PWD (see 1.4/1.6).
점검 방법
감사 방식: SQL 쿼리
out=$(mysql -NBe "SELECT IF(FIND_IN_SET('STRICT_ALL_TABLES', @@global.sql_mode) > 0, 'compliant', 'noncompliant')" 2>/dev/null) || exit 1; printf '%s\n' "$out"- 예상 출력
compliant
조치 방법
조치 방식: 가이드 또는 인프라 패치
Add STRICT_ALL_TABLES to sql_mode under [mysqld] (e.g. sql_mode=STRICT_ALL_TABLES,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION) after testing applications, then restart or SET GLOBAL sql_mode.
속성
- 운영 체제
- 모두
- 태그
- mysqldatabaseconfiguration
- 참고 자료
- CIS Oracle MySQL Community Server 8.4 Benchmark v1.1.0 - 4.8 Ensure 'sql_mode' Contains 'STRICT_ALL_TABLES'
이 호스트 점검하기
감사 권한이 있는 시스템에서 실행하세요. 스캔은 읽기 전용입니다.
tmaegis scan --target mysql --level 2