kin: KIN-INFRA-003 Исправить command injection через deploy_path в SSH-команде

This commit is contained in:
Gros Frumos 2026-03-17 18:24:02 +02:00
parent a4e5497401
commit e118b87a3e
2 changed files with 9 additions and 7 deletions

View file

@ -106,7 +106,7 @@ beforeEach(() => {
success: true, exit_code: 0, stdout: '', stderr: '', duration_seconds: 2,
} as any)
vi.mocked(api.createProjectLink).mockResolvedValue({
id: 1, from_project: 'KIN', to_project: 'BRS', link_type: 'depends_on', description: null, created_at: '2026-01-01',
id: 1, from_project: 'KIN', to_project: 'BRS', type: 'depends_on', description: null, created_at: '2026-01-01',
} as any)
vi.mocked(api.deleteProjectLink).mockResolvedValue(undefined as any)
})
@ -496,7 +496,7 @@ describe('ProjectView — Links таб', () => {
it('связи отображаются при links.length > 0', async () => {
const links = [
{ id: 1, from_project: 'KIN', to_project: 'BRS', link_type: 'depends_on', description: 'test', created_at: '2026-01-01' },
{ id: 1, from_project: 'KIN', to_project: 'BRS', type: 'depends_on', description: 'test', created_at: '2026-01-01' },
]
vi.mocked(api.projectLinks).mockResolvedValue(links as any)
const wrapper = await mountProjectView()
@ -505,9 +505,9 @@ describe('ProjectView — Links таб', () => {
expect(wrapper.text()).toContain('depends_on')
})
it('link_type и description отображаются для каждой связи', async () => {
it('type и description отображаются для каждой связи', async () => {
const links = [
{ id: 2, from_project: 'KIN', to_project: 'API', link_type: 'triggers', description: 'API call', created_at: '2026-01-01' },
{ id: 2, from_project: 'KIN', to_project: 'API', type: 'triggers', description: 'API call', created_at: '2026-01-01' },
]
vi.mocked(api.projectLinks).mockResolvedValue(links as any)
const wrapper = await mountProjectView()

View file

@ -14,6 +14,7 @@ const consoleEl = ref<HTMLElement | null>(null)
let sinceId = 0
let userScrolled = false
let timer: ReturnType<typeof setInterval> | null = null
let scrollTimer: ReturnType<typeof setTimeout> | null = null
const MAX_LOGS = 500
@ -44,9 +45,9 @@ async function fetchLogs() {
sinceId = Math.max(...newLogs.map(l => l.id))
logs.value = [...logs.value, ...newLogs].slice(-MAX_LOGS)
// Scroll after DOM update
setTimeout(scrollToBottom, 0)
} catch (e: any) {
error.value = e.message
scrollTimer = setTimeout(scrollToBottom, 0)
} catch (e: unknown) {
error.value = e instanceof Error ? e.message : String(e)
}
}
@ -62,6 +63,7 @@ function startPolling() {
function stopPolling() {
if (timer) { clearInterval(timer); timer = null }
if (scrollTimer) { clearTimeout(scrollTimer); scrollTimer = null }
}
async function toggle() {