Compare commits

..

6 Commits

Author SHA1 Message Date
Sylvère
ed86fbec17 feat: release 6.11 (#10949) 2026-11-30 17:01:05 +01:00
Sylvère
1e6a049072 feat: technical release (#10946) 2026-11-30 14:26:35 +01:00
Mathieu
032159a609 feat(rest-api): CSRF middleware protection (#10945)
* feat: add CSRF protection middleware

* feat: scope urlencode middleware to signin routes

* feat: cookie sameSite default to lax

* changelog

---------

Co-authored-by: MathieuRA <contact@mathieu-raisin.fr>
2026-11-30 13:50:38 +01:00
Mathieu
a5295c6731 fix(auth-ldap): block LDAP unauthenticated bind via null password in session.signIn (#10944)
A JSON `null` password sent to `session.signIn` reached the LDAP provider,
which passed it to `client.bind()`. ldapts turns this into an LDAP
unauthenticated bind (DN + empty password), which some directories, such as
Active Directory by default, accept as a successful login. Anyone knowing a
username could sign in without its password.

- xo-server-auth-ldap: only bind with non-empty string username and password
- xo-server: reject empty or non-string passwords in `authenticateUser`,
  before any provider is called
- xo-server: add a `params` schema to `session.signIn` so non-string
  credentials are rejected at the API layer

Co-authored-by: Pierre Donias <pierre.donias@vates.tech>
2026-11-30 13:42:17 +01:00
Alex Castillo González
c8260fb259 fix(rest-api): keep colons in the password of Basic authentication (#10801) 2026-11-30 12:07:47 +01:00
Sylvère
756d7fa940 fix(xo6): my tasks optimization (#10935) 2026-11-30 11:11:04 +01:00
52 changed files with 754 additions and 141 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "@vates/types",
"private": false,
"version": "3.1.0",
"version": "3.2.0",
"main": "./dist/index.mjs",
"exports": {
".": {

View File

@@ -30,7 +30,7 @@
},
"devDependencies": {
"@eslint/js": "^9.19.0",
"@vates/types": "^3.1.0",
"@vates/types": "^3.2.0",
"rimraf": "^6.0.1",
"typescript": "~5.6",
"typescript-eslint": "^8.61.0"

View File

@@ -21,7 +21,7 @@
"tar-stream": "^3.1.8",
"@types/tar-stream": "^3.1.4",
"tmp": "^0.2.1",
"@vates/types": "^3.1.0"
"@vates/types": "^3.2.0"
},
"dependencies": {
"@xen-orchestra/log": "^1.0.0",

View File

@@ -30,7 +30,7 @@
"@vates/nbd-client": "^3.7.2",
"@vates/parse-duration": "^0.1.1",
"@vates/task": "^0.7.0",
"@vates/types": "^3.1.0",
"@vates/types": "^3.2.0",
"@xen-orchestra/async-map": "^0.1.5",
"@xen-orchestra/disk-transform": "^1.3.4",
"@xen-orchestra/fs": "^4.11.0",
@@ -70,7 +70,7 @@
"typescript": "^5.9.3"
},
"peerDependencies": {
"@xen-orchestra/xapi": "^10.0.0"
"@xen-orchestra/xapi": "^10.1.0"
},
"license": "AGPL-3.0-or-later",
"author": {

View File

@@ -27,13 +27,13 @@
"@types/file-saver": "^2.0.7",
"@types/lodash-es": "^4.17.12",
"@types/node": "^18.19.80",
"@vates/types": "^3.1.0",
"@vates/types": "^3.2.0",
"@vitejs/plugin-vue": "^6.0.0",
"@vue/tsconfig": "^0.9.0",
"@vueuse/core": "^14.0.0",
"@vueuse/math": "^14.0.0",
"@vueuse/shared": "^14.0.0",
"@xen-orchestra/web-core": "^0.66.1",
"@xen-orchestra/web-core": "^0.67.0",
"complex-matcher": "^1.1.1",
"d3-time-format": "^4.1.0",
"decorator-synchronized": "^0.6.0",

View File

@@ -34,7 +34,7 @@
"devDependencies": {
"@eslint/js": "^9.19.0",
"@types/node": "^22.3.0",
"@vates/types": "^3.1.0",
"@vates/types": "^3.2.0",
"rimraf": "^6.0.0",
"typescript": "~5.6.3",
"typescript-eslint": "^8.61.0"

View File

@@ -36,7 +36,7 @@
"xo-common": "^0.11.0"
},
"devDependencies": {
"@vates/types": "^3.1.0"
"@vates/types": "^3.2.0"
},
"scripts": {
"postversion": "npm publish --access public",

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "@xen-orchestra/proxy",
"version": "0.35.1",
"version": "0.35.2",
"license": "AGPL-3.0-or-later",
"description": "XO Proxy used to remotely execute backup jobs",
"keywords": [
@@ -40,7 +40,7 @@
"@xen-orchestra/mixin": "^0.2.1",
"@xen-orchestra/mixins": "^0.24.0",
"@xen-orchestra/self-signed": "^0.2.1",
"@xen-orchestra/xapi": "^10.0.0",
"@xen-orchestra/xapi": "^10.1.0",
"ajv": "^8.0.3",
"app-conf": "^3.0.0",
"async-iterator-to-stream": "^1.1.0",

View File

@@ -6,7 +6,7 @@
"main": "./dist/index.mjs",
"name": "@xen-orchestra/rest-api",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/rest-api",
"version": "0.43.0",
"version": "0.43.1",
"description": "REST API to manage your XOA",
"license": "AGPL-3.0-or-later",
"private": false,
@@ -38,14 +38,14 @@
"@vates/async-each": "^1.0.3",
"@vates/obfuscate": "^0.2.0",
"@vates/task": "^0.7.0",
"@vates/types": "^3.1.0",
"@vates/types": "^3.2.0",
"@xen-orchestra/acl": "^1.9.0",
"@xen-orchestra/backups": "^1.0.1",
"@xen-orchestra/cron": "^1.0.7",
"@xen-orchestra/log": "^1.0.0",
"@xen-orchestra/qcow2": "^1.4.1",
"@xen-orchestra/vmdk": "^1.0.0",
"@xen-orchestra/xapi": "^10.0.0",
"@xen-orchestra/xapi": "^10.1.0",
"complex-matcher": "^1.1.1",
"fast-xml-parser": "^5.10.1",
"golike-defer": "^0.5.1",

View File

@@ -13,6 +13,7 @@ import { mcpGateMiddleware } from './middlewares/mcp-gate.middleware.mjs'
import { type OpenAPIV3 } from 'openapi-types'
import { createExternalRouter, sendObjects } from './router/external-router.mjs'
import { BASE_URL } from './helpers/utils.helper.mjs'
import { rejectCrossSiteMutation } from './middlewares/csrf.middleware.mjs'
export { sendObjects }
@@ -55,6 +56,7 @@ export default function setupRestApi(express: Express, xoApp: XoApp) {
express.use(BASE_URL, setupApiContext(xoApp))
express.use(BASE_URL, logMiddleware)
express.use(BASE_URL, mcpGateMiddleware)
express.use(BASE_URL, rejectCrossSiteMutation)
RegisterRoutes(express)

View File

@@ -9,6 +9,7 @@ import type { AuthenticatedRequest } from '../helpers/helper.type.mjs'
import { iocContainer } from '../ioc/ioc.mjs'
import { RestApi } from '../rest-api/rest-api.mjs'
import { ACL_MIDDLEWARE_NAME } from './acl.middleware.mjs'
import { parseBasicCredentials } from './basic-auth.helper.mjs'
import type { SecurityName } from '@vates/types'
const log = createLogger('xo:rest-api:authentication')
@@ -73,7 +74,7 @@ export function setupApiContext(xoApp: XoApp) {
return next(new ApiError('Malformed Authorization header', 400))
}
const [username, password] = Buffer.from(encoded, 'base64').toString().split(':')
const { username, password } = parseBasicCredentials(encoded)
Object.assign(credentials, { username, password, otp: query.otp })
res.locals.authType = 'basic'
}

View File

@@ -0,0 +1,14 @@
/**
* Extracts the credentials from the base64 payload of a `Authorization: Basic` header.
*
* Per RFC 7617 §2, the user-id cannot contain a colon but the password can: split on the
* first colon only and keep the remainder as the password.
*/
export function parseBasicCredentials(encoded: string): { username: string; password: string | undefined } {
const decoded = Buffer.from(encoded, 'base64').toString()
const index = decoded.indexOf(':')
if (index === -1) {
return { username: decoded, password: undefined }
}
return { username: decoded.slice(0, index), password: decoded.slice(index + 1) }
}

View File

@@ -0,0 +1,25 @@
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import { parseBasicCredentials } from './basic-auth.helper.mjs'
const encode = (value: string) => Buffer.from(value).toString('base64')
describe('parseBasicCredentials()', () => {
it('splits username and password', () => {
assert.deepEqual(parseBasicCredentials(encode('user:pass')), { username: 'user', password: 'pass' })
})
it('keeps colons found in the password', () => {
assert.deepEqual(parseBasicCredentials(encode('user:a:b')), { username: 'user', password: 'a:b' })
assert.deepEqual(parseBasicCredentials(encode('user::')), { username: 'user', password: ':' })
})
it('supports an empty password', () => {
assert.deepEqual(parseBasicCredentials(encode('user:')), { username: 'user', password: '' })
})
it('has no password when there is no colon', () => {
assert.deepEqual(parseBasicCredentials(encode('user')), { username: 'user', password: undefined })
})
})

View File

@@ -0,0 +1,31 @@
import type { NextFunction, Response, Request } from 'express'
import { ApiError } from '../helpers/error.helper.mjs'
const SAFE_METHODS = new Set(['GET', 'HEAD', 'OPTIONS'])
function isCrossSite(req: Request): boolean {
const secFetchSite = req.headers['sec-fetch-site']
if (secFetchSite !== undefined) {
return secFetchSite === 'cross-site'
}
const { origin } = req.headers
if (origin !== undefined) {
try {
return new URL(origin).host !== req.headers.host
} catch (error) {
return true
}
}
return false
}
export function rejectCrossSiteMutation(req: Request, res: Response, next: NextFunction) {
// res.locals.authType is setup by authentication.middleware#setupApiContext
if (!SAFE_METHODS.has(req.method) && res.locals.authType === 'token' && isCrossSite(req)) {
return next(new ApiError('cross-site request rejected', 403))
}
next()
}

View File

@@ -0,0 +1,78 @@
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import { Request, Response } from 'express'
import { ApiError } from '../helpers/error.helper.mjs'
import { rejectCrossSiteMutation } from './csrf.middleware.mjs'
const run = (method: string, opts: { authType?: 'token' | 'basic'; headers?: Request['headers'] }) => {
const req = { method, headers: opts.headers ?? {} } as Request
const res = { locals: { authType: 'authType' in opts ? opts.authType : 'token' } } as unknown as Response
let next: unknown
rejectCrossSiteMutation(req, res, (err?: unknown) => {
next = err
})
return next
}
const UNSAFE = ['POST', 'PUT', 'PATCH', 'DELETE']
describe('rejectCrossSiteMutation', () => {
describe('lets through', () => {
it('a safe method, even cross-site with a cookie', () => {
assert.equal(run('GET', { headers: { 'sec-fetch-site': 'cross-site' } }), undefined)
})
for (const method of UNSAFE) {
it(`${method} authenticated by basic, even cross-site`, () => {
assert.equal(run(method, { authType: 'basic', headers: { 'sec-fetch-site': 'cross-site' } }), undefined)
})
it(`${method} unauthenticated, even cross-site`, () => {
assert.equal(run(method, { authType: undefined, headers: { 'sec-fetch-site': 'cross-site' } }), undefined)
})
it(`${method} cookie + Sec-Fetch-Site same-origin`, () => {
assert.equal(run(method, { headers: { 'sec-fetch-site': 'same-origin' } }), undefined)
})
it(`${method} cookie + Sec-Fetch-Site same-site`, () => {
assert.equal(run(method, { headers: { 'sec-fetch-site': 'same-site' } }), undefined)
})
it(`${method} cookie + Sec-Fetch-Site none`, () => {
assert.equal(run(method, { headers: { 'sec-fetch-site': 'none' } }), undefined)
})
it(`${method} cookie + no metadata (xo-cli, curl)`, () => {
assert.equal(run(method, { headers: {} }), undefined)
})
it(`${method} cookie + Origin matches Host`, () => {
assert.equal(run(method, { headers: { origin: 'https://xo.example.com', host: 'xo.example.com' } }), undefined)
})
it(`${method} cookie: Sec-Fetch-Site wins over a mismatching Origin`, () => {
assert.equal(
run(method, {
headers: { 'sec-fetch-site': 'same-origin', origin: 'https://evil.com', host: 'xo.example.com' },
}),
undefined
)
})
}
})
describe('rejects (403)', () => {
const assertRejected = (error: unknown) => {
assert.ok(error instanceof ApiError)
assert.equal((error as ApiError).status, 403)
}
for (const method of UNSAFE) {
it(`${method} cookie + Sec-Fetch-Site cross-site`, () => {
assertRejected(run(method, { headers: { 'sec-fetch-site': 'cross-site' } }))
})
it(`${method} cookie + Origin host != Host`, () => {
assertRejected(run(method, { headers: { origin: 'https://evil.com', host: 'xo.example.com' } }))
})
it(`${method} cookie + malformed Origin (fail closed)`, () => {
assertRejected(run(method, { headers: { origin: 'null', host: 'xo.example.com' } }))
})
}
})
})

View File

@@ -35,7 +35,12 @@
import VtsResizeHandle from '@core/components/resize-handle/VtsResizeHandle.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
import { vTooltip } from '@core/directives/tooltip.directive.ts'
import { type SidebarSide, useLeftSidebarStore, useRightSidebarStore } from '@core/packages/sidebar'
import {
SIDEBAR_TRANSITION_DURATION,
type SidebarSide,
useLeftSidebarStore,
useRightSidebarStore,
} from '@core/packages/sidebar'
import { useUiStore } from '@core/stores/ui.store.ts'
import { IK_MENU_ACTION_HANDLER } from '@core/utils/injection-keys.util.ts'
import { toVariants } from '@core/utils/to-variants.util.ts'
@@ -68,6 +73,8 @@ const showResizeHandle = computed(() => !ui.isSmall && sidebar.value.isExpanded)
const resizeHandlePosition = computed(() => (side === 'left' ? 'end' : 'start'))
const slideTransition = `margin-inline ${SIDEBAR_TRANSITION_DURATION}ms, transform ${SIDEBAR_TRANSITION_DURATION}ms`
provide(IK_MENU_ACTION_HANDLER, () => {
if (ui.isSmall) {
sidebar.value.toggleExpand(false)
@@ -93,9 +100,7 @@ const className = computed(() => [
background-color: var(--color-neutral-background-secondary);
width: v-bind('sidebar.cssWidth');
z-index: 1010;
transition:
margin-inline 0.25s,
transform 0.25s;
transition: v-bind(slideTransition);
&.bordered {
&.side--left {

View File

@@ -1,4 +1,4 @@
import { useTimestamp } from '@vueuse/core'
import { createSharedComposable, useTimestamp } from '@vueuse/core'
import { computed, type MaybeRefOrGetter, toValue } from 'vue'
import { useI18n } from 'vue-i18n'
@@ -23,12 +23,15 @@ const timeThresholds: TimeThreshold[] = [
[Infinity, 'year'],
]
// One timer for all the users, which can be a list of a thousand items. It stops when the last user is unmounted
const useSharedTimestamp = createSharedComposable(() => useTimestamp({ interval: 1000 }))
export function useTimeAgo(referenceDate: MaybeRefOrGetter<Date | number | string>) {
const { locale } = useI18n()
const formatter = computed(() => new Intl.RelativeTimeFormat(locale.value, { numeric: 'auto' }))
const now = useTimestamp({ interval: 1000 })
const now = useSharedTimestamp()
const referenceTime = computed(() => new Date(toValue(referenceDate)).getTime())

View File

@@ -0,0 +1,51 @@
import { useTimeAgo } from '@core/composables/locale-time-ago.composable.ts'
import { mountComposable } from '@core-test/mount-composable.ts'
import { nextTick } from 'vue'
const NOW = new Date('2026-01-01T12:00:00Z').getTime()
beforeEach(() => {
vi.useFakeTimers({ now: NOW })
})
afterEach(() => {
vi.useRealTimers()
})
function mountTimeAgo(referenceDate: number) {
return mountComposable(() => ({ timeAgo: useTimeAgo(referenceDate) })).wrapper
}
it('formats the time elapsed since the reference date', () => {
expect(mountTimeAgo(NOW - 30_000).vm.timeAgo).toBe('30 seconds ago')
expect(mountTimeAgo(NOW - 2 * 60 * 60_000).vm.timeAgo).toBe('2 hours ago')
})
it('updates as time goes by', async () => {
const wrapper = mountTimeAgo(NOW - 30_000)
vi.advanceTimersByTime(60_000)
await nextTick()
expect(wrapper.vm.timeAgo).toBe('1 minute ago')
})
it('shares one timer between all its users, until the last one is unmounted', () => {
const timerCount = vi.getTimerCount()
const first = mountTimeAgo(NOW)
expect(vi.getTimerCount()).toBe(timerCount + 1)
const second = mountTimeAgo(NOW)
expect(vi.getTimerCount()).toBe(timerCount + 1)
first.unmount()
expect(vi.getTimerCount()).toBe(timerCount + 1)
second.unmount()
expect(vi.getTimerCount()).toBe(timerCount)
})

View File

@@ -1,2 +1,8 @@
export { useLeftSidebarStore, useRightSidebarStore, useSidebar } from '@core/packages/sidebar/sidebar.store.ts'
export { SIDES, SIDEBAR_DEFAULTS, type SidebarSide, type SidebarState } from '@core/packages/sidebar/types.ts'
export {
SIDES,
SIDEBAR_DEFAULTS,
SIDEBAR_TRANSITION_DURATION,
type SidebarSide,
type SidebarState,
} from '@core/packages/sidebar/types.ts'

View File

@@ -14,6 +14,8 @@ export type SidebarState = ResizableWidth & {
cssUnlockedOffset: string | number
}
export const SIDEBAR_TRANSITION_DURATION = 250
export const SIDEBAR_DEFAULTS = {
left: { isExpanded: true, isLocked: true },
right: { isExpanded: false, isLocked: false },

View File

@@ -1,7 +1,7 @@
{
"name": "@xen-orchestra/web-core",
"type": "module",
"version": "0.66.1",
"version": "0.67.0",
"private": false,
"exports": {
"./*": {

View File

@@ -1,6 +1,6 @@
{
"name": "@xen-orchestra/web",
"version": "0.66.1",
"version": "0.66.2",
"type": "module",
"scripts": {
"dev": "vite",
@@ -26,7 +26,7 @@
"@types/d3-time-format": "^4.0.3",
"@types/lodash-es": "^4.17.12",
"@types/node": "^18.19.80",
"@vates/types": "^3.1.0",
"@vates/types": "^3.2.0",
"@vitejs/plugin-vue": "^6.0.0",
"@vitest/ui": "^5.1.2",
"@vue/test-utils": "^2.4.11",
@@ -37,7 +37,7 @@
"@vueuse/shared": "^14.0.0",
"@xen-orchestra/backups": "^1.0.1",
"@xen-orchestra/cron": "^1.0.7",
"@xen-orchestra/web-core": "^0.66.1",
"@xen-orchestra/web-core": "^0.67.0",
"complex-matcher": "^1.1.1",
"d3-time-format": "^4.1.0",
"happy-dom": "^20.0.0",

View File

@@ -28,7 +28,7 @@ export type BackupRepositoryGeneralFormOptions = {
export const ENCRYPTION_KEY_LENGTH = 32
export const ENCRYPTION_KEY_REGEX = new RegExp(`^[0-9a-f]{${ENCRYPTION_KEY_LENGTH}}$`, 'i')
const BACKUP_FORMAT_DOC_URL = 'https://docs.xen-orchestra.com/backups-and-dr/backup-types/incremental_backups#backup-format'
const BACKUP_FORMAT_DOC_URL = 'https://docs.xen-orchestra.com/xo5/incremental_backups'
const MIXED_OPTION_ID = '__MIXED__'

View File

@@ -6,23 +6,38 @@ import MenuItem from '@core/components/menu/MenuItem.vue'
import VtsTaskList from '@core/components/task/VtsTaskList.vue'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
import UiLink from '@core/components/ui/link/UiLink.vue'
import { SIDEBAR_TRANSITION_DURATION, useRightSidebarStore } from '@core/packages/sidebar'
import { createTaskItem } from '@core-test/create-task-item.ts'
import { mount } from '@vue/test-utils'
import { nextTick } from 'vue'
mockXoTaskCollection()
// Tasks started after it are unread
const LAST_SEEN_AT = 200
beforeEach(() => {
taskCollectionMock.reset()
localStorage.setItem('my-tasks.last-seen-at', String(LAST_SEEN_AT))
localStorage.setItem('sidebar.right.expanded', 'true')
})
afterEach(() => {
vi.useRealTimers()
})
function mountSidebar() {
return mount(MyTasksSidebar, { global: createGlobalTestConfig() })
}
function hasTaskList(wrapper: ReturnType<typeof mountSidebar>) {
return wrapper.findComponent(VtsTaskList).exists()
}
async function toggleSidebar(value: boolean) {
useRightSidebarStore().toggleExpand(value)
await nextTick()
}
async function openMenu(wrapper: ReturnType<typeof mountSidebar>) {
await wrapper.getComponent(UiButtonIcon).trigger('click')
@@ -56,3 +71,51 @@ it('cannot mark all tasks as read when none is unread', async () => {
expect(item.props('disabled')).toBe(true)
})
describe('task list rendering', () => {
beforeEach(() => {
taskCollectionMock.lastDayTasks.value = [createTaskItem({ id: 'task', status: 'success', start: 100, end: 150 })]
})
it('does not render the tasks while the sidebar is collapsed', async () => {
localStorage.setItem('sidebar.right.expanded', 'false')
const wrapper = mountSidebar()
expect(hasTaskList(wrapper)).toBe(false)
await toggleSidebar(true)
expect(hasTaskList(wrapper)).toBe(true)
})
it('keeps rendering the tasks while the sidebar slides out', async () => {
vi.useFakeTimers()
const wrapper = mountSidebar()
await toggleSidebar(false)
vi.advanceTimersByTime(SIDEBAR_TRANSITION_DURATION - 1)
await nextTick()
expect(hasTaskList(wrapper)).toBe(true)
vi.advanceTimersByTime(1)
await nextTick()
expect(hasTaskList(wrapper)).toBe(false)
})
it('keeps rendering the tasks when the sidebar expands again while sliding out', async () => {
vi.useFakeTimers()
const wrapper = mountSidebar()
await toggleSidebar(false)
await toggleSidebar(true)
vi.advanceTimersByTime(SIDEBAR_TRANSITION_DURATION)
await nextTick()
expect(hasTaskList(wrapper)).toBe(true)
})
})

View File

@@ -38,20 +38,22 @@
</div>
</template>
<VtsStateHero v-if="hasTaskFetchError" format="card" type="error" size="medium">
{{ t('error-no-data') }}
</VtsStateHero>
<VtsStateHero v-else-if="!areTasksReady || isSearching" format="panel" type="busy" size="medium" />
<VtsTaskList
v-else-if="displayedTasks.length > 0"
:tasks="displayedTasks"
:selected-task-id="openedTaskId"
:expand-all="hasSearch"
:unread-task-ids
/>
<VtsStateHero v-else format="card" type="no-result" size="medium">
{{ hasSearch ? t('no-result') : t('no-task') }}
</VtsStateHero>
<template v-if="isTasksListRendered">
<VtsStateHero v-if="hasTaskFetchError" format="card" type="error" size="medium">
{{ t('error-no-data') }}
</VtsStateHero>
<VtsStateHero v-else-if="!areTasksReady || isSearching" format="panel" type="busy" size="medium" />
<VtsTaskList
v-else-if="displayedTasks.length > 0"
:tasks="displayedTasks"
:selected-task-id="openedTaskId"
:expand-all="hasSearch"
:unread-task-ids
/>
<VtsStateHero v-else format="card" type="no-result" size="medium">
{{ hasSearch ? t('no-result') : t('no-task') }}
</VtsStateHero>
</template>
</VtsLayoutSidebar>
</template>
@@ -68,10 +70,11 @@ import UiInput from '@core/components/ui/input/UiInput.vue'
import UiLink from '@core/components/ui/link/UiLink.vue'
import { useDebouncedSearch } from '@core/composables/debounced-search.composable.ts'
import { vTooltip } from '@core/directives/tooltip.directive.ts'
import { useRightSidebarStore } from '@core/packages/sidebar'
import { SIDEBAR_TRANSITION_DURATION, useRightSidebarStore } from '@core/packages/sidebar'
import { useUiStore } from '@core/stores/ui.store.ts'
import { filterTasksByName } from '@core/utils/task.util.ts'
import { computed, watch } from 'vue'
import { useTimeoutFn } from '@vueuse/core'
import { computed, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRoute } from 'vue-router'
@@ -90,6 +93,28 @@ watch(
}
)
const isTasksListRendered = ref(rightSidebar.isExpanded)
const { start: hideContentAfterSlide, stop: cancelHideContent } = useTimeoutFn(
() => {
isTasksListRendered.value = false
},
SIDEBAR_TRANSITION_DURATION,
{ immediate: false }
)
watch(
() => rightSidebar.isExpanded,
isExpanded => {
if (isExpanded) {
cancelHideContent()
isTasksListRendered.value = true
} else {
hideContentAfterSlide()
}
}
)
const { search, debouncedSearch, isSearching } = useDebouncedSearch()
const hasSearch = computed(() => debouncedSearch.value.trim() !== '')

View File

@@ -1,7 +1,9 @@
import { useXoTaskNameResolver } from '@/modules/task/composables/xo-task-name-resolver.composable.ts'
import type { FrontXoTask } from '@/modules/task/remote-resources/use-xo-task-collection.ts'
import { convertXoTaskToCore } from '@/modules/task/utils/convert-xo-task-to-core.util.ts'
import { reuseUnchangedTasks } from '@/modules/task/utils/reuse-unchanged-tasks.util.ts'
import { useXoUserCollection } from '@/modules/user/remote-resources/use-xo-user-collection.ts'
import type { Task } from '@core/components/ui/task-item/UiTaskItem.vue'
import { toComputed } from '@core/utils/to-computed.util.ts'
import type { XoUser } from '@vates/types'
import { computed, type MaybeRefOrGetter } from 'vue'
@@ -12,18 +14,21 @@ export function useXoTasksConversion(rawTasks: MaybeRefOrGetter<FrontXoTask[]>)
const tasks = toComputed(rawTasks)
const convertedTasks = computed(() =>
tasks.value.map(task => {
const userId = task.properties.userId
const convertedTasks = computed<Task[]>(previousTasks =>
reuseUnchangedTasks(
previousTasks,
tasks.value.map(task => {
const userId = task.properties.userId
if (!userId) {
return convertXoTaskToCore(task, { nameResolver: resolveTaskName })
}
if (!userId) {
return convertXoTaskToCore(task, { nameResolver: resolveTaskName })
}
const user = getUserById(userId as XoUser['id'])
const userName = user?.name ?? user?.email
return convertXoTaskToCore(task, { userName, nameResolver: resolveTaskName })
})
const user = getUserById(userId as XoUser['id'])
const userName = user?.name ?? user?.email
return convertXoTaskToCore(task, { userName, nameResolver: resolveTaskName })
})
)
)
return { convertedTasks }

View File

@@ -1,13 +1,17 @@
import { useXoTaskCollection } from '@/modules/task/remote-resources/use-xo-task-collection.ts'
import { getBatchProgress } from '@/modules/task/utils/xo-tasks-pending.util.ts'
import { keepIfEqual } from '@/shared/utils/keep-if-equal.util.ts'
import { createSharedComposable } from '@vueuse/core'
import { computed, ref, watch } from 'vue'
export const useXoTasksPending = createSharedComposable(() => {
const { lastDayTasks } = useXoTaskCollection()
const pendingTaskIds = computed(() =>
lastDayTasks.value.filter(task => task.status === 'pending').map(task => task.id)
const pendingTaskIds = computed<string[]>(previousIds =>
keepIfEqual(
previousIds,
lastDayTasks.value.filter(task => task.status === 'pending').map(task => task.id)
)
)
const pendingCount = computed(() => pendingTaskIds.value.length)
@@ -23,8 +27,11 @@ export const useXoTasksPending = createSharedComposable(() => {
{ immediate: true }
)
const pendingProgress = computed(() =>
batchTaskIds.value.size === 0 ? undefined : getBatchProgress(lastDayTasks.value, batchTaskIds.value)
const pendingProgress = computed<ReturnType<typeof getBatchProgress> | undefined>(previousProgress =>
keepIfEqual(
previousProgress,
batchTaskIds.value.size === 0 ? undefined : getBatchProgress(lastDayTasks.value, batchTaskIds.value)
)
)
return { pendingCount, pendingProgress }

View File

@@ -61,6 +61,24 @@ describe('pendingProgress', () => {
expect(wrapper.vm.pendingProgress).toEqual({ value: 100, maxValue: 200 })
})
it('keeps the same object when the tasks change without changing the progress', async () => {
lastDayTasks.value = [
createTaskItem({ id: 'running', status: 'pending', start: 300, progress: 40 }),
createTaskItem({ id: 'done', status: 'success', start: 100, end: 200 }),
]
const { wrapper } = mountPendingTasks()
const progress = wrapper.vm.pendingProgress
lastDayTasks.value = [
createTaskItem({ id: 'running', status: 'pending', start: 300, progress: 40, warnings: [] }),
createTaskItem({ id: 'done', status: 'success', start: 100, end: 250 }),
]
await nextTick()
expect(wrapper.vm.pendingProgress).toBe(progress)
})
it('is cleared once every task of the batch is done, and the next batch starts fresh', async () => {
lastDayTasks.value = [createTaskItem({ id: 'first', status: 'pending', start: 300 })]

View File

@@ -6,6 +6,7 @@ import {
getUnreadTaskIds,
pruneReadActivity,
} from '@/modules/task/utils/xo-tasks-unread.util.ts'
import { keepIfEqual } from '@/shared/utils/keep-if-equal.util.ts'
import { findTask } from '@core/utils/task.util.ts'
import { createSharedComposable, useLocalStorage } from '@vueuse/core'
import { computed, type MaybeRefOrGetter, onScopeDispose, readonly, ref, toValue, watch } from 'vue'
@@ -65,7 +66,9 @@ export const useXoTasksUnread = createSharedComposable(() => {
{ immediate: true }
)
const unreadTaskIds = computed(() => getUnreadTaskIds(lastDayTasks.value, lastSeenAt.value, readActivityById.value))
const unreadTaskIds = computed<Set<string>>(previousIds =>
keepIfEqual(previousIds, getUnreadTaskIds(lastDayTasks.value, lastSeenAt.value, readActivityById.value))
)
const unreadTasks = computed(() => lastDayTasks.value.filter(task => unreadTaskIds.value.has(task.id)))

View File

@@ -48,6 +48,18 @@ describe('unreadTaskIds', () => {
expect([...wrapper.vm.unreadTaskIds].sort()).toEqual(['a', 'root'])
})
it('keeps the same set when the tasks change without changing the unread ones', async () => {
lastDayTasks.value = [createTree(), createTaskItem({ id: 'old', start: 50, end: 150 })]
const { wrapper } = mountUnreadTasks()
const unreadTaskIds = wrapper.vm.unreadTaskIds
lastDayTasks.value = [createTree(), createTaskItem({ id: 'old', start: 50, end: 160 })]
await nextTick()
expect(wrapper.vm.unreadTaskIds).toBe(unreadTaskIds)
})
it('no longer contains a parent once its only unread subtask is opened', () => {
lastDayTasks.value = [createTree()]

View File

@@ -1,9 +1,11 @@
import { useXoTaskNameResolver } from '@/modules/task/composables/xo-task-name-resolver.composable.ts'
import { convertXoTaskToCore } from '@/modules/task/utils/convert-xo-task-to-core.util.ts'
import { reuseUnchangedTasks } from '@/modules/task/utils/reuse-unchanged-tasks.util.ts'
import { findTaskById, getTaskRoute } from '@/modules/task/utils/xo-task.util.ts'
import { useWatchCollection } from '@/shared/composables/watch-collection.composable.ts'
import { useXoCollectionState } from '@/shared/composables/xo-collection-state/use-xo-collection-state.ts'
import { BASE_URL } from '@/shared/utils/fetch.util.ts'
import type { Task } from '@core/components/ui/task-item/UiTaskItem.vue'
import type { ResourceContext } from '@core/packages/remote-resource/types.ts'
import { defineRemoteResource } from '@core/packages/remote-resource/define-remote-resource.ts'
import type { XoTask } from '@vates/types'
@@ -34,10 +36,10 @@ export function createTaskCollectionState<TArgs extends any[] = []>(
const sortedTasks = useSorted(tasks, (task1, task2) => task2.start - task1.start)
const { resolveTaskName } = useXoTaskNameResolver()
const lastDayTasks = computed(() => {
const lastDayTasks = computed<Task[]>(previousTasks => {
const now = Date.now()
return sortedTasks.value
const tasks = sortedTasks.value
.filter(task => now - task.start < ONE_DAY)
.map(task =>
convertXoTaskToCore(task, {
@@ -45,6 +47,8 @@ export function createTaskCollectionState<TArgs extends any[] = []>(
nameResolver: resolveTaskName,
})
)
return reuseUnchangedTasks(previousTasks, tasks)
})
const getTaskById = (taskId: FrontXoTask['id']) => {

View File

@@ -0,0 +1,42 @@
import type { Task } from '@core/components/ui/task-item/UiTaskItem.vue'
import { isEqual } from 'lodash-es'
// Keeps the previous object of each task that did not change, subtasks included, so the components it is passed to
// can skip their update. Returns the previous list itself when no task changed
export function reuseUnchangedTasks(previousTasks: Task[] | undefined, nextTasks: Task[]): Task[] {
if (previousTasks === undefined) {
return nextTasks
}
const previousTasksById = new Map(previousTasks.map(task => [task.id, task]))
const tasks = nextTasks.map(task => reuseUnchangedTask(previousTasksById.get(task.id), task))
if (hasSameTasks(tasks, previousTasks)) {
return previousTasks
}
return hasSameTasks(tasks, nextTasks) ? nextTasks : tasks
}
function hasSameTasks(tasks: Task[], otherTasks: Task[]) {
return tasks.length === otherTasks.length && tasks.every((task, index) => task === otherTasks[index])
}
// A changed task keeps its new object, which reuses its unchanged subtasks
function reuseUnchangedTask(previousTask: Task | undefined, nextTask: Task): Task {
if (previousTask === undefined) {
return nextTask
}
const { subtasks: previousSubtasks, ...previousFields } = previousTask
const { subtasks: nextSubtasks, ...nextFields } = nextTask
const subtasks = nextSubtasks === undefined ? undefined : reuseUnchangedTasks(previousSubtasks, nextSubtasks)
if (subtasks === previousSubtasks && isEqual(previousFields, nextFields)) {
return previousTask
}
return subtasks === nextSubtasks ? nextTask : { ...nextTask, subtasks }
}

View File

@@ -0,0 +1,99 @@
import { reuseUnchangedTasks } from '@/modules/task/utils/reuse-unchanged-tasks.util.ts'
import { createTaskItem } from '@core-test/create-task-item.ts'
// Each call builds new objects, like a new conversion of the same raw tasks
function createTasks() {
return [
createTaskItem({
id: 'root',
start: 100,
nameParts: [{ text: 'VM', to: { name: '/vm/[id]/dashboard', params: { id: 'vm' } } }],
warnings: [{ message: 'warning', data: { size: 1 } }],
subtasks: [createTaskItem({ id: 'sub-1', start: 110 }), createTaskItem({ id: 'sub-2', start: 120 })],
}),
createTaskItem({ id: 'other', start: 200 }),
]
}
it('returns the new tasks when there are no previous ones', () => {
const tasks = createTasks()
expect(reuseUnchangedTasks(undefined, tasks)).toBe(tasks)
})
it('returns the previous list when no task changed', () => {
const previousTasks = createTasks()
expect(reuseUnchangedTasks(previousTasks, createTasks())).toBe(previousTasks)
})
it('reuses the unchanged tasks and keeps the changed ones', () => {
const previousTasks = createTasks()
const nextTasks = createTasks()
nextTasks[1].end = 300
const tasks = reuseUnchangedTasks(previousTasks, nextTasks)
expect(tasks).not.toBe(previousTasks)
expect(tasks[0]).toBe(previousTasks[0])
expect(tasks[1]).toBe(nextTasks[1])
})
it('reuses the unchanged subtasks of a changed task', () => {
const previousTasks = createTasks()
const nextTasks = createTasks()
nextTasks[0].subtasks![1].end = 300
const [root] = reuseUnchangedTasks(previousTasks, nextTasks)
expect(root).not.toBe(previousTasks[0])
expect(root).toEqual(nextTasks[0])
expect(root.subtasks![0]).toBe(previousTasks[0].subtasks![0])
expect(root.subtasks![1]).toBe(nextTasks[0].subtasks![1])
})
it('sees a change in the resolved name of a task', () => {
const previousTasks = createTasks()
const nextTasks = createTasks()
nextTasks[0].nameParts![0].text = 'Renamed VM'
const [root] = reuseUnchangedTasks(previousTasks, nextTasks)
expect(root).not.toBe(previousTasks[0])
expect(root).toEqual(nextTasks[0])
})
it('sees a change in the data of a warning', () => {
const previousTasks = createTasks()
const nextTasks = createTasks()
nextTasks[0].warnings![0].data = { size: 2 }
const [root] = reuseUnchangedTasks(previousTasks, nextTasks)
expect(root).not.toBe(previousTasks[0])
expect(root).toEqual(nextTasks[0])
})
it('sees a subtask being added', () => {
const previousTasks = createTasks()
const nextTasks = createTasks()
nextTasks[1].subtasks = [createTaskItem({ id: 'new-sub' })]
expect(reuseUnchangedTasks(previousTasks, nextTasks)[1]).toEqual(nextTasks[1])
})
it('reuses the tasks of a list with added, removed or moved tasks', () => {
const previousTasks = createTasks()
const [root, other] = createTasks()
const newTask = createTaskItem({ id: 'new', start: 300 })
const [addedTask, keptTask] = reuseUnchangedTasks(previousTasks, [newTask, other])
expect(addedTask).toBe(newTask)
expect(keptTask).toBe(previousTasks[1])
const [firstTask, secondTask] = reuseUnchangedTasks(previousTasks, [other, root])
expect(firstTask).toBe(previousTasks[1])
expect(secondTask).toBe(previousTasks[0])
})

View File

@@ -0,0 +1,6 @@
import { isEqual } from 'lodash-es'
// Returns `previous` when `next` is deeply equal to it: a computed returning it then doesn't trigger its dependents
export function keepIfEqual<T>(previous: T | undefined, next: T): T {
return previous !== undefined && isEqual(previous, next) ? previous : next
}

View File

@@ -0,0 +1,21 @@
import { keepIfEqual } from '@/shared/utils/keep-if-equal.util.ts'
it('returns the next value when there is no previous one', () => {
const next = ['a']
expect(keepIfEqual(undefined, next)).toBe(next)
})
it('returns the previous value when the next one is deeply equal', () => {
const previous = { value: 40, maxValue: 100 }
const previousIds = new Set(['a', 'b'])
expect(keepIfEqual(previous, { value: 40, maxValue: 100 })).toBe(previous)
expect(keepIfEqual(previousIds, new Set(['b', 'a']))).toBe(previousIds)
})
it('returns the next value when it differs', () => {
const next = new Set(['a', 'c'])
expect(keepIfEqual(new Set(['a', 'b']), next)).toBe(next)
})

View File

@@ -1,6 +1,6 @@
{
"name": "@xen-orchestra/xapi",
"version": "10.0.0",
"version": "10.1.0",
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/xapi",
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
"repository": {

View File

@@ -1,16 +1,21 @@
# ChangeLog
## **next** (2026-11-24)
## **6.11.0** (2026-11-30)
<img id="latest" src="https://badgen.net/badge/channel/latest/yellow" alt="Channel: latest" />
### Security
- Fix authentication token validation
- Cookies set by xo-server now default to `SameSite=Lax`, overridable with `[http.cookie] sameSite` in the xo-server configuration
- XOA updater access now requires administrator credentials (PR [#10857](https://github.com/vatesfr/xen-orchestra/pull/10857))
- [Auth/LDAP] Prevent signing in with an empty or null password on directories that accept unauthenticated binds (e.g. Active Directory)
- [Backup/File restore] Symbolic links are no longer followed: browsing or downloading a path that goes through one is refused, and the links met inside a restored folder are skipped (PR [#9941](https://github.com/vatesfr/xen-orchestra/pull/9941))
- [Backup/Live mount] The iSCSI target of a mount only accepts connections from the host it is mounted on. **If the hosts reach XO or the proxy through a NAT**, set `iscsi.restrictToHost = false`, or live mounts fail (PR [#10426](https://github.com/vatesfr/xen-orchestra/pull/10426))
- [Plugins/audit] Redact more sensitive values from new audit records (created API tokens, credentials and encryption keys in URLs, one-time download/upload links) (PR [#10618](https://github.com/vatesfr/xen-orchestra/pull/10618))
- [Proxy] The proxy authentication token is no longer exposed by the API. **The `url` property of a proxy no longer contains a URL** but a message explaining its removal: scripts relying on it must be updated (PR [#10810](https://github.com/vatesfr/xen-orchestra/pull/10810))
- [Settings/Forwarded headers] When `http.useForwardedHeaders` lists an IPv4 subnet written in IPv6 notation with a short prefix (e.g. `::ffff:10.0.0.0/8`), only the proxies in that subnet are trusted: any client could send its own `X-Forwarded-For` and choose the IP address XO sees (PR [#XXXX](https://github.com/vatesfr/xen-orchestra/pull/XXXX))
- [REST API] Add CSRF protection
- [Settings/Forwarded headers] When `http.useForwardedHeaders` lists an IPv4 subnet written in IPv6 notation with a short prefix (e.g. `::ffff:10.0.0.0/8`), only the proxies in that subnet are trusted: any client could send its own `X-Forwarded-For` and choose the IP address XO sees (PR [#10853](https://github.com/vatesfr/xen-orchestra/pull/10853))
### Enhancements
@@ -24,6 +29,7 @@
- [Forms] Dropdown lists can show a success state with a check icon (PR [#10882](https://github.com/vatesfr/xen-orchestra/pull/10882))
- [Header] On mobile, the XO 5 link and third party apps are grouped in a "More actions" menu (PR [#10744](https://github.com/vatesfr/xen-orchestra/pull/10744))
- [Hosts] The host actions of the treeview (change state, restart toolstack, enable or disable, detach, forget, download bugtools archive) are also available in host tables and side panels (PR [#10821](https://github.com/vatesfr/xen-orchestra/pull/10821))
- [i18n] Update Czech, Danish, Dutch, German, Korean, Portuguese, Portuguese (Brasil), Slovak, Spanish, Swedish and Turkish translations (PR [#10680](https://github.com/vatesfr/xen-orchestra/pull/10680))
- [Logs] The syslog transport (`[logs.transport.syslog]` in xo-server configuration) supports TLS (`tls://`), and the facility, application name and framing can be configured (PR [#10619](https://github.com/vatesfr/xen-orchestra/pull/10619))
- [Logs] **Breaking:** logs are now sent to syslog as RFC 5424 messages, with their namespace as message ID, instead of RFC 3164 messages: set `format = 'rfc3164'` in `[logs.transport.syslog]` to keep the previous format (PR [#10619](https://github.com/vatesfr/xen-orchestra/pull/10619))
- [Menus] Submenus open when hovering their option and can be reached diagonally without opening the neighbouring ones, Escape closes them one level at a time, and menu buttons are announced to screen readers (PR [#10827](https://github.com/vatesfr/xen-orchestra/pull/10827))
@@ -77,6 +83,7 @@
- [V2V] Optional `startVm` once the import is complete: a docked guest is followed through its first boot (Windows drivers and agent installation, with a diagnosis of the VM when it does not complete), then Secure Boot is enabled again when the source had it (PR [#10621](https://github.com/vatesfr/xen-orchestra/pull/10621))
- [V2V] Import from ESXi 6.5 hosts whose data port only accepts RSA key exchange (PR [#10802](https://github.com/vatesfr/xen-orchestra/pull/10802))
- [V2V] Import from ESXi 6.5 and 6.7 hosts through a vCenter (PR [#10819](https://github.com/vatesfr/xen-orchestra/pull/10819))
- [VDI] Disks of running VMs can be resized when XAPI supports online resize (PR [#10845](https://github.com/vatesfr/xen-orchestra/pull/10845))
- [VM] Select multiple VMs in VM tables to change their power state, snapshot or delete them at once (PR [#10780](https://github.com/vatesfr/xen-orchestra/pull/10780))
- [VM] Add and remove VM tags from the VM dashboard and the VM side panel (PR [#10804](https://github.com/vatesfr/xen-orchestra/pull/10804))
- [VM] The VM creation form is now a 3-step workflow: choose the pool and the template, configure the VM, then review every setting (with the values overridden from the template highlighted) before creating it. Required fields are checked at each step, and a failed creation shows its error details without losing the form (PR [#10851](https://github.com/vatesfr/xen-orchestra/pull/10851))
@@ -107,6 +114,7 @@
- [Pools] Pool side panel now shows the same pool name, UUID and icon as the pools table, and keeps the pool card when the pool is disconnected or unreachable (PR [#10714](https://github.com/vatesfr/xen-orchestra/pull/10714))
- [Replication] Fix `Cannot read properties of undefined (reading 'uuid')` error when an orphan replica snapshot exists on the target SR (PR [#10732](https://github.com/vatesfr/xen-orchestra/pull/10732))
- [REST API] `GET /rest/v0/tasks/{id}?wait=true` now returns when a backup, metadata backup or restore ends, instead of waiting until the task is interrupted (PR [#10778](https://github.com/vatesfr/xen-orchestra/pull/10778))
- [REST API] Fix Basic authentication when the password contains a colon, contribution by [@pcbeingused333](https://github.com/pcbeingused333) [#10782](https://github.com/vatesfr/xen-orchestra/issues/10782) (PR [#10801](https://github.com/vatesfr/xen-orchestra/pull/10801))
- [REST API/Tasks] Aborting a running backup task that can't be aborted now fails with `forbidden operation` instead of `no such task` (with `sync=true`: 403 instead of 404) (PR [#10778](https://github.com/vatesfr/xen-orchestra/pull/10778))
- [REST API/SDN Controller] A traffic rule can no longer be given the priority 0, which XAPI reserves, in `add_traffic_rule`, `update_traffic_rule` and the JSON-RPC methods `sdnController.addRule` and `sdnController.addNetworkRule`; a rule that already has it can still be deleted, or updated to another priority (PR [#10738](https://github.com/vatesfr/xen-orchestra/pull/10738))
- [SDN Controller] Taking control of a bridge no longer restricts it to OpenFlow 1.1, which broke the VIF locking flows XAPI installs with OpenFlow 1.0, and the bridges an older version restricted get OpenFlow 1.0 back (PR [#10691](https://github.com/vatesfr/xen-orchestra/pull/10691))
@@ -116,6 +124,7 @@
- [Side panels] Closing a side panel in one browser tab no longer closes it in the other tabs, where the eye buttons stopped working (PR [#10869](https://github.com/vatesfr/xen-orchestra/pull/10869))
- [Site] The site pages are no longer displayed below a loader while pools are loading (PR [#10923](https://github.com/vatesfr/xen-orchestra/pull/10923))
- [Tables] The "Show more"/"Show less" button of long texts stays at the top right of the cell, and expanding every text of a column no longer squeezes it to one letter per line (PR [#10873](https://github.com/vatesfr/xen-orchestra/pull/10873))
- [Tasks] Fix XO 6 freezes caused by the "My tasks" sidebar (PR [#10935](https://github.com/vatesfr/xen-orchestra/pull/10935))
- [Tooltips] Short tooltips near the edge of the screen no longer wrap onto two lines (PR [#10822](https://github.com/vatesfr/xen-orchestra/pull/10822))
- [Treeview] Fix translations of the tooltip for VM and host statuses in treeview (PR [#10643](https://github.com/vatesfr/xen-orchestra/pull/10643))
- [Treeview] The treeview scrollbar can be dragged again: the resize handle, which covered it, now sits just outside the treeview (PR [#10886](https://github.com/vatesfr/xen-orchestra/pull/10886))
@@ -144,7 +153,6 @@
- @xen-orchestra/audit-core 0.4.1
- @xen-orchestra/autopilot-docking 0.1.0
- @xen-orchestra/backup-archive 1.2.1
- @xen-orchestra/xapi 10.0.0
- @xen-orchestra/backups-cli 1.1.19
- @xen-orchestra/cr-seed-cli 1.0.4
- @xen-orchestra/disk-cli 2.2.6
@@ -154,7 +162,6 @@
- @xen-orchestra/qa-test 1.5.0
- xapi-explore-sr 0.4.9
- xo-server-audit 0.16.0
- xo-server-auth-ldap 0.10.13
- xo-server-backup-reports 1.7.2
- xo-server-ipmi-sensors 2.1.2
- xo-server-load-balancer 0.14.1
@@ -168,19 +175,28 @@
- xo-web 5.209.0
- xo-collection 1.0.1
- @vates/nbd-client 3.7.2
- @vates/types 3.1.0
- @xen-orchestra/backups 1.0.1
- @xen-orchestra/web-core 0.66.1
- @xen-orchestra/proxy 0.35.1
- @xen-orchestra/vmware-explorer 1.4.0
- @xen-orchestra/rest-api 0.43.0
- @xen-orchestra/web 0.66.1
- xo-server 5.214.1
- @vates/types 3.2.0
- @xen-orchestra/xapi 10.1.0
- @xen-orchestra/web-core 0.67.0
- @xen-orchestra/proxy 0.35.2
- @xen-orchestra/rest-api 0.43.1
- @xen-orchestra/web 0.66.2
- xo-server 5.214.2
- xo-server-auth-ldap 0.10.14
## **6.10.2** (2026-11-30)
<img id="stable" src="https://badgen.net/badge/channel/stable/green" alt="Channel: stable" />
### Security
- [Auth/LDAP] Prevent signing in with an empty or null password on directories that accept unauthenticated binds (e.g. Active Directory)
- [REST API] Add CSRF protection
## **6.10.0** (2026-10-29)
<img id="latest" src="https://badgen.net/badge/channel/latest/yellow" alt="Channel: latest" />
### Security
- [Backup/Live mount] A connection to the iSCSI target that has not logged in yet, such as a port scan or a failed CHAP login, no longer interrupts the mounted disk (PR [#10465](https://github.com/vatesfr/xen-orchestra/pull/10465))
@@ -332,8 +348,6 @@
## **6.9.1** (2026-10-05)
<img id="stable" src="https://badgen.net/badge/channel/stable/green" alt="Channel: stable" />
### Bug fixes
- [Servers] Fix servers stuck in `Connecting` state when using an HTTPS proxy that support HTTP/2 ([Forum#12502](https://xcp-ng.org/forum/topic/12502/xoa-6.9-update)) (PR [#10507](https://github.com/vatesfr/xen-orchestra/pull/10507))

View File

@@ -9,15 +9,10 @@
> Users must be able to say: "Nice enhancement, I'm eager to test it"
- [i18n] Update Czech, Danish, Dutch, German, Korean, Portuguese, Portuguese (Brasil), Slovak, Spanish, Swedish and Turkish translations (PR [#10680](https://github.com/vatesfr/xen-orchestra/pull/10680))
- [VDI] Disks of running VMs can be resized when XAPI supports online resize (PR [#10845](https://github.com/vatesfr/xen-orchestra/pull/10845))
### Bug fixes
> Users must be able to say: "I had this issue, happy to know it's fixed"
- [Backup repositories] The _Learn more_ link of the incremental backup format now opens the documentation section explaining block-based vs VHD file
### Packages to release
> When modifying a package, add it here with its release type.
@@ -34,11 +29,4 @@
<!--packages-start-->
- @vates/types minor
- @xen-orchestra/rest-api patch
- @xen-orchestra/web patch
- @xen-orchestra/web-core minor
- @xen-orchestra/xapi minor
- xo-server patch
<!--packages-end-->

View File

@@ -99,42 +99,6 @@ The merge is performed on the files stored on the BR: the hosts are not involved
In the Backup view, create a new VM backup job and enable the **Delta Backup** mode: this is the incremental mode (the XO 5 interface still uses the historical Delta Backup name for this toggle). Everything else (VM selection, schedules, retention, choice of backup repository) works like a normal backup job.
## Backup format: block-based or VHD file {#backup-format}
The disks of an incremental backup can be stored in two formats on the backup repository (BR). The format is a setting of the **BR**, not of the backup job: in XO 6 it is the **Incremental backup format** field of the BR form, in XO 5 the **Store backup as multiple data blocks instead of a whole VHD file** option of the remote.
| | Block-based | VHD file |
| --- | --- | --- |
| How a disk is stored | A directory of small data blocks (2 MiB each), plus the disk metadata | One `.vhd` file per disk and per backup |
| Maximum disk size | No 2 TiB limit | **2 TiB** |
| Merge of old deltas | Fast: blocks are moved, not copied | Slower: data is copied into the parent file |
| Encryption | Supported | Not supported |
| S3 and Azure BRs | Required (the only available format) | Not available |
| Number of files | 500 to 1,000 files per GiB of backed up data | A few files per backup |
**Use block-based** in most cases, and always if:
- a disk is larger than 2 TiB,
- you want to [encrypt the BR](../backup-features-and-settings.md#backup-encryption),
- the BR is an S3 or Azure object storage (the format is forced).
**Use VHD file** only if every disk is smaller than 2 TiB and the storage behind the BR handles a very large number of files poorly.
### Requirements for block-based BRs
On file system BRs (NFS, SMB, local), the storage must:
- handle a large number of files: 500 to 1,000 files per GiB of backed up data, so millions of files for a few TiB of backups. Check the inode limits of the file system and the file count limits of your NAS.
- support parallel access: up to 16 write processes per backup.
:::warning
The format can't be changed once the BR is created. To switch format, create a new BR and point your jobs to it: the next run is a full backup.
:::
:::note
This setting only applies to incremental backups. [Full backups](./full_backups.md) are always stored as XVA files.
:::
## Snapshots
Incremental backups rely on a reference snapshot kept on the VM. Unlike other job types, which delete their snapshot once the export is done, an incremental job always keeps the latest snapshot of every VM in the job and uses it as the reference for the next delta. Do not delete these snapshots!
@@ -257,5 +221,5 @@ Sometimes, you might notice that incremental backups are surprisingly large, alm
- Ensure your VM has enough memory to prevent excessive paging.
- Create a separated disk with `[NOBAK]` in its name to handle temporary files. This disk won't be transferred.
To know more on excluding disks from backup jobs, check out the [Exclude disks](../backup-features-and-settings.md#exclude-disks) section.
- For disks larger than **2 TiB**, store backups on a [block-based backup repository](#backup-format).
- For disks larger than **2 TB**, store backups on a backup repository in **block mode**.
- For **qcow2** disks, [enable NBD](#nbd-enabled-backups): without it, each incremental run falls back to a full backup.

View File

@@ -1,6 +1,6 @@
{
"name": "xo-server-auth-ldap",
"version": "0.10.13",
"version": "0.10.14",
"license": "AGPL-3.0-or-later",
"description": "LDAP authentication plugin for XO-Server",
"keywords": [

View File

@@ -374,8 +374,9 @@ class AuthLdap {
}
async _authenticate({ username, password }) {
if (username === undefined || password === undefined) {
logger.debug('require `username` and `password` to authenticate!')
// an empty password bind is an LDAP unauthenticated bind, which some directories accept
if (typeof username !== 'string' || username === '' || typeof password !== 'string' || password === '') {
logger.debug('require non-empty string `username` and `password` to authenticate!')
return null
}

View File

@@ -356,6 +356,51 @@ describe('multi-domain authentication', () => {
// ===================================================================
describe('AuthLdap._authenticate credential guard', () => {
// Regression: an empty password bind is an LDAP unauthenticated bind, accepted by AD
function withLdapMocks() {
let searchEntries = []
const bindCalls = []
mock.method(Client.prototype, 'bind', async function (dn, password) {
bindCalls.push({ dn, password })
})
mock.method(Client.prototype, 'search', async function () {
return { searchEntries }
})
const plugin = createPlugin({ xo: { registerUser2: async (provider, { user: { id } }) => ({ id: `xo-${id}` }) } })
plugin._domains = [PRIMARY_DOMAIN]
return {
setEntries: entries => (searchEntries = entries),
bindCalls,
plugin,
}
}
for (const credentials of [
{ username: 'alice', password: null },
{ username: 'alice', password: undefined },
{ username: 'alice', password: '' },
{ username: '', password: 'secret' },
{ username: 'alice' },
]) {
test(`rejects ${JSON.stringify(credentials)} without binding`, async () => {
const { plugin, bindCalls } = withLdapMocks()
assert.equal(await plugin._authenticate(credentials), null)
assert.equal(bindCalls.length, 0)
})
}
test('still authenticates valid string credentials', async () => {
const { plugin, setEntries, bindCalls } = withLdapMocks()
setEntries([{ dn: 'uid=alice,dc=primary,dc=com', uid: 'alice' }])
const result = await plugin._authenticate({ username: 'alice', password: 'secret' })
assert.equal(result.userId, 'xo-alice')
assert.deepEqual(bindCalls, [{ dn: 'uid=alice,dc=primary,dc=com', password: 'secret' }])
})
})
// ===================================================================
describe('ldap.synchronizeGroups API', () => {
function makeApiPlugin(domains) {
let capturedMethods

View File

@@ -28,7 +28,7 @@
},
"dependencies": {
"@isaacs/ttlcache": "^1.4.1",
"@vates/types": "^3.1.0",
"@vates/types": "^3.2.0",
"@xen-orchestra/log": "^1.0.0",
"xo-common": "^0.11.0"
},

View File

@@ -31,7 +31,7 @@
"dependencies": {
"@vates/async-each": "^1.0.3",
"@vates/coalesce-calls": "^0.1.0",
"@vates/types": "^3.1.0",
"@vates/types": "^3.2.0",
"@xen-orchestra/log": "^1.0.0",
"json5": "^2.2.3",
"undici": "^6.2.1"

View File

@@ -31,7 +31,7 @@
"dependencies": {
"@vates/async-each": "^1.0.3",
"@vates/coalesce-calls": "^0.1.0",
"@vates/types": "^3.1.0",
"@vates/types": "^3.2.0",
"@xen-orchestra/log": "^1.0.0",
"@xen-orchestra/openflow": "^0.1.4",
"ipaddr.js": "^2.0.1",

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "xo-server",
"version": "5.214.1",
"version": "5.214.2",
"license": "AGPL-3.0-or-later",
"description": "Server part of Xen-Orchestra",
"keywords": [
@@ -47,7 +47,7 @@
"@vates/read-chunk": "^1.2.1",
"@vates/syslog": "^0.2.0",
"@vates/task": "^0.7.0",
"@vates/types": "^3.1.0",
"@vates/types": "^3.2.0",
"@vates/xml": "^2.0.0",
"@vates/xml-rpc": "^1.0.0",
"@xen-orchestra/async-map": "^0.1.5",
@@ -61,11 +61,11 @@
"@xen-orchestra/mixin": "^0.2.1",
"@xen-orchestra/mixins": "^0.24.0",
"@xen-orchestra/qcow2": "^1.4.1",
"@xen-orchestra/rest-api": "^0.43.0",
"@xen-orchestra/rest-api": "^0.43.1",
"@xen-orchestra/self-signed": "^0.2.1",
"@xen-orchestra/template": "^0.1.1",
"@xen-orchestra/vmware-explorer": "^1.4.0",
"@xen-orchestra/xapi": "^10.0.0",
"@xen-orchestra/xapi": "^10.1.0",
"@xen-orchestra/xva": "^1.0.3",
"ajv": "^8.0.3",
"app-conf": "^3.0.0",

View File

@@ -94,7 +94,7 @@
#
# See https://www.npmjs.com/package/cookie#options-1
[http.cookies]
#sameSite = true
#sameSite = 'lax'
#secure = true
# Basic HTTP.

View File

@@ -23,6 +23,13 @@ export async function signIn(credentials) {
}
signIn.description = 'sign in'
signIn.params = {
email: { type: 'string', optional: true },
username: { type: 'string', optional: true },
password: { type: 'string', optional: true },
token: { type: 'string', optional: true },
otp: { type: 'string', optional: true },
}
signIn.permission = null // user does not need to be authenticated
// -------------------------------------------------------------------

View File

@@ -170,6 +170,13 @@ const DEFAULT_HELMET_CONFIG = {
// `/v5/netdata` self-proxies to `/netdata` (see config.toml)
const CSP_EXEMPT_PREFIXES = ['/v5/netdata', '/netdata']
function cookieConfig(cookieCfg) {
return {
sameSite: 'lax',
...cookieCfg,
}
}
async function createExpressApp(config) {
const app = createExpress()
@@ -227,7 +234,9 @@ async function createExpressApp(config) {
// Registers the body-parser middleware, necessary for Passport to
// access the username and password from the sign in form.
app.use(bodyParser.urlencoded({ extended: false }))
const signInBodyParser = bodyParser.urlencoded({ extended: false })
app.use('/signin', signInBodyParser)
app.use('/signin-otp', signInBodyParser)
// Registers Passport's middlewares.
app.use(passport.initialize())
@@ -335,7 +344,7 @@ async function setUpPassport(express, xo, { authentication: authCfg, http: { coo
if (clientId === undefined) {
clientId = Math.random().toString(36).slice(2)
res.cookie('clientId', clientId, {
...cookieCfg,
...cookieConfig(cookieCfg),
// no reason for this entry to ever expire, can be set to a long duration
maxAge: TEN_YEARS,
@@ -357,7 +366,7 @@ async function setUpPassport(express, xo, { authentication: authCfg, http: { coo
}
const saveToken = async (token, req, res, next) => {
res.cookie('token', token.id, {
...cookieCfg,
...cookieConfig(cookieCfg),
// a session (non-permanent) cookie must not have an expiration date
// because it must not survive browser restart

View File

@@ -1,10 +1,21 @@
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import cloneDeep from 'lodash/cloneDeep.js'
import { invalidParameters } from 'xo-common/api-errors.js'
import { checkParams } from './api.mjs'
import { compileXoJsonSchema } from './_xoJsonSchema.mjs'
import { signIn } from '../api/session.mjs'
const isInvalidParameters = error => error.code === 10 && /forbidden key/.test(error.message)
// Builds the same validator the API layer attaches to a method from its `params`
// schema (mirrors addApiMethod).
const buildMethod = params => ({
validate: compileXoJsonSchema({ type: 'object', properties: cloneDeep(params) }),
})
describe('checkParams()', () => {
it('renames ignorable (?-suffixed) params', () => {
const params = JSON.parse('{"foo?": 1, "bar": 2}')
@@ -24,3 +35,32 @@ describe('checkParams()', () => {
assert.throws(() => checkParams({}, params), isInvalidParameters)
})
})
describe('session.signIn params', () => {
// Regression: a `null` password reached LDAP and became an unauthenticated bind
const method = buildMethod(signIn.params)
for (const badPassword of [null, 42, true, {}, []]) {
it(`rejects a non-string password (${JSON.stringify(badPassword)})`, () => {
assert.throws(
() => checkParams(method, { username: 'alice', password: badPassword }),
error => invalidParameters.is(error, ({ errors }) => Array.isArray(errors) && errors.length > 0)
)
})
}
it('rejects an unknown credentials key', () => {
assert.throws(() => checkParams(method, { username: 'alice', password: 'p', evil: true }))
})
for (const params of [
{ username: 'alice', password: 'secret' },
{ email: 'alice@corp.local', password: 'secret' },
{ email: 'alice@corp.local', password: 'secret', otp: '123456' },
{ token: 'a-token' },
]) {
it(`accepts ${JSON.stringify(params)}`, () => {
checkParams(method, params)
})
}
})

View File

@@ -160,3 +160,25 @@ describe('Authentication token provider', () => {
assert.equal(typeof token.last_uses['192.0.2.1'].timestamp, 'number')
})
})
describe('Authentication password guard', () => {
for (const password of [null, '', 42, {}]) {
it(`rejects ${format(password)} without calling any provider`, async () => {
const { authentication } = createAuthentication()
const providerCalls = []
authentication.registerAuthenticationProvider(async credentials => {
providerCalls.push(credentials)
})
await assert.rejects(
authentication.authenticateUser(
{ username: 'alice', password },
{ ip: '192.0.2.1' },
{ bypassTaskCreation: true }
),
/empty password/
)
assert.equal(providerCalls.length, 0)
})
}
})

View File

@@ -171,9 +171,9 @@ export default class {
}
const auth = async () => {
// don't even attempt to authenticate with empty password
// don't even attempt to authenticate with an empty or non-string password
const { password } = credentials
if (password === '') {
if (password !== undefined && (typeof password !== 'string' || password === '')) {
throw new Error('empty password')
}