zioinfo-mail/projects/testcase-php-legacy/public/index.php
DESKTOP-TKLFCPR\ython e228faabf5 feat(itsm): G-1~G-12 확장 기능 + 하네스/봇/설치스크립트 구현
G-1: 메신저 Webhook Relay + _send_to_room 실제 httpx 호출 구현
G-2: POST /api/tasks/bulk SR 대량작업 엔드포인트 (최대 100건)
G-3: 라이선스 만료 알림 스케줄러 (매일 09:00 KST)
G-4: 체험판 upgrade_banner 필드 + license.py 배너 로직
G-5: core/auto_rca.py + incidents/problem auto-rca 엔드포인트
G-6: core/deploy_impact.py + vibe impact-analysis 엔드포인트
G-7: core/ticket_classifier.py + SR 생성 시 AI 분류 + ai-suggestion API
G-8: VulnPatchRecord 모델 + vuln_scan 패치추적 4개 엔드포인트
G-9: core/jira_sync.py + gateway Jira/Confluence 연동 엔드포인트
G-10: core/push_notify.py + routers/push.py + PushSubscription 모델
G-11: approvals 다중승인 (위임/서명/기한초과/마감연장)
G-12: alembic.ini + migrations/ + cicd/migrate_to_postgres.sh

하네스: guardia-orchestrator 확장기능 Phase 반영
봇명령어: /sr /status /license /bulk 슬래시 명령어 추가
설치스크립트: setup/ (Ubuntu, CentOS, RHEL, Windows) --test 옵션 포함

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 18:18:52 +09:00

79 lines
2.5 KiB
PHP

<?php
/**
* GUARDiA 공지사항 게시판 (PHP 레거시) — 코드 리뷰 testcase
* 의도적 문제점:
* - SQL 인젝션 취약점
* - XSS 취약점
* - CSRF 토큰 없음
* - 세션 관리 미흡
* - 에러 메시지 그대로 노출
*/
session_start();
require_once '../includes/db.php';
require_once '../includes/auth.php';
$action = $_GET['action'] ?? 'list';
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>공지사항 게시판</title>
<style>
body { font-family: Arial, sans-serif; max-width: 900px; margin: 40px auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #ddd; padding: 8px 12px; }
th { background: #f5f5f5; }
.btn { padding: 6px 12px; background: #007bff; color: white; border: none; cursor: pointer; }
</style>
</head>
<body>
<?php if ($action === 'list'): ?>
<h1>공지사항</h1>
<?php
// XSS: 검색어 그대로 출력
$keyword = $_GET['keyword'] ?? '';
echo "<p>검색: " . $keyword . "</p>"; // XSS 취약점
// SQL 인젝션: 직접 문자열 삽입
$sql = "SELECT * FROM notices WHERE title LIKE '%" . $keyword . "%' ORDER BY id DESC";
$result = mysqli_query($conn, $sql); // SQL 인젝션
if (mysqli_num_rows($result) > 0):
?>
<table>
<tr><th>번호</th><th>제목</th><th>작성자</th><th>날짜</th></tr>
<?php while($row = mysqli_fetch_assoc($result)): ?>
<tr>
<td><?= $row['id'] ?></td>
<td><a href="?action=view&id=<?= $row['id'] ?>"><?= $row['title'] ?></a></td>
<td><?= $row['author'] ?></td>
<td><?= $row['created_at'] ?></td>
</tr>
<?php endwhile; ?>
</table>
<?php endif; ?>
<?php elseif ($action === 'view'): ?>
<?php
$id = $_GET['id']; // 타입 검증 없음
// SQL 인젝션 취약점
$sql = "SELECT * FROM notices WHERE id = " . $id;
$result = mysqli_query($conn, $sql);
$notice = mysqli_fetch_assoc($result);
?>
<h1><?= $notice['title'] ?></h1> <!-- XSS -->
<div><?= $notice['content'] ?></div> <!-- XSS -->
<?php elseif ($action === 'write'): ?>
<!-- CSRF 토큰 없는 폼 -->
<h1>공지사항 작성</h1>
<form method="POST" action="save.php">
<input name="title" placeholder="제목" required><br>
<textarea name="content" rows="10" cols="60"></textarea><br>
<button class="btn">저장</button>
</form>
<?php endif; ?>
</body>
</html>