mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 08:03:39 +00:00
fix(ai-vault): validate SSH history inventory ids
This commit is contained in:
@@ -63,7 +63,7 @@ describe('runtime-owned SSH AI Vault inventory', () => {
|
||||
it('skips malformed target rows from a paired runtime', async () => {
|
||||
mocks.callRuntimeEnvironment.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
result: { targets: [null, 42, { id: 'hub-owned-host', connected: true }] }
|
||||
result: { targets: [null, 42, { id: '\ud800' }, { id: 'hub-owned-host', connected: true }] }
|
||||
})
|
||||
|
||||
await expect(listRuntimeOwnedSshAiVaultTargets('/user-data', 'hub-runtime')).resolves.toEqual([
|
||||
|
||||
@@ -87,11 +87,17 @@ async function loadRuntimeOwnedSshAiVaultTargets(
|
||||
if (isRuntimeOwnedSshTargetId(target.id)) {
|
||||
return []
|
||||
}
|
||||
let executionHostId: `ssh:${string}`
|
||||
try {
|
||||
executionHostId = toSshExecutionHostId(target.id)
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
return [
|
||||
{
|
||||
environmentId,
|
||||
targetId: target.id,
|
||||
executionHostId: toSshExecutionHostId(target.id),
|
||||
executionHostId,
|
||||
...('connected' in target && typeof target.connected === 'boolean'
|
||||
? { connected: target.connected }
|
||||
: {})
|
||||
|
||||
@@ -1941,14 +1941,14 @@ describe('web AI Vault preload API', () => {
|
||||
await expect(
|
||||
globals.window.api.aiVault.listSessions({
|
||||
executionHostScope: 'ssh:hub-owned-host',
|
||||
limit: 25
|
||||
unlimited: true
|
||||
})
|
||||
).resolves.toEqual(scanResult)
|
||||
expect(runtimeCalls).toEqual([
|
||||
{
|
||||
method: 'aiVault.listSessions',
|
||||
params: {
|
||||
limit: 25,
|
||||
unlimited: true,
|
||||
executionHostId: 'ssh:hub-owned-host'
|
||||
}
|
||||
}
|
||||
@@ -1985,6 +1985,7 @@ describe('web AI Vault preload API', () => {
|
||||
issues: [
|
||||
expect.objectContaining({
|
||||
executionHostId: 'ssh:hub-owned-host',
|
||||
kind: 'host',
|
||||
message: expect.stringContaining('cannot scan Agent Session History on its SSH hosts')
|
||||
})
|
||||
],
|
||||
|
||||
@@ -1608,6 +1608,7 @@ function createAiVaultApi(): NonNullable<Partial<PreloadApi>['aiVault']> {
|
||||
if (parsedScope?.kind === 'ssh') {
|
||||
return callRuntimeResult<AiVaultListResult>('aiVault.listSessions', {
|
||||
limit: args?.limit,
|
||||
unlimited: args?.unlimited,
|
||||
force: args?.force,
|
||||
scopePaths: args?.scopePaths,
|
||||
executionHostId: parsedScope.id
|
||||
@@ -1700,6 +1701,7 @@ function webAiVaultUnsupportedSshHostResult(executionHostId: ExecutionHostId): A
|
||||
{
|
||||
executionHostId,
|
||||
agent: 'codex',
|
||||
kind: 'host',
|
||||
path: executionHostId,
|
||||
message: translate(
|
||||
'auto.web.webPreloadApi.aiVaultUnsupportedSshHost',
|
||||
|
||||
Reference in New Issue
Block a user