API Key 인증 완전 제거

사내 운영 전제로 X-API-Key 인증을 전면 제거.
- app/core/auth.py 삭제
- routes.py에서 Depends(require_api_key) 모두 제거
- config.Settings에서 api_keys / api_key_set 제거
- .env / .env.example에서 API_KEYS 제거
- docker-compose.yml에서 API_KEYS 환경변수 제거 (KOSIMCSE_MODEL 추가)
- UI(index.html)에서 DEFAULT_API_KEY 상수 + X-API-Key 헤더 모두 제거
- scripts/sample_curl.sh, sample_python.py에서 키 헤더 제거
- tests: test_detect_requires_api_key → test_detect_no_auth_required로 갱신
- README: 인증 컬럼 제거, curl 예시에서 헤더 제거
This commit is contained in:
HyeongBaeYang committed 2026-05-14 08:58:28 +09:00
1 parent f31ef142e8
commit 4913bf3ecc
10 files changed
+27 -78

No files matched your search

+4 -12
View File
@@ -358,9 +358,6 @@
</footer>
<script>
// 검토 콘솔 내부 호출에 자동 첨부할 기본 키 (사내 운영용)
const DEFAULT_API_KEY = "combooks-key-change-me";
const SAMPLES = {
copy: {
title: "어미만 변경한 표절 (홍길동전 기반)",
@@ -423,7 +420,6 @@ async function runDetect() {
const docId = document.getElementById("doc-id").value.trim() || `web-${Date.now()}`;
const title = document.getElementById("title").value.trim();
const author = document.getElementById("author").value.trim();
const apiKey = DEFAULT_API_KEY;
const thresholdVal = parseFloat(document.getElementById("threshold-slider").value);
const autobioMode = document.querySelector('input[name="autobio-mode"]:checked').value;
@@ -451,7 +447,7 @@ async function runDetect() {
try {
const resp = await fetch("/v1/plagiarism/detect", {
method: "POST",
headers: { "Content-Type": "application/json", "X-API-Key": apiKey },
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
if (!resp.ok) {
@@ -614,11 +610,10 @@ document.querySelectorAll(".tab-btn").forEach((btn) => {
// ========== 코퍼스 관리 ==========
async function loadCorpus() {
const apiKey = DEFAULT_API_KEY;
const tbody = document.getElementById("corpus-tbody");
tbody.innerHTML = '<tr><td colspan="4" style="color: var(--muted); text-align: center; padding: 20px;">로딩 중…</td></tr>';
try {
const resp = await fetch("/v1/corpus", { headers: { "X-API-Key": apiKey } });
const resp = await fetch("/v1/corpus");
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const data = await resp.json();
document.getElementById("corpus-count").textContent = data.total;
@@ -647,7 +642,6 @@ async function uploadCorpus() {
const title = document.getElementById("corpus-title").value.trim();
const text = document.getElementById("corpus-text").value.trim();
const file = document.getElementById("corpus-file").files[0];
const apiKey = DEFAULT_API_KEY;
const statusEl = document.getElementById("corpus-status");
if (!title) {
@@ -670,11 +664,11 @@ async function uploadCorpus() {
fd.append("title", title);
if (docId) fd.append("doc_id", docId);
fd.append("file", file);
resp = await fetch("/v1/corpus/file", { method: "POST", headers: { "X-API-Key": apiKey }, body: fd });
resp = await fetch("/v1/corpus/file", { method: "POST", body: fd });
} else {
resp = await fetch("/v1/corpus", {
method: "POST",
headers: { "Content-Type": "application/json", "X-API-Key": apiKey },
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ doc_id: docId || null, title, text }),
});
}
@@ -700,11 +694,9 @@ async function uploadCorpus() {
async function deleteDoc(docId) {
if (!confirm(`'${docId}' 문서를 삭제하시겠습니까? 인덱스가 재빌드됩니다.`)) return;
const apiKey = DEFAULT_API_KEY;
try {
const resp = await fetch(`/v1/corpus/${encodeURIComponent(docId)}`, {
method: "DELETE",
headers: { "X-API-Key": apiKey },
});
if (!resp.ok && resp.status !== 204) {
throw new Error(`HTTP ${resp.status}`);