fix: red-team round 3 hardening across desktop, mobile, core and server
Batch of red-team r3 fixes that were in the working tree before the 2026-09-28 design overhaul, committed as one unit with their tests. - desktop main: STT timeouts and sidecar, voice recording store, sync (credentials, audio, knowledge reindex, push gates), runtime provisioner, update policy, AltGr keybindings, voice-command policy, dictionary file codec/limits, meeting transcript condensing and a local recording ledger so interrupted-session recovery only closes meetings this device recorded (a phone's live meeting is left alone). - mobile: login CSRF via implicit token callbacks rejected, account deletion/retention, durable queue retention, knowledge realtime without unfiltered DELETE, meeting re-record failure paths, cloud STT client, preferences store/resync. - core: text chunking splits long unbroken transcripts to fit, template field policy, dictionary limits, meeting markdown inline handling. - server: payple webhook policy and cancellation order scope, meeting document generation quota, team RPC null-role guard, unified LLM quota in-flight accounting, knowledge chunk vector index, meeting re-record failure paths (migrations 20260929*). - ci: portable/runtime feed gates, update-policy schema, Forgejo file delete and alias planning. Four older tests are updated to the new contracts rather than the old behavior: token-pair auth callbacks are rejected, knowledge realtime no longer subscribes to DELETE, long transcript lines are split, and meeting recovery requires the local recording ledger for empty rows.
This commit is contained in:
parent
2428ede03d
commit
ba9ef9741e
161 changed files with 17056 additions and 2379 deletions
|
|
@ -17,6 +17,7 @@ import {
|
|||
import {
|
||||
CHECKBOX_CHECKED,
|
||||
CHECKBOX_UNCHECKED,
|
||||
parseInlineRuns,
|
||||
parseMarkdownBlocks,
|
||||
type MarkdownBlock,
|
||||
} from './meeting-markdown'
|
||||
|
|
@ -27,9 +28,20 @@ const HEADING_LEVELS = {
|
|||
3: HeadingLevel.HEADING_3,
|
||||
} as const
|
||||
|
||||
/**
|
||||
* 블록 텍스트를 TextRun 목록으로 바꾼다. 인라인 강조 해석은 HTML 경로와 같은
|
||||
* parseInlineRuns 를 쓰므로 PDF/DOCX 굵기가 일치한다. forceBold 는 표 머리글처럼
|
||||
* 블록 전체가 굵어야 할 때 쓴다. 빈 텍스트도 문단 구조가 유지되게 빈 run 하나를 둔다.
|
||||
*/
|
||||
function inlineTextRuns(text: string, forceBold = false): TextRun[] {
|
||||
const runs = parseInlineRuns(text)
|
||||
if (runs.length === 0) return [new TextRun({ text: '', bold: forceBold })]
|
||||
return runs.map((run) => new TextRun({ text: run.text, bold: forceBold || run.bold }))
|
||||
}
|
||||
|
||||
function tableCell(text: string, bold: boolean): TableCell {
|
||||
return new TableCell({
|
||||
children: [new Paragraph({ children: [new TextRun({ text, bold })] })],
|
||||
children: [new Paragraph({ children: inlineTextRuns(text, bold) })],
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -39,15 +51,18 @@ export function blocksToDocxElements(blocks: readonly MarkdownBlock[]): Array<Pa
|
|||
for (const block of blocks) {
|
||||
switch (block.type) {
|
||||
case 'heading':
|
||||
elements.push(new Paragraph({ text: block.text, heading: HEADING_LEVELS[block.level] }))
|
||||
elements.push(new Paragraph({ children: inlineTextRuns(block.text), heading: HEADING_LEVELS[block.level] }))
|
||||
break
|
||||
case 'bullet':
|
||||
elements.push(new Paragraph({ text: block.text, bullet: { level: 0 } }))
|
||||
elements.push(new Paragraph({ children: inlineTextRuns(block.text), bullet: { level: 0 } }))
|
||||
break
|
||||
case 'checkbox':
|
||||
elements.push(
|
||||
new Paragraph({
|
||||
text: `${block.checked ? CHECKBOX_CHECKED : CHECKBOX_UNCHECKED} ${block.text}`,
|
||||
children: [
|
||||
new TextRun(`${block.checked ? CHECKBOX_CHECKED : CHECKBOX_UNCHECKED} `),
|
||||
...inlineTextRuns(block.text),
|
||||
],
|
||||
bullet: { level: 0 },
|
||||
}),
|
||||
)
|
||||
|
|
@ -55,7 +70,7 @@ export function blocksToDocxElements(blocks: readonly MarkdownBlock[]): Array<Pa
|
|||
case 'paragraph':
|
||||
// 줄마다 문단 하나 — 한 줄짜리 항목이 한 문단으로 합쳐지지 않게 한다
|
||||
for (const line of block.lines) {
|
||||
elements.push(new Paragraph({ children: [new TextRun(line)] }))
|
||||
elements.push(new Paragraph({ children: inlineTextRuns(line) }))
|
||||
}
|
||||
break
|
||||
case 'table': {
|
||||
|
|
|
|||
|
|
@ -158,6 +158,36 @@ export function parseMarkdownBlocks(markdown: string | null | undefined): Markdo
|
|||
return blocks
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 인라인 파서 (순수)
|
||||
// ============================================================
|
||||
|
||||
/** 블록 텍스트 안의 인라인 조각. 강조 표기(**)는 벗겨지고 bold 로만 남는다. */
|
||||
export interface InlineRun {
|
||||
text: string
|
||||
bold: boolean
|
||||
}
|
||||
|
||||
const INLINE_BOLD = /\*\*(.+?)\*\*/g
|
||||
|
||||
/**
|
||||
* 인라인 강조(**굵게**)를 조각으로 나눈다 — HTML/DOCX 렌더러가 공유하는 단일 정본.
|
||||
* 두 내보내기가 같은 문서를 같은 굵기로 그리도록 해석은 여기 한 곳에서만 한다.
|
||||
* 빈 조각은 만들지 않으므로 빈 문자열은 빈 배열이 된다.
|
||||
*/
|
||||
export function parseInlineRuns(text: string): InlineRun[] {
|
||||
const runs: InlineRun[] = []
|
||||
let cursor = 0
|
||||
for (const match of text.matchAll(INLINE_BOLD)) {
|
||||
const start = match.index ?? 0
|
||||
if (start > cursor) runs.push({ text: text.slice(cursor, start), bold: false })
|
||||
runs.push({ text: match[1], bold: true })
|
||||
cursor = start + match[0].length
|
||||
}
|
||||
if (cursor < text.length) runs.push({ text: text.slice(cursor), bold: false })
|
||||
return runs
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// HTML 렌더링 (PDF 생성용)
|
||||
// ============================================================
|
||||
|
|
@ -174,9 +204,11 @@ export function escapeHtml(text: string): string {
|
|||
return text.replace(/[&<>"']/g, (ch) => HTML_ESCAPES[ch] ?? ch)
|
||||
}
|
||||
|
||||
/** 이스케이프 후 인라인 강조(**굵게**)만 태그로 바꾼다. */
|
||||
/** 인라인 조각을 이스케이프하고 굵은 조각만 <strong> 으로 감싼다. */
|
||||
function renderInline(text: string): string {
|
||||
return escapeHtml(text).replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
|
||||
return parseInlineRuns(text)
|
||||
.map((run) => (run.bold ? `<strong>${escapeHtml(run.text)}</strong>` : escapeHtml(run.text)))
|
||||
.join('')
|
||||
}
|
||||
|
||||
export const CHECKBOX_UNCHECKED = '☐'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue