Compare commits

...

3 Commits

Author SHA1 Message Date
00aa47ed17 feat(installer): record EULA acceptance timestamp in eula.txt
Write an ISO 8601 "# EULA accepted at: <time>" comment when the user
accepts the EULA, so the agreement time is captured alongside eula=true.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-15 22:29:07 +09:00
9c2a92c101 docs: align account section with account.local.json + scrypt reality
The 계정 section still described account.json as the account store and
scrypt hashing as future work; both are now implemented. Point it at the
gitignored account.local.json (0600) seed/scrypt flow, consistent with the
migration section below.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-12 01:06:05 +09:00
662c3c7b23 docs+comment: pin account.json untrack-after-redeploy TODO
추적 해제는 코드 작업이 아니라 사용자의 1회 재배포에 게이트된 운영 절차이므로,
잊히지 않도록 명시적 TODO 를 코드(paths.ts) + 운영 문서(admin-site.md)에 고정.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-11 13:31:50 +09:00
3 changed files with 27 additions and 3 deletions

View File

@@ -50,7 +50,9 @@ npm start # 기본 포트 3000.
## 계정
`account.json` 에 정의합니다(루트 디렉터리). **외부 HTTP 로 절대 노출되지 않도록 라우팅에서 제외돼 있습니다.**
운영 계정은 **gitignore 된 `account.local.json`**(루트 디렉터리, 0600, scrypt 해시)에 저장됩니다. 추적되는 `account.json` 은 서버에 `account.local.json` 이 없을 때만 읽는 **시드 소스**로, 서버 시작 시 자동으로 `account.local.json`(0600) 으로 복사됩니다. 두 파일 모두 **외부 HTTP 로 절대 노출되지 않도록 라우팅에서 제외돼 있습니다.**
시드 포맷(`account.json`):
```json
[
@@ -58,7 +60,7 @@ npm start # 기본 포트 3000.
]
```
> 운영 환경에서는 평문 비밀번호 대신 해시를 쓰도록 추후 보강할 여지가 있습니다.
평문 비밀번호로 시드해도 로그인 성공 시 자동으로 scrypt 해시(`scrypt$<salt>$<hash>`)로 업그레이드되어 `account.local.json` 에만 저장됩니다. 자세한 마이그레이션 절차는 아래 "운영 계정 파일 마이그레이션" 을 참고하세요.
## 대시보드 (`/op/dashboard`)
@@ -138,4 +140,14 @@ say [musicquiz] 데이터팩 초기화
- `account.json` 은 라우팅에서 차단되어 있으나, 디스크 권한도 운영자만 접근 가능하게 두는 것이 안전합니다.
- 관리자 비밀번호는 충분히 강하게 설정.
### 운영 계정 파일 마이그레이션 (미완결 — 재배포 게이트)
운영 계정은 이제 gitignore 된 `account.local.json`(0o600, scrypt 해시)에만 저장됩니다. 추적되는 `account.json` 은 서버에 `account.local.json` 이 없을 때만 읽는 **시드 소스**로 남겨 둔 상태입니다. 남은 위생 작업이 하나 있습니다:
1. **[운영] 최신 main 재배포** → 서버가 `account.local.json`(0o600) 을 자동 생성하는지 확인.
2. **[운영] 비밀번호 로테이션** — git 히스토리에 평문 비밀번호가 남아 있어 추적 해제로는 지워지지 않으므로, 이것이 실질적 최우선 보안 조치입니다.
3. **[후속 커밋] `account.json` 추적 해제** — 위 1번(서버에 `account.local.json` 존재) 확인 **후에만** `git rm --cached account.json` 를 별도 커밋으로 진행. 같은 커밋에서 하면 시드 소스가 사라져 로그인이 막힙니다.
> 코드 상 앵커: `src/shared/paths.ts` 의 `TODO(untrack-after-redeploy)` 주석.
- 모든 `/op/*` 라우트는 세션 기반 인증 미들웨어를 거칩니다. 세션 만료 시 자동으로 로그인 페이지로 리다이렉트.

View File

@@ -656,7 +656,12 @@ ipcMain.handle('server:fetchMinecraftEula', async (): Promise<{ url: string; htm
ipcMain.handle('server:acceptEula', async (_event, installPath: string) => {
const target = path.join(installPath, 'eula.txt')
await fsp.writeFile(target, `# Generated by music quiz installer\neula=true\n`, 'utf8')
const acceptedAt = new Date()
await fsp.writeFile(
target,
`# Generated by music quiz installer\n# EULA accepted at: ${acceptedAt.toISOString()}\neula=true\n`,
'utf8',
)
sendLog(t('log.eulaAccepted'))
})

View File

@@ -8,6 +8,13 @@ export const manifestDirPath = path.join(projectRoot, 'manifest')
export const manifestTermsDirPath = path.join(manifestDirPath, 'terms')
// 추적되는 account.json(과거 평문 노출)을 대체할, gitignore 된 운영 계정 파일.
// readAccounts 는 이 파일을 우선 사용하고, 없을 때만 account.json 을 시드로 읽는다.
//
// TODO(untrack-after-redeploy): account.json 은 아직 git 추적 상태다. 절대 지금
// 같은 커밋에서 `git rm --cached account.json` 하지 말 것 — 서버에 account.local.json
// 이 아직 없을 때 시드 소스가 사라져 로그인이 막힌다(chicken-and-egg).
// 안전한 순서: (1) 이 커밋 배포 → 서버가 account.local.json(0o600) 자동 생성 확인 →
// (2) 그 다음 후속 커밋에서 account.json 추적 해제.
// 주의: 추적 해제는 위생일 뿐, 히스토리의 평문 비밀번호는 지워지지 않는다 → 비밀번호 로테이션이 실질 조치.
export const accountFilePath = path.join(projectRoot, 'account.json')
export const accountLocalFilePath = path.join(projectRoot, 'account.local.json')
export const fileDirPath = path.join(projectRoot, 'file')