diff --git a/.github/workflows/agora-token-service-tests.yml b/.github/workflows/agora-token-service-tests.yml new file mode 100644 index 0000000000..365c63516f --- /dev/null +++ b/.github/workflows/agora-token-service-tests.yml @@ -0,0 +1,62 @@ +name: agora-token-service tests +on: + pull_request: + types: [opened, synchronize, reopened] + paths: + - 'deploy/docker/agora-token-service/**' + - '.github/workflows/agora-token-service-tests.yml' +permissions: + contents: read +jobs: + test: + name: Test (Node ${{ matrix.node-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [26.x] + defaults: + run: + shell: bash + working-directory: deploy/docker/agora-token-service + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: npm + cache-dependency-path: deploy/docker/agora-token-service/package-lock.json + - name: Install + run: npm ci --ignore-scripts + - name: Test + env: + NODE_OPTIONS: --test-reporter=tap + run: | + set -o pipefail + node -v + npm test 2>&1 | tee "$RUNNER_TEMP/node-test.tap" + - name: Check the test summary + env: + MIN_PASS: 14 + TODO: 1 + REQUIRED_TITLES: | + token: publisher uid token has channel, uid, expiry and privileges + token: signature verifies with the certificate and fails with another + token: subscriber userAccount token defaults to 3600 s and privilege 1 + errors: short path, unknown path and POST are 404 + run: | + log="$RUNNER_TEMP/node-test.tap" + grep -qx 'TAP version 13' "$log" || { echo "::error::$log is not TAP output"; exit 1; } + read -r pass fail cancelled skipped todo < <(awk '/^# (pass|fail|cancelled|skipped|todo) [0-9]+$/ { v[$2] = $3 } END { printf "%s %s %s %s %s\n", v["pass"] == "" ? -1 : v["pass"], v["fail"] == "" ? -1 : v["fail"], v["cancelled"] == "" ? -1 : v["cancelled"], v["skipped"] == "" ? -1 : v["skipped"], v["todo"] == "" ? -1 : v["todo"] }' "$log") + echo "pass $pass, fail $fail, cancelled $cancelled, skipped $skipped, todo $todo" + grep -E '^ *(not )?ok [0-9]+ - .* # TODO' "$log" || echo "no todo tests" + [ "$fail" = 0 ] && [ "$cancelled" = 0 ] && [ "$skipped" = 0 ] && [ "$todo" = "$TODO" ] && [ "$pass" -ge "$MIN_PASS" ] \ + || { echo "::error::expected fail 0, cancelled 0, skipped 0, todo $TODO, pass >= $MIN_PASS"; exit 1; } + n=0 + while IFS= read -r t; do + [ -n "$t" ] || continue + awk -v t="$t" '{ l = $0 } sub(/^ *ok [0-9]+ - /, "", l) && l == t { f = 1 } END { exit !f }' "$log" || { echo "::error::no passing test titled: $t"; exit 1; } + n=$((n + 1)) + done <<< "$REQUIRED_TITLES" + [ "$n" -gt 0 ] || { echo "::error::REQUIRED_TITLES is empty"; exit 1; } + echo "$n required titles passed" diff --git a/.github/workflows/agora-token-service.yml b/.github/workflows/agora-token-service.yml index a73f240b61..7f2f271f1a 100644 --- a/.github/workflows/agora-token-service.yml +++ b/.github/workflows/agora-token-service.yml @@ -10,6 +10,7 @@ on: - 'deploy/docker/agora-token-service/**' - '.github/workflows/agora-token-service.yml' - '.github/workflows/build-service-image.yml' + - '!deploy/docker/agora-token-service/test/**' permissions: contents: read diff --git a/.github/workflows/hocuspocus-tests.yml b/.github/workflows/hocuspocus-tests.yml new file mode 100644 index 0000000000..a2a61ac766 --- /dev/null +++ b/.github/workflows/hocuspocus-tests.yml @@ -0,0 +1,69 @@ +name: hocuspocus tests +on: + pull_request: + types: [opened, synchronize, reopened] + paths: + - 'client/packages/lowcoder/hocuspocus-server.js' + - 'deploy/docker/hocuspocus/**' + - 'deploy/docker/Dockerfile' + - 'deploy/helm/tests/runtime/hocuspocus-sync.mjs' + - 'deploy/helm/tests/runtime-test.sh' + - 'client/yarn.lock' + - 'server/proxy-service/yarn.lock' + - '.github/workflows/hocuspocus-tests.yml' +permissions: + contents: read +jobs: + test: + name: Test (Node ${{ matrix.node-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [26.x] + defaults: + run: + shell: bash + working-directory: deploy/docker/hocuspocus/test + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: npm + cache-dependency-path: deploy/docker/hocuspocus/test/package-lock.json + - name: Install + run: npm ci --ignore-scripts + - name: Test + env: + NODE_OPTIONS: --test-reporter=tap + run: | + set -o pipefail + node -v + npm test 2>&1 | tee "$RUNNER_TEMP/node-test.tap" + - name: Check the test summary + env: + MIN_PASS: 11 + TODO: 1 + REQUIRED_TITLES: | + health: GET /health reports ok and the auth state + secret: sync with the secret + secret: wrong and empty tokens are refused with permission-denied + versions: @hocuspocus/server matches both Dockerfile ARGs + start: a second server on the same port exits non-zero + run: | + log="$RUNNER_TEMP/node-test.tap" + grep -qx 'TAP version 13' "$log" || { echo "::error::$log is not TAP output"; exit 1; } + read -r pass fail cancelled skipped todo < <(awk '/^# (pass|fail|cancelled|skipped|todo) [0-9]+$/ { v[$2] = $3 } END { printf "%s %s %s %s %s\n", v["pass"] == "" ? -1 : v["pass"], v["fail"] == "" ? -1 : v["fail"], v["cancelled"] == "" ? -1 : v["cancelled"], v["skipped"] == "" ? -1 : v["skipped"], v["todo"] == "" ? -1 : v["todo"] }' "$log") + echo "pass $pass, fail $fail, cancelled $cancelled, skipped $skipped, todo $todo" + grep -E '^ *(not )?ok [0-9]+ - .* # TODO' "$log" || echo "no todo tests" + [ "$fail" = 0 ] && [ "$cancelled" = 0 ] && [ "$skipped" = 0 ] && [ "$todo" = "$TODO" ] && [ "$pass" -ge "$MIN_PASS" ] \ + || { echo "::error::expected fail 0, cancelled 0, skipped 0, todo $TODO, pass >= $MIN_PASS"; exit 1; } + n=0 + while IFS= read -r t; do + [ -n "$t" ] || continue + awk -v t="$t" '{ l = $0 } sub(/^ *ok [0-9]+ - /, "", l) && l == t { f = 1 } END { exit !f }' "$log" || { echo "::error::no passing test titled: $t"; exit 1; } + n=$((n + 1)) + done <<< "$REQUIRED_TITLES" + [ "$n" -gt 0 ] || { echo "::error::REQUIRED_TITLES is empty"; exit 1; } + echo "$n required titles passed" diff --git a/.github/workflows/hocuspocus.yml b/.github/workflows/hocuspocus.yml index 673b502a4c..e7c06b58e7 100644 --- a/.github/workflows/hocuspocus.yml +++ b/.github/workflows/hocuspocus.yml @@ -11,6 +11,7 @@ on: - 'deploy/docker/hocuspocus/**' - '.github/workflows/hocuspocus.yml' - '.github/workflows/build-service-image.yml' + - '!deploy/docker/hocuspocus/test/**' permissions: contents: read diff --git a/.github/workflows/node-service.yml b/.github/workflows/node-service.yml index 9040de5d5e..bc5c104924 100644 --- a/.github/workflows/node-service.yml +++ b/.github/workflows/node-service.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [ 22.x ] + node-version: [ 24.x, 26.x ] steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/proxy-service-tests.yml b/.github/workflows/proxy-service-tests.yml new file mode 100644 index 0000000000..e9e25ca59f --- /dev/null +++ b/.github/workflows/proxy-service-tests.yml @@ -0,0 +1,66 @@ +name: proxy-service tests +on: + pull_request: + types: [opened, synchronize, reopened] + paths: + - 'server/proxy-service/**' + - '.github/workflows/proxy-service-tests.yml' +permissions: + contents: read +jobs: + test: + name: Test (Node ${{ matrix.node-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [26.x] + defaults: + run: + shell: bash + working-directory: server/proxy-service + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Ensure Yarn 1.22.22 + run: | + if [ "$(yarn --version 2>/dev/null)" = 1.22.22 ]; then echo "yarn 1.22.22 already on PATH"; else echo "yarn on PATH: $(yarn --version 2>/dev/null || echo none); installing 1.22.22"; npm install -g --ignore-scripts yarn@1.22.22; fi + [ "$(yarn --version)" = 1.22.22 ] || { echo "::error::yarn $(yarn --version), expected 1.22.22"; exit 1; } + - name: Install + run: yarn install --frozen-lockfile --ignore-scripts + - name: Test + env: + NODE_OPTIONS: --test-reporter=tap + run: | + set -o pipefail + node -v + yarn test 2>&1 | tee "$RUNNER_TEMP/node-test.tap" + - name: Check the test summary + env: + MIN_PASS: 58 + TODO: 0 + REQUIRED_TITLES: | + auth: secret rejects a token of another scope + google: published responder URL is accepted and cleaned + website session: public https URL gives 200 and a proxied URL + typeform route: upstream headers are rewritten + google-forms route: http target with a session token is 502 + website route: loopback target with a session token is 400 + run: | + log="$RUNNER_TEMP/node-test.tap" + grep -qx 'TAP version 13' "$log" || { echo "::error::$log is not TAP output"; exit 1; } + read -r pass fail cancelled skipped todo < <(awk '/^# (pass|fail|cancelled|skipped|todo) [0-9]+$/ { v[$2] = $3 } END { printf "%s %s %s %s %s\n", v["pass"] == "" ? -1 : v["pass"], v["fail"] == "" ? -1 : v["fail"], v["cancelled"] == "" ? -1 : v["cancelled"], v["skipped"] == "" ? -1 : v["skipped"], v["todo"] == "" ? -1 : v["todo"] }' "$log") + echo "pass $pass, fail $fail, cancelled $cancelled, skipped $skipped, todo $todo" + grep -E '^ *(not )?ok [0-9]+ - .* # TODO' "$log" || echo "no todo tests" + [ "$fail" = 0 ] && [ "$cancelled" = 0 ] && [ "$skipped" = 0 ] && [ "$todo" = "$TODO" ] && [ "$pass" -ge "$MIN_PASS" ] \ + || { echo "::error::expected fail 0, cancelled 0, skipped 0, todo $TODO, pass >= $MIN_PASS"; exit 1; } + n=0 + while IFS= read -r t; do + [ -n "$t" ] || continue + awk -v t="$t" '{ l = $0 } sub(/^ *ok [0-9]+ - /, "", l) && l == t { f = 1 } END { exit !f }' "$log" || { echo "::error::no passing test titled: $t"; exit 1; } + n=$((n + 1)) + done <<< "$REQUIRED_TITLES" + [ "$n" -gt 0 ] || { echo "::error::REQUIRED_TITLES is empty"; exit 1; } + echo "$n required titles passed" diff --git a/.github/workflows/sonarcloud-build.yml b/.github/workflows/sonarcloud-build.yml index 5e8d1adb08..cf91bd2138 100644 --- a/.github/workflows/sonarcloud-build.yml +++ b/.github/workflows/sonarcloud-build.yml @@ -38,9 +38,12 @@ jobs: - name: Build Java run: | - # Downstream modules need the SDK's shared test-helper JAR, which is - # attached during package. Keep test compilation enabled for that JAR. - mvn --batch-mode --no-transfer-progress clean package -DskipTests -f ./server/api-service/pom.xml + # verify, not package: it runs the unit and integration tests under JaCoCo (the + # integration tests start Mongo and Redis containers through Docker, which the + # runner provides), writes the aggregate coverage report that Sonar reads, and runs + # the coverage gate of lowcoder-coverage-report, which fails the build when a module + # falls below its floor. The SDK's shared test-helper JAR is attached on the way. + mvn --batch-mode --no-transfer-progress clean verify -f ./server/api-service/pom.xml - name: Package binaries and metadata env: @@ -59,6 +62,10 @@ jobs: IFS=',' read -r -a dirs <<< "$binaries" # tar fails if a listed directory is missing. tar --create --file "$out/sonar-binaries.tar" -- "${dirs[@]}" + # The aggregate JaCoCo report of every module; the scan job hands it to Sonar as data. + report=server/api-service/lowcoder-coverage-report/target/site/jacoco-aggregate/jacoco.xml + [ -f "$report" ] || { echo "$report not found" >&2; exit 1; } + cp -- "$report" "$out/jacoco.xml" jq -n \ --arg event "$EVENT_NAME" \ --arg pr_number "$PR_NUMBER" \ diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index e265b47f4a..e010ba52cc 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -3,7 +3,8 @@ name: Sonarcloud # TRUSTED half of the SonarCloud analysis; the only place SONAR_TOKEN is used. # It runs from the default branch via workflow_run and never executes PR code: the PR # tree is checked out as data and the artifact from "Sonarcloud Build" is validated -# before use. Not covered: the scanner still parses untrusted sources and class files. +# before use. Not covered: the scanner still parses untrusted sources, class files and the +# JaCoCo coverage report (jacoco.xml) from that artifact. on: workflow_run: # zizmor: ignore[dangerous-triggers] artifact and PR tree are handled as data only workflows: ["Sonarcloud Build"] @@ -91,4 +92,5 @@ jobs: -Dsonar.organization=lowcoder -Dsonar.projectKey=lowcoder-org_lowcoder -Dsonar.working.directory=${{ runner.temp }}/scannerwork + -Dsonar.coverage.jacoco.xmlReportPaths=${{ runner.temp }}/sonar-artifact/jacoco.xml ${{ steps.target.outputs.scanner_args }} diff --git a/app.json b/app.json index e20bff7494..7b33747e39 100644 --- a/app.json +++ b/app.json @@ -122,7 +122,7 @@ "required": true }, "LOWCODER_SUPERUSER_PASSWORD": { - "description": "Password of the Super-User, if not present or empty, it will be generated", + "description": "Password of the Super-User. When set, it replaces the stored password at every start. When empty, a password is generated only while the account has none (first start) and printed once into the log; later starts keep the stored password", "value": "`generated and printed into log file", "required": true }, diff --git a/client/packages/lowcoder/src/comps/controls/iconControl.test.tsx b/client/packages/lowcoder/src/comps/controls/iconControl.test.tsx new file mode 100644 index 0000000000..6a54ef7b9d --- /dev/null +++ b/client/packages/lowcoder/src/comps/controls/iconControl.test.tsx @@ -0,0 +1,110 @@ +import { render, screen } from "@testing-library/react"; +import { IconDictionary, resetIconDictionary } from "@lowcoder-ee/constants/iconConstants"; +import { IconControlView } from "./iconControl"; + +/** + * `useIcon` of lowcoder-design loads its icon table asynchronously and keeps the icon in state, set in an effect keyed by the + * `/icon:` key of the value (`""` for any other value). The stand-in has the same shape over a fake table, and sets the icon + * synchronously inside the effect, so a rerender settles within `act`. It is a plain function, not `jest.fn`: the shared jest + * config has `resetMocks: true`, which clears `jest.fn` implementations before each test. + */ +jest.mock("lowcoder-design", () => { + const actual = jest.requireActual("lowcoder-design"); + const React = jest.requireActual("react"); + const FAKE_ICONS: Record unknown }> = { + "solid/star": { title: "Star", getView: () => React.createElement("span", { "data-testid": "icon-marker" }) }, + }; + const keyOf = (value?: string) => { + const unquoted = actual.removeQuote(value); + return unquoted.startsWith(actual.iconPrefix) ? unquoted.slice(actual.iconPrefix.length) : ""; + }; + function useStandInIcon(value?: string) { + const key = keyOf(value); + const [icon, setIcon] = React.useState(undefined); + React.useEffect(() => { + setIcon(FAKE_ICONS[key]); + }, [key]); + return icon; + } + return { ...actual, useIcon: useStandInIcon }; +}); + +const ICON_VALUE = "/icon:solid/star"; +const IMAGE_URI = "data:image/png;base64,iVBORw0KGgo="; +const PLAIN_TEXT = "hello"; +const QUOTED_EMPTY = '""'; +const MARKER = "icon-marker"; + +function drawnAs(container: HTMLElement) { + const img = container.querySelector("img"); + return { + marker: screen.queryByTestId(MARKER) !== null, + imgSrc: img ? img.getAttribute("src") : null, + markup: container.innerHTML, + }; +} + +function show(label: string, value: string, container: HTMLElement) { + console.log(`[iconControl.test] ${label}: value=${JSON.stringify(value)} -> ${JSON.stringify(drawnAs(container))}`); +} + +beforeEach(() => { + resetIconDictionary(); +}); + +describe("IconControlView after the value changes", () => { + it("draws the image of a data URI after an icon name, and caches nothing under the URI", () => { + const { container, rerender } = render(); + show("start", ICON_VALUE, container); + expect(drawnAs(container).marker).toBe(true); + + rerender(); + show("after the switch", IMAGE_URI, container); + expect(drawnAs(container).imgSrc).toBe(IMAGE_URI); + expect(drawnAs(container).marker).toBe(false); + expect(IconDictionary[IMAGE_URI]).toBeUndefined(); + }); + + it("draws the icon again when the value goes from an image to an icon name", () => { + const { container, rerender } = render(); + show("start", IMAGE_URI, container); + expect(drawnAs(container).imgSrc).toBe(IMAGE_URI); + + rerender(); + show("after the switch", ICON_VALUE, container); + expect(drawnAs(container).marker).toBe(true); + expect(drawnAs(container).imgSrc).toBeNull(); + }); + + it("draws plain text as an image after an icon name, as a page loaded with that text does", () => { + const { container, rerender } = render(); + expect(drawnAs(container).marker).toBe(true); + + rerender(); + show("after the switch", PLAIN_TEXT, container); + expect(drawnAs(container).imgSrc).toBe(PLAIN_TEXT); + expect(drawnAs(container).marker).toBe(false); + }); + + it("draws nothing for an empty value after an icon name", () => { + const { container, rerender } = render(); + expect(drawnAs(container).marker).toBe(true); + + rerender(); + show("after the switch", "", container); + expect(drawnAs(container).marker).toBe(false); + expect(drawnAs(container).imgSrc).toBeNull(); + }); + + it("pins the known limit: a quoted empty value keeps the old icon after an icon name, cached under it", () => { + const { container, rerender } = render(); + expect(drawnAs(container).marker).toBe(true); + + rerender(); + show("after the switch", QUOTED_EMPTY, container); + // not wanted, only not covered by the fix: a later change of what the quoted empty value draws changes this case on purpose + expect(drawnAs(container).marker).toBe(true); + expect(drawnAs(container).imgSrc).toBeNull(); + expect(IconDictionary[QUOTED_EMPTY]).toBeDefined(); + }); +}); diff --git a/client/packages/lowcoder/src/comps/controls/iconControl.tsx b/client/packages/lowcoder/src/comps/controls/iconControl.tsx index 56439bc878..6247be2ba5 100644 --- a/client/packages/lowcoder/src/comps/controls/iconControl.tsx +++ b/client/packages/lowcoder/src/comps/controls/iconControl.tsx @@ -214,6 +214,15 @@ export const IconControlView = memo((props: { value: string }) => { const icon = useIcon(value); return useMemo(() => { + // A value that is not an icon reference is drawn as an image at once. `useIcon` updates its icon in an effect, so in the + // first render after a switch from an icon name `icon` is still the OLD icon: the cache below would store it under the + // new value, and the cache check would then keep returning it for good. + // Limits: a value that unquotes to empty (the quoted empty `'""'`) still takes the icon path below and can be cached; a + // switch from one icon name to another still renders the old icon for one render. + if (value && !isSelectValue(removeQuote(value))) { + return ; + } + if (value && IconDictionary[value] && IconDictionary[value]?.title === icon?.title) { return IconDictionary[value]; } diff --git a/client/packages/lowcoder/src/layout/calculateUtils.test.ts b/client/packages/lowcoder/src/layout/calculateUtils.test.ts new file mode 100644 index 0000000000..d2da551a2f --- /dev/null +++ b/client/packages/lowcoder/src/layout/calculateUtils.test.ts @@ -0,0 +1,78 @@ +import { + calcGridItemSizePx, + calcWH, + convertDroppingSize, + DEFAULT_POSITION_PARAMS, + PositionParams, +} from "./calculateUtils"; + +const MEASURED_WIDTH = 1200; +const DROPPED_W = 10; +const DROPPED_H = 6; +const EQUAL_ROW_HEIGHT = 8; +const DIFFERENT_ROW_HEIGHT = 16; +const HALF_WIDTH = MEASURED_WIDTH / 2; + +function measured(overrides: Partial = {}): PositionParams { + return { ...DEFAULT_POSITION_PARAMS, containerWidth: MEASURED_WIDTH, ...overrides }; +} + +/** What the conversion answers for a source: the pixel size in the source grid, converted into the target's units. */ +function converted(target: PositionParams, source: PositionParams, w: number, h: number) { + const { width, height } = calcGridItemSizePx(source, w, h); + return calcWH(target, width, height, { w: false, h: false, ceil: false }); +} + +function show(label: string, input: unknown, output: unknown) { + console.log(`[calculateUtils.test] ${label}: in=${JSON.stringify(input)} out=${JSON.stringify(output)}`); +} + +describe("convertDroppingSize", () => { + it("keeps the given size when there are no source parameters", () => { + const out = convertDroppingSize(measured(), undefined, DROPPED_W, DROPPED_H); + show("no source", { w: DROPPED_W, h: DROPPED_H }, out); + expect(out).toEqual({ w: DROPPED_W, h: DROPPED_H }); + }); + + it("keeps the given width of an unmeasured source and converts the height (equal row heights)", () => { + const target = measured({ rowHeight: EQUAL_ROW_HEIGHT }); + const out = convertDroppingSize(target, DEFAULT_POSITION_PARAMS, DROPPED_W, DROPPED_H); + const expected = converted(target, DEFAULT_POSITION_PARAMS, DROPPED_W, DROPPED_H); + show("unmeasured source, equal row height", { w: DROPPED_W, h: DROPPED_H, expectedConversion: expected }, out); + // the conversion itself answers a width of 0 for the unmeasured source: this is what the guard is for + expect(expected.w).toBe(0); + expect(out.w).toBe(DROPPED_W); + expect(out.h).toBe(expected.h); + }); + + it("keeps the given width of an unmeasured source and still converts the height when the row heights differ", () => { + const target = measured({ rowHeight: DIFFERENT_ROW_HEIGHT }); + const out = convertDroppingSize(target, DEFAULT_POSITION_PARAMS, DROPPED_W, DROPPED_H); + const expected = converted(target, DEFAULT_POSITION_PARAMS, DROPPED_W, DROPPED_H); + show("unmeasured source, different row height", { w: DROPPED_W, h: DROPPED_H, expectedConversion: expected }, out); + expect(out.w).toBe(DROPPED_W); + expect(out.h).toBe(expected.h); + // the converted height is not the given one, so this case tells a kept conversion from a bypassed one + expect(out.h).not.toBe(DROPPED_H); + }); + + it("returns the conversion, equal to the input, for a measured source equal to the target", () => { + const target = measured(); + const out = convertDroppingSize(target, measured(), DROPPED_W, DROPPED_H); + const expected = converted(target, measured(), DROPPED_W, DROPPED_H); + show("measured equal source", { w: DROPPED_W, h: DROPPED_H, expectedConversion: expected }, out); + expect(out).toEqual(expected); + expect(out).toEqual({ w: DROPPED_W, h: DROPPED_H }); + }); + + it("converts the width of a measured source of half the target's width", () => { + const target = measured(); + const source = measured({ containerWidth: HALF_WIDTH }); + const out = convertDroppingSize(target, source, DROPPED_W, DROPPED_H); + const expected = converted(target, source, DROPPED_W, DROPPED_H); + show("measured half-width source", { w: DROPPED_W, h: DROPPED_H, expectedConversion: expected }, out); + expect(out).toEqual(expected); + // half the container width means half the pixels per column: the same pixel size is about half the columns + expect(out.w).toBe(DROPPED_W / 2); + }); +}); diff --git a/client/packages/lowcoder/src/layout/calculateUtils.tsx b/client/packages/lowcoder/src/layout/calculateUtils.tsx index 44a661e001..153080902c 100644 --- a/client/packages/lowcoder/src/layout/calculateUtils.tsx +++ b/client/packages/lowcoder/src/layout/calculateUtils.tsx @@ -191,6 +191,33 @@ export function calcWH( return { w, h }; } +/** + * Converts the size of a component dragged over a grid from the grid it came from (source) to the grid it is dropped on + * (target), in grid units, so that the component keeps its size in pixels when it crosses containers. + * + * The width goes through the source's column width, which needs a measured container width. A source that has not been + * measured yet (`containerWidth` 0, the stored default until the first measurement arrives) has a column width of 0, so + * its width conversion would answer 0 columns; for such a source the given `w` is kept as it is. The height goes through + * the source's row height only and is always converted. + * + * Limits: for an unmeasured source the given `w` is used in the target's columns unconverted, so a drop into a nested + * container narrower than the source in that window gets the given column count, not the proportional one. An unmeasured + * TARGET is not handled: its own width conversion divides by its column width. + */ +export function convertDroppingSize( + positionParams: PositionParams, + sourcePositionParams: PositionParams | undefined, + w: number, + h: number +): { w: number; h: number } { + if (!sourcePositionParams) { + return { w, h }; + } + const { width, height } = calcGridItemSizePx(sourcePositionParams, w, h); + const converted = calcWH(positionParams, width, height, { w: false, h: false, ceil: false }); + return { w: sourcePositionParams.containerWidth > 0 ? converted.w : w, h: converted.h }; +} + // Similar to _.clamp export function clamp(num: number, lowerBound?: number, upperBound?: number): number { if (!_.isNil(lowerBound)) { diff --git a/client/packages/lowcoder/src/layout/gridLayout.tsx b/client/packages/lowcoder/src/layout/gridLayout.tsx index 5fe89cb4cf..d841a34909 100644 --- a/client/packages/lowcoder/src/layout/gridLayout.tsx +++ b/client/packages/lowcoder/src/layout/gridLayout.tsx @@ -14,6 +14,7 @@ import { calcRowCount, calcWH, calcXY, + convertDroppingSize, DEFAULT_ROW_COUNT, genPositionParams, PositionParams, @@ -604,16 +605,7 @@ class GridLayout extends React.Component { const positionParams: PositionParams = genPositionParams(this.props); // convert grid units, in order to keep comps' size stable when they are through containers const sourcePositionParams = onDragOverResult?.positionParams; - if (sourcePositionParams) { - const { width, height } = calcGridItemSizePx(sourcePositionParams, w, h); - // log.debug("layout: sourceTransform. w: ", w, " h: ", h, " sourcePositinParams: ", sourcePositionParams, " width: ", width, " height: ", height); - const { w: ww, h: hh } = calcWH(positionParams, width, height, { - w: false, - h: false, - ceil: false, - }); - [w, h] = [ww, hh]; - } + ({ w, h } = convertDroppingSize(positionParams, sourcePositionParams, w, h)); const { width, height } = calcGridItemSizePx(positionParams, w, h); // log.debug("layout: getFinalDroppingItem. w: ", w, " h: ", h, " sourcePositinParams: ", sourcePositionParams, " width: ", width, " height: ", height); left -= width * 0.5; diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index d1b8211918..b0383331ee 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -58,16 +58,18 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal # Add nodejs repo and keys RUN mkdir -p /etc/apt/keyrings \ && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ - && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list + && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_26.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list # Download nodejs and install yarn RUN apt-get update \ - && apt-get install --no-install-recommends -y nodejs=22.23.5-1nodesource1 \ + && apt-get install --no-install-recommends -y nodejs=26.13.1-1nodesource1 \ && npm install -g yarn # Copy and build the node-service app COPY server/node-service/ /lowcoder/node-service/app/ WORKDIR /lowcoder/node-service/app/ +# tree-sitter@0.21.1 has no linux-arm64 prebuild and forces -std=c++17; Node >= 24 headers need C++20 +ENV CXXFLAGS=-std=c++20 RUN yarn --immutable RUN yarn build @@ -90,11 +92,11 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal # Add nodejs repo and keys RUN mkdir -p /etc/apt/keyrings \ && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ - && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list + && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_26.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list # Download nodejs and install yarn RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y nodejs=22.23.5-1nodesource1 gosu \ + && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y nodejs=26.13.1-1nodesource1 gosu \ && npm install -g yarn \ && rm -rf /var/cache/apt/lists \ && addgroup --system --gid 9001 lowcoder \ @@ -119,18 +121,20 @@ CMD [ "/bin/sh", "/lowcoder/node-service/entrypoint.sh" ] ## ## Standalone image is built from server/proxy-service/Dockerfile ## -FROM node:22.23.5-slim AS build-proxy-service +FROM node:26.13.1-slim AS build-proxy-service # Copy only the build inputs, so local build/ and node_modules folders are never picked up COPY server/proxy-service/package.json server/proxy-service/yarn.lock server/proxy-service/tsconfig.json /lowcoder/proxy-service/app/ COPY server/proxy-service/scripts /lowcoder/proxy-service/app/scripts COPY server/proxy-service/src /lowcoder/proxy-service/app/src WORKDIR /lowcoder/proxy-service/app -RUN yarn install --frozen-lockfile +# Node 26 images ship no Yarn +RUN npm install -g --ignore-scripts yarn@1.22.22 +RUN yarn install --frozen-lockfile --ignore-scripts RUN yarn build # Keep only runtime dependencies RUN rm -rf node_modules \ - && yarn install --frozen-lockfile --production \ + && yarn install --frozen-lockfile --production --ignore-scripts \ && yarn cache clean # Copy startup script @@ -144,11 +148,11 @@ RUN chmod +x /lowcoder/proxy-service/*.sh ## ## Standalone image is built from deploy/docker/agora-token-service/Dockerfile ## -FROM node:22.23.5-slim AS build-agora-token-service +FROM node:26.13.1-slim AS build-agora-token-service WORKDIR /lowcoder/agora-token-service/app -COPY deploy/docker/agora-token-service/package.json ./ -RUN npm install --omit=dev +COPY deploy/docker/agora-token-service/package.json deploy/docker/agora-token-service/package-lock.json ./ +RUN npm ci --omit=dev --ignore-scripts COPY deploy/docker/agora-token-service/server.js ./ # Copy startup script @@ -164,7 +168,7 @@ RUN chmod +x /lowcoder/agora-token-service/*.sh ## HOCUSPOCUS_SERVER_VERSION in sync with it. ## @hocuspocus/server 4.x requires node >= 22. ## -FROM node:22.23.5-slim AS build-hocuspocus +FROM node:26.13.1-slim AS build-hocuspocus ARG HOCUSPOCUS_SERVER_VERSION=4.3.0 @@ -358,7 +362,7 @@ RUN apt-get update \ # Add required apt repositories and signing keys RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource-keyring.gpg \ - && echo "deb [signed-by=/usr/share/keyrings/nodesource-keyring.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \ + && echo "deb [signed-by=/usr/share/keyrings/nodesource-keyring.gpg] https://deb.nodesource.com/node_26.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \ && curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg \ && echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb `lsb_release -cs` main" | tee /etc/apt/sources.list.d/redis.list \ && curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb-archive-keyring.gpg \ @@ -376,7 +380,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-ins redis-tools=6:8.12.0-1rl1~jammy1 \ supervisor \ gosu \ - nodejs=22.23.5-1nodesource1 \ + nodejs=26.13.1-1nodesource1 \ openjdk-25-jdk-headless \ && npm install -g yarn \ && rm -rf /var/cache/apt/lists /var/lib/apt/lists/* /var/log/dpkg.log \ diff --git a/deploy/docker/README.md b/deploy/docker/README.md index 2c834560c5..aa18af472c 100644 --- a/deploy/docker/README.md +++ b/deploy/docker/README.md @@ -95,7 +95,7 @@ Image can be configured by setting environment variables. | `LOWCODER_CREATE_WORKSPACE_ON_SIGNUP` | IF LOWCODER_WORKSPACE_MODE = SAAS, controls if a own workspace is created for the user after sign up | `true` | | `LOWCODER_MARKETPLACE_PRIVATE_MODE` | Control if not to show Apps on the local Marketplace to anonymous users | `true` | | `LOWCODER_SUPERUSER_USERNAME` | Username of the Super-User of an Lowcoder Installation | `admin@localhost` | -| `LOWCODER_SUPERUSER_PASSWORD` | Password of the Super-User, if not present or empty, it will be generated | `generated and printed into log file | +| `LOWCODER_SUPERUSER_PASSWORD` | Password of the Super-User. When set, it replaces the stored password at every start. When empty, a password is generated only while the account has none (first start) and printed once into the log; later starts keep the stored password | generated at first start, printed once into the log file | | `LOWCODER_PLUGINS_DIR` | Directory holding lowcoder plugins | `/lowcoder-stacks/plugins` | | `LOWCODER_COOKIE_NAME` | Name of the lowcoder application cookie | `LOWCODER_CE_SELFHOST_TOKEN` | | `LOWCODER_COOKIE_MAX_AGE` | Lowcoder application cookie max age in hours | `24` | @@ -163,7 +163,7 @@ Image can be configured by setting environment variables. | `LOWCODER_CREATE_WORKSPACE_ON_SIGNUP` | IF LOWCODER_WORKSPACE_MODE = SAAS, controls if a own workspace is created for the user after sign up | `true` | | `LOWCODER_MARKETPLACE_PRIVATE_MODE` | Control if not to show Apps on the local Marketplace to anonymous users | `true` | | `LOWCODER_SUPERUSER_USERNAME` | Username of the Super-User of an Lowcoder Installation | `admin@localhost` | -| `LOWCODER_SUPERUSER_PASSWORD` | Password of the Super-User, if not present or empty, it will be generated | `generated and printed into log file | +| `LOWCODER_SUPERUSER_PASSWORD` | Password of the Super-User. When set, it replaces the stored password at every start. When empty, a password is generated only while the account has none (first start) and printed once into the log; later starts keep the stored password | generated at first start, printed once into the log file | | `LOWCODER_PLUGINS_DIR` | Directory holding lowcoder plugins | `/lowcoder-stacks/plugins` | | `LOWCODER_COOKIE_NAME` | Name of the lowcoder application cookie | `LOWCODER_CE_SELFHOST_TOKEN` | | `LOWCODER_COOKIE_MAX_AGE` | Lowcoder application cookie max age in hours | `24` | diff --git a/deploy/docker/agora-token-service/Dockerfile b/deploy/docker/agora-token-service/Dockerfile index ec442ee594..3f81601291 100644 --- a/deploy/docker/agora-token-service/Dockerfile +++ b/deploy/docker/agora-token-service/Dockerfile @@ -1,11 +1,11 @@ -FROM node:22.23.5-alpine +FROM node:26.13.1-alpine WORKDIR /app RUN apk add --no-cache curl -COPY package.json ./ -RUN npm install --omit=dev +COPY package.json package-lock.json ./ +RUN npm ci --omit=dev COPY server.js ./ diff --git a/deploy/docker/agora-token-service/package-lock.json b/deploy/docker/agora-token-service/package-lock.json new file mode 100644 index 0000000000..2e9d152c8c --- /dev/null +++ b/deploy/docker/agora-token-service/package-lock.json @@ -0,0 +1,79 @@ +{ + "name": "lowcoder-agora-token-service", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "lowcoder-agora-token-service", + "version": "0.1.0", + "dependencies": { + "agora-token": "^2.0.4" + } + }, + "node_modules/agora-token": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/agora-token/-/agora-token-2.0.7.tgz", + "integrity": "sha512-DfDXjZjUFyv6NENIDjhMj77KKmA6uG7kMHdpBWXZU3LnLNZ0/jGSsZ4UdQWxaF7ZUETxmnmxvrnVIsUscV3Y5A==", + "license": "ISC", + "dependencies": { + "crc-32": "^1.2.0", + "cuint": "0.2.2", + "md5": "^2.3.0" + } + }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, + "node_modules/cuint": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz", + "integrity": "sha512-d4ZVpCW31eWwCMe1YT3ur7mUDnTXbgwyzaL320DrcRT45rfjYxkt5QWLrmOJ+/UEAI2+fQgKe/fCjR8l4TpRgw==", + "license": "MIT" + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "license": "MIT" + }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "license": "BSD-3-Clause", + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + } + } +} diff --git a/deploy/docker/agora-token-service/package.json b/deploy/docker/agora-token-service/package.json index 87cc0ac7e4..16d8710ec0 100644 --- a/deploy/docker/agora-token-service/package.json +++ b/deploy/docker/agora-token-service/package.json @@ -3,6 +3,9 @@ "private": true, "version": "0.1.0", "main": "server.js", + "scripts": { + "test": "node --test \"test/*.test.js\"" + }, "dependencies": { "agora-token": "^2.0.4" } diff --git a/deploy/docker/agora-token-service/test/server.test.js b/deploy/docker/agora-token-service/test/server.test.js new file mode 100644 index 0000000000..e25a6fbfdb --- /dev/null +++ b/deploy/docker/agora-token-service/test/server.test.js @@ -0,0 +1,273 @@ +// Tests of server.js: the token endpoint, health, CORS and error answers (`npm test`). +// +// server.js starts listening as soon as it is loaded, so every environment gets its own child +// process on a free port. Tokens are decoded with the instance parser of agora-token's +// AccessToken2 (a deep import: if a later agora-token moves it, these tests fail loudly). +// +// External mode: with AGORA_TEST_URL=http://host:port the tests that only need the target run +// against it (token tests also need AGORA_TEST_APP_ID and AGORA_TEST_APP_CERTIFICATE, the +// credentials the target was started with); the tests that need control of its environment or +// would kill it are skipped. +const { test, before, after } = require("node:test"); +const assert = require("node:assert/strict"); +const http = require("node:http"); +const net = require("node:net"); +const path = require("node:path"); +const { spawn } = require("node:child_process"); +const { AccessToken2, kRtcServiceType, kRtmServiceType } = require("agora-token/src/AccessToken2"); + +const SERVER_PATH = path.join(__dirname, "..", "server.js"); +const LOOPBACK = "127.0.0.1"; +const STATUS_OK = 200; +const STATUS_NO_CONTENT = 204; +const STATUS_BAD_REQUEST = 400; +const STATUS_NOT_FOUND = 404; +const READY_TIMEOUT_MS = 15000; +const READY_POLL_MS = 100; +const SERVER_EXIT_TIMEOUT_MS = 5000; +const ISSUE_TS_TOLERANCE_S = 5; +const TOKEN_VERSION_PREFIX = "007"; +const DEFAULT_EXPIRY_S = 3600; +const EXPLICIT_EXPIRY_S = 600; +const CACHE_CONTROL = "private, no-cache, no-store, must-revalidate"; +const CUSTOM_CORS_ORIGIN = "https://app.example.com"; +const WRONG_CERTIFICATE = "00000000000000000000000000000000"; +// Dummy credentials as in deploy/docker/all-in-one/smoke-test.sh +const DUMMY_APP_ID = "0123456789abcdef0123456789abcdef"; +const DUMMY_APP_CERTIFICATE = "fedcba9876543210fedcba9876543210"; + +const EXTERNAL_URL = (process.env.AGORA_TEST_URL ?? "").trim().replace(/\/$/, ""); +const APP_ID = process.env.AGORA_TEST_APP_ID || DUMMY_APP_ID; +const APP_CERTIFICATE = process.env.AGORA_TEST_APP_CERTIFICATE || DUMMY_APP_CERTIFICATE; +const NO_TOKEN_CREDENTIALS = EXTERNAL_URL && !(process.env.AGORA_TEST_APP_ID && process.env.AGORA_TEST_APP_CERTIFICATE); + +const skipExternal = (variable) => (EXTERNAL_URL ? `needs control of ${variable} (AGORA_TEST_URL is set)` : false); +const skipWithoutCredentials = () => + NO_TOKEN_CREDENTIALS ? "needs AGORA_TEST_APP_ID and AGORA_TEST_APP_CERTIFICATE (AGORA_TEST_URL is set)" : false; + +function freePort() { + return new Promise((resolve, reject) => { + const server = net.createServer(); + server.once("error", reject); + server.listen(0, LOOPBACK, () => { + const { port } = server.address(); + server.close(() => resolve(port)); + }); + }); +} + +// One HTTP request; resolves { status, headers, body } +function request(baseUrl, requestPath, { method = "GET", headers = {} } = {}) { + return new Promise((resolve, reject) => { + const url = new URL(requestPath, baseUrl); + const req = http.request({ host: url.hostname, port: url.port, path: url.pathname + url.search, method, headers }, (res) => { + let body = ""; + res.setEncoding("utf8"); + res.on("data", (chunk) => (body += chunk)); + res.on("end", () => resolve({ status: res.statusCode, headers: res.headers, body })); + }); + req.once("error", reject); + req.end(); + }); +} + +// Spawns server.js with `env`; resolves { baseUrl, child, stop, output, exited } +async function startServer(env) { + const port = await freePort(); + const collected = []; + const childEnv = { PATH: process.env.PATH, SERVER_PORT: String(port), ...env }; + const child = spawn(process.execPath, [SERVER_PATH], { env: childEnv, stdio: ["ignore", "pipe", "pipe"] }); + child.stdout.on("data", (chunk) => collected.push(String(chunk))); + child.stderr.on("data", (chunk) => collected.push(String(chunk))); + const output = () => collected.join(""); + const exited = new Promise((resolve) => child.once("exit", (code) => resolve(code))); + const baseUrl = `http://${LOOPBACK}:${port}`; + + const deadline = Date.now() + READY_TIMEOUT_MS; + while (Date.now() < deadline) { + if (child.exitCode !== null) throw new Error(`server exited with ${child.exitCode}:\n${output()}`); + try { + if ((await request(baseUrl, "/ping")).status === STATUS_OK) return { baseUrl, child, stop: () => child.kill(), output, exited }; + } catch { + // not listening yet + } + await new Promise((resolve) => setTimeout(resolve, READY_POLL_MS)); + } + child.kill(); + throw new Error(`server not ready after ${READY_TIMEOUT_MS} ms:\n${output()}`); +} + +// The server under test: the external one, or a child with `env` (credentials by default) +async function connect(env = { APP_ID, APP_CERTIFICATE }) { + if (EXTERNAL_URL) return { baseUrl: EXTERNAL_URL, stop: () => {}, output: () => "(external target: no server output)" }; + return startServer(env); +} + +function failure(res, server) { + return `status ${res.status}, body: ${String(res.body).slice(0, 500)}\n--- server output ---\n${server.output()}`; +} + +// Prints actual and expected before asserting +function check(description, actual, expected) { + console.log(` ${description}: actual=${JSON.stringify(actual)} expected=${JSON.stringify(expected)}`); + assert.deepEqual(actual, expected, description); +} + +function parseToken(token) { + const parser = new AccessToken2(); + assert.equal(parser.from_string(token), true, `token does not parse: ${token}`); + return parser; +} + +const decode = (value) => (Buffer.isBuffer(value) ? value.toString() : value); + +async function tokens(server, requestPath) { + const res = await request(server.baseUrl, requestPath); + assert.equal(res.status, STATUS_OK, failure(res, server)); + const body = JSON.parse(res.body); + return { res, body }; +} + +let shared; + +before(async () => { + shared = await connect(); +}); + +after(() => shared?.stop()); + +test("ping: GET /ping and GET / answer pong", async () => { + for (const requestPath of ["/ping", "/"]) { + const res = await request(shared.baseUrl, requestPath); + assert.equal(res.status, STATUS_OK, failure(res, shared)); + check(`GET ${requestPath}`, JSON.parse(res.body), { message: "pong" }); + } +}); + +test("cors: Access-Control-Allow-Origin is present on ping and token answers", { skip: skipWithoutCredentials() }, async () => { + const ping = await request(shared.baseUrl, "/ping"); + assert.ok(ping.headers["access-control-allow-origin"], failure(ping, shared)); + const { res } = await tokens(shared, "/rte/chan-1/publisher/uid/42"); + assert.ok(res.headers["access-control-allow-origin"], failure(res, shared)); +}); + +test("cors: * by default and CORS_ALLOW_ORIGIN when set", { skip: skipExternal("CORS_ALLOW_ORIGIN") }, async () => { + const defaultServer = await startServer({}); + const customServer = await startServer({ CORS_ALLOW_ORIGIN: CUSTOM_CORS_ORIGIN }); + try { + check("default", (await request(defaultServer.baseUrl, "/ping")).headers["access-control-allow-origin"], "*"); + check("custom", (await request(customServer.baseUrl, "/ping")).headers["access-control-allow-origin"], CUSTOM_CORS_ORIGIN); + } finally { + defaultServer.stop(); + customServer.stop(); + } +}); + +test("options: OPTIONS /ping is 204 with GET, OPTIONS", async () => { + const res = await request(shared.baseUrl, "/ping", { method: "OPTIONS" }); + assert.equal(res.status, STATUS_NO_CONTENT, failure(res, shared)); + check("Access-Control-Allow-Methods", res.headers["access-control-allow-methods"], "GET, OPTIONS"); +}); + +test("token: publisher uid token has channel, uid, expiry and privileges", { skip: skipWithoutCredentials() }, async () => { + const { body } = await tokens(shared, `/rte/chan-1/publisher/uid/42?expiry=${EXPLICIT_EXPIRY_S}`); + assert.ok(body.rtcToken.startsWith(TOKEN_VERSION_PREFIX), body.rtcToken); + assert.ok(body.rtmToken.startsWith(TOKEN_VERSION_PREFIX), body.rtmToken); + const parser = parseToken(body.rtcToken); + const rtc = parser.getServices(kRtcServiceType)[0]; + check("appId", decode(parser.appId), APP_ID); + check("expire", parser.expire, EXPLICIT_EXPIRY_S); + assert.ok(Math.abs(parser.issueTs - Date.now() / 1000) <= ISSUE_TS_TOLERANCE_S, `issueTs ${parser.issueTs}`); + check("channel", decode(rtc.__channel_name), "chan-1"); + check("uid", decode(rtc.__uid), "42"); + check("privileges", rtc.__privileges, { 1: 0, 2: 0, 3: 0, 4: 0 }); +}); + +test("token: signature verifies with the certificate and fails with another", { skip: skipWithoutCredentials() }, async () => { + const { body } = await tokens(shared, "/rte/chan-1/publisher/uid/42"); + const parser = parseToken(body.rtcToken); + check("with the certificate", parser.verifySignature(APP_CERTIFICATE), true); + check("with another certificate", parser.verifySignature(WRONG_CERTIFICATE), false); +}); + +test("token: RTM token has user uid and login privilege expiry", { skip: skipWithoutCredentials() }, async () => { + const { body } = await tokens(shared, `/rte/chan-1/publisher/uid/42?expiry=${EXPLICIT_EXPIRY_S}`); + const rtm = parseToken(body.rtmToken).getServices(kRtmServiceType)[0]; + check("user", decode(rtm.__user_id), "42"); + check("privileges", rtm.__privileges, { 1: EXPLICIT_EXPIRY_S }); +}); + +test("token: subscriber userAccount token defaults to 3600 s and privilege 1", { skip: skipWithoutCredentials() }, async () => { + const { body } = await tokens(shared, "/rte/chan-1/subscriber/userAccount/alice"); + const parser = parseToken(body.rtcToken); + const rtc = parser.getServices(kRtcServiceType)[0]; + check("expire", parser.expire, DEFAULT_EXPIRY_S); + check("uid", decode(rtc.__uid), "alice"); + check("privileges", rtc.__privileges, { 1: 0 }); +}); + +test("token: answers are not cacheable", { skip: skipWithoutCredentials() }, async () => { + const { res } = await tokens(shared, "/rte/chan-1/publisher/uid/42"); + check("Cache-Control", res.headers["cache-control"], CACHE_CONTROL); +}); + +test("errors: missing APP_ID or APP_CERTIFICATE is 400", { skip: skipExternal("APP_ID and APP_CERTIFICATE") }, async () => { + const server = await startServer({}); + try { + const res = await request(server.baseUrl, "/rte/chan-1/publisher/uid/42"); + assert.equal(res.status, STATUS_BAD_REQUEST, failure(res, server)); + check("body", JSON.parse(res.body), { status: STATUS_BAD_REQUEST, message: "APP_ID and APP_CERTIFICATE must be set" }); + } finally { + server.stop(); + } +}); + +test("errors: short path, unknown path and POST are 404", async () => { + for (const [method, requestPath] of [ + ["GET", "/rte/chan-1"], + ["GET", "/nope"], + ["POST", "/rte/a/b/c/d"], + ]) { + const res = await request(shared.baseUrl, requestPath, { method }); + assert.equal(res.status, STATUS_NOT_FOUND, `${method} ${requestPath}: ${failure(res, shared)}`); + check(`${method} ${requestPath}`, JSON.parse(res.body), { message: "not found" }); + } +}); + +test("as today (OD-6): non-hex credentials give empty tokens", { skip: skipExternal("APP_ID and APP_CERTIFICATE") }, async () => { + const server = await startServer({ APP_ID: "my-app", APP_CERTIFICATE: "my-cert" }); + try { + const { res } = await tokens(server, "/rte/chan-1/publisher/uid/42"); + check("body", JSON.parse(res.body), { rtcToken: "", rtmToken: "" }); + } finally { + server.stop(); + } +}); + +test("as today (OD-6): 4-part path builds the RTM token for user undefined", { skip: skipWithoutCredentials() }, async () => { + const { body } = await tokens(shared, "/rte/chan-1/publisher/uid"); + const rtm = parseToken(body.rtmToken).getServices(kRtmServiceType)[0]; + check("user", decode(rtm.__user_id), "undefined"); +}); + +test("as today (OD-6): expiry=abc gives expire 0", { skip: skipWithoutCredentials() }, async () => { + const { body } = await tokens(shared, "/rte/chan-1/publisher/uid/42?expiry=abc"); + check("expire", parseToken(body.rtcToken).expire, 0); +}); + +test("todo (F6): Host header a b must not kill the server", { todo: true, skip: skipExternal("a server of its own") }, async () => { + const server = await startServer({ APP_ID, APP_CERTIFICATE }); + try { + await request(server.baseUrl, "/ping", { headers: { Host: "a b" } }).catch((error) => { + console.log(` request with Host "a b" failed: ${error.code}`); + }); + const exitCode = await Promise.race([ + server.exited, + new Promise((resolve) => setTimeout(() => resolve("running"), SERVER_EXIT_TIMEOUT_MS)), + ]); + console.log(` server after the request: ${exitCode === "running" ? "still running" : `exited with ${exitCode}`}`); + assert.equal(exitCode, "running", `server died:\n${server.output()}`); + } finally { + server.stop(); + } +}); diff --git a/deploy/docker/all-in-one/smoke-test.sh b/deploy/docker/all-in-one/smoke-test.sh index 6bbd831579..8a4f542105 100755 --- a/deploy/docker/all-in-one/smoke-test.sh +++ b/deploy/docker/all-in-one/smoke-test.sh @@ -38,7 +38,7 @@ readonly STARTUP_TIMEOUT=300 readonly DISABLED_STARTUP_WAIT=20 readonly POLL_INTERVAL=3 -readonly REQUIRED_NODE_MAJOR="v22" +readonly REQUIRED_NODE_MAJOR="v26" readonly PROGRAMS_DEFAULT="redis mongodb hocuspocus agora-token-service api-service node-service proxy-service frontend" readonly PROGRAMS_NEW="hocuspocus agora-token-service proxy-service" diff --git a/deploy/docker/default.env b/deploy/docker/default.env index 572df33997..542fd53e6c 100644 --- a/deploy/docker/default.env +++ b/deploy/docker/default.env @@ -199,7 +199,8 @@ LOWCODER_EMAIL_NOTIFICATIONS_SENDER=info@localhost # Lowcoder superuser username LOWCODER_SUPERUSER_USERNAME=admin@localhost # Lowcoder superuser password -# If left blank, a password will be generated and written into log (lowcoder-stacks/logs/api-service/api-service.log) +# If left blank, a password is generated at the first start only (while the account has none) and written once into the log +# (lowcoder-stacks/logs/api-service/api-service.log); later starts keep the stored password. When set, it replaces the stored password at every start. LOWCODER_SUPERUSER_PASSWORD= diff --git a/deploy/docker/hocuspocus/Dockerfile b/deploy/docker/hocuspocus/Dockerfile index 2412a2cdbc..2392ece1af 100644 --- a/deploy/docker/hocuspocus/Dockerfile +++ b/deploy/docker/hocuspocus/Dockerfile @@ -1,6 +1,6 @@ # Hocuspocus (Yjs WebSocket) server for lowcoder ChatBox. # Build context: client/packages/lowcoder (see Dockerfile.dockerignore next to this file) -FROM node:26-alpine +FROM node:26.13.1-alpine ARG HOCUSPOCUS_SERVER_VERSION=4.3.0 diff --git a/deploy/docker/hocuspocus/test/helpers/hocuspocusProcess.mjs b/deploy/docker/hocuspocus/test/helpers/hocuspocusProcess.mjs new file mode 100644 index 0000000000..240c92d39d --- /dev/null +++ b/deploy/docker/hocuspocus/test/helpers/hocuspocusProcess.mjs @@ -0,0 +1,133 @@ +// Helpers of the hocuspocus tests: reproduce the image layout (hocuspocus-server.js next to the +// pinned @hocuspocus/server, ESM) in a temporary directory, start and stop it, and run the Yjs +// client of the helm runtime test against it. +import { spawn } from "node:child_process"; +import { copyFileSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from "node:fs"; +import net from "node:net"; +import os from "node:os"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +export const TEST_PACKAGE_DIR = path.join(HERE, ".."); +export const REPO_ROOT = path.join(TEST_PACKAGE_DIR, "..", "..", "..", ".."); +const SERVER_SOURCE = path.join(REPO_ROOT, "client", "packages", "lowcoder", "hocuspocus-server.js"); +const CLIENT_SOURCE = path.join(REPO_ROOT, "deploy", "helm", "tests", "runtime", "hocuspocus-sync.mjs"); + +export const LOOPBACK = "127.0.0.1"; +export const STATUS_OK = 200; +export const EXIT_OK = 0; +export const EXIT_FAILED = 1; +export const READY_TIMEOUT_MS = 15000; +export const CLIENT_TIMEOUT_MS = 30000; +export const EXIT_TIMEOUT_MS = 20000; +const READY_POLL_MS = 100; + +let layoutDir; + +// Temporary directory with the server file, the Yjs client, type=module and node_modules linked to +// the test package's. Created once, removed by `cleanup()`. +export function layout() { + if (!layoutDir) { + layoutDir = mkdtempSync(path.join(os.tmpdir(), "hocuspocus-test-")); + copyFileSync(SERVER_SOURCE, path.join(layoutDir, "hocuspocus-server.js")); + copyFileSync(CLIENT_SOURCE, path.join(layoutDir, "hocuspocus-sync.mjs")); + writeFileSync(path.join(layoutDir, "package.json"), JSON.stringify({ type: "module" })); + symlinkSync(path.join(TEST_PACKAGE_DIR, "node_modules"), path.join(layoutDir, "node_modules"), "dir"); + } + return layoutDir; +} + +export function cleanup() { + if (layoutDir) rmSync(layoutDir, { recursive: true, force: true }); + layoutDir = undefined; +} + +export function freePort() { + return new Promise((resolve, reject) => { + const server = net.createServer(); + server.once("error", reject); + server.listen(0, LOOPBACK, () => { + const { port } = server.address(); + server.close(() => resolve(port)); + }); + }); +} + +// One GET; resolves { status, body } +export async function httpGet(host, port, requestPath) { + const response = await fetch(`http://${host}:${port}${requestPath}`); + return { status: response.status, body: await response.text() }; +} + +function spawnServer(env) { + const collected = []; + const child = spawn(process.execPath, ["hocuspocus-server.js"], { + cwd: layout(), + env: { PATH: process.env.PATH, ...env }, + stdio: ["ignore", "pipe", "pipe"], + }); + child.stdout.on("data", (chunk) => collected.push(String(chunk))); + child.stderr.on("data", (chunk) => collected.push(String(chunk))); + return { child, output: () => collected.join("") }; +} + +// Starts the server on a free port with HOST=127.0.0.1 and waits for /health to answer 200. +// Resolves { port, url, stop, output }. +export async function startServer(env = {}) { + const port = await freePort(); + const { child, output } = spawnServer({ PORT: String(port), HOST: LOOPBACK, ...env }); + const deadline = Date.now() + READY_TIMEOUT_MS; + while (Date.now() < deadline) { + if (child.exitCode !== null) throw new Error(`hocuspocus exited with ${child.exitCode}:\n${output()}`); + try { + if ((await httpGet(LOOPBACK, port, "/health")).status === STATUS_OK) { + return { port, url: `ws://${LOOPBACK}:${port}`, stop: () => child.kill(), output }; + } + } catch { + // not listening yet + } + await new Promise((resolve) => setTimeout(resolve, READY_POLL_MS)); + } + child.kill(); + throw new Error(`hocuspocus not ready after ${READY_TIMEOUT_MS} ms:\n${output()}`); +} + +// Spawns the server on `env.PORT` and resolves when it exits: { code, signal, output }. It never +// polls /health, so a first server already answering on that port cannot be mistaken for this +// one. Kills the child and rejects when it is still running after `timeoutMs`. +export function spawnUntilExit(env, timeoutMs = EXIT_TIMEOUT_MS) { + const { child, output } = spawnServer(env); + return new Promise((resolve, reject) => { + const timer = setTimeout(() => { + child.kill(); + reject(new Error(`second server kept running after ${timeoutMs} ms:\n${output()}`)); + }, timeoutMs); + child.once("exit", (code, signal) => { + clearTimeout(timer); + resolve({ code, signal, output: output() }); + }); + }); +} + +// Runs the copied hocuspocus-sync.mjs (mode sync|reject); resolves { code, output } +export function runClient(mode, url, token, documentName) { + const collected = []; + const child = spawn(process.execPath, ["hocuspocus-sync.mjs", mode, url, token, documentName], { + cwd: layout(), + env: { PATH: process.env.PATH }, + stdio: ["ignore", "pipe", "pipe"], + }); + child.stdout.on("data", (chunk) => collected.push(String(chunk))); + child.stderr.on("data", (chunk) => collected.push(String(chunk))); + return new Promise((resolve, reject) => { + const timer = setTimeout(() => { + child.kill(); + reject(new Error(`client did not finish in ${CLIENT_TIMEOUT_MS} ms:\n${collected.join("")}`)); + }, CLIENT_TIMEOUT_MS); + child.once("exit", (code) => { + clearTimeout(timer); + resolve({ code, output: collected.join("") }); + }); + }); +} diff --git a/deploy/docker/hocuspocus/test/package-lock.json b/deploy/docker/hocuspocus/test/package-lock.json new file mode 100644 index 0000000000..174b569ac3 --- /dev/null +++ b/deploy/docker/hocuspocus/test/package-lock.json @@ -0,0 +1,221 @@ +{ + "name": "lowcoder-hocuspocus-tests", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "lowcoder-hocuspocus-tests", + "devDependencies": { + "@hocuspocus/provider": "3.4.4", + "@hocuspocus/server": "4.3.0", + "ws": "8.18.3", + "yjs": "13.6.27" + }, + "engines": { + "node": ">=22.0.0" + } + }, + "node_modules/@hocuspocus/common": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/@hocuspocus/common/-/common-3.4.4.tgz", + "integrity": "sha512-RykIJ0tsHHMP4Xk+4UCbc7SO5LgGxGUSTdbh6anJEsaALAyqinf1Nn5HYuMjLPolAmsar1v++m9zufR09NLpXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "lib0": "^0.2.87" + } + }, + "node_modules/@hocuspocus/provider": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/@hocuspocus/provider/-/provider-3.4.4.tgz", + "integrity": "sha512-KbsMAfdYcIJD8eMU/5QnpXcSOvIWAcCNI33FSRSaKCIpYBFtAwkYIwWnZJmPZ8a1BMAtqQc+uvy9+UQf7GHnGQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@hocuspocus/common": "^3.4.4", + "@lifeomic/attempt": "^3.0.2", + "lib0": "^0.2.87", + "ws": "^8.17.1" + }, + "peerDependencies": { + "y-protocols": "^1.0.6", + "yjs": "^13.6.8" + } + }, + "node_modules/@hocuspocus/server": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@hocuspocus/server/-/server-4.3.0.tgz", + "integrity": "sha512-GX9ohUJAr6aIa2ewS0EPeyf3w12wLCBBSGfc76ZMOuZJZPUzDH6BJWFjkVlaVW3OmwZ5+jxdXXFUf6sAi4EIrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@hocuspocus/common": "^4.3.0", + "async-mutex": "^0.5.0", + "crossws": "^0.4.4", + "kleur": "^4.1.4", + "lib0": "^0.2.47" + }, + "engines": { + "node": ">=22" + }, + "peerDependencies": { + "y-protocols": "^1.0.6", + "yjs": "^13.6.8" + } + }, + "node_modules/@hocuspocus/server/node_modules/@hocuspocus/common": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@hocuspocus/common/-/common-4.9.0.tgz", + "integrity": "sha512-lrp5gtT8kvLt9/MuRRQPKaveihv5emSsP9+sMCq2rx8xVGn33PZIv0haSGyb37CbAIlVaHb/yG22VKKMx+clYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "lib0": "^0.2.119" + } + }, + "node_modules/@lifeomic/attempt": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@lifeomic/attempt/-/attempt-3.1.0.tgz", + "integrity": "sha512-QZqem4QuAnAyzfz+Gj5/+SLxqwCAw2qmt7732ZXodr6VDWGeYLG6w1i/vYLa55JQM9wRuBKLmXmiZ2P0LtE5rw==", + "dev": true, + "license": "MIT" + }, + "node_modules/async-mutex": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.5.0.tgz", + "integrity": "sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/crossws": { + "version": "0.4.17", + "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.4.17.tgz", + "integrity": "sha512-YG2kyfafNXKmu7e6k64yrj6whrw7m5sBIsOSXOlJ/72X3TQWRQuw8DhvXFDcBk8HF77PnTSygnm7xpYCTnFpow==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "srvx": ">=0.11.5" + }, + "peerDependenciesMeta": { + "srvx": { + "optional": true + } + } + }, + "node_modules/isomorphic.js": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/isomorphic.js/-/isomorphic.js-0.2.5.tgz", + "integrity": "sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/dmonad" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lib0": { + "version": "0.2.120", + "resolved": "https://registry.npmjs.org/lib0/-/lib0-0.2.120.tgz", + "integrity": "sha512-/a2eRImR8sZbmMVKe2we1/KukDQkuPyPf8yol6epvCu2PH6hurjcRI3mdGFFAi0uGoRJGyns99JquZgxwW1tQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "isomorphic.js": "^0.2.4" + }, + "bin": { + "0ecdsa-generate-keypair": "bin/0ecdsa-generate-keypair.js", + "0gentesthtml": "bin/gentesthtml.js", + "0serve": "bin/0serve.js" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/dmonad" + } + }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "dev": true, + "license": "0BSD" + }, + "node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y-protocols": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/y-protocols/-/y-protocols-1.0.7.tgz", + "integrity": "sha512-YSVsLoXxO67J6eE/nV4AtFtT3QEotZf5sK5BHxFBXso7VDUT3Tx07IfA6hsu5Q5OmBdMkQVmFZ9QOA7fikWvnw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "lib0": "^0.2.85" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=8.0.0" + }, + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/dmonad" + }, + "peerDependencies": { + "yjs": "^13.0.0" + } + }, + "node_modules/yjs": { + "version": "13.6.27", + "resolved": "https://registry.npmjs.org/yjs/-/yjs-13.6.27.tgz", + "integrity": "sha512-OIDwaflOaq4wC6YlPBy2L6ceKeKuF7DeTxx+jPzv1FHn9tCZ0ZwSRnUBxD05E3yed46fv/FWJbvR+Ud7x0L7zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "lib0": "^0.2.99" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=8.0.0" + }, + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/dmonad" + } + } + } +} diff --git a/deploy/docker/hocuspocus/test/package.json b/deploy/docker/hocuspocus/test/package.json new file mode 100644 index 0000000000..40b8287920 --- /dev/null +++ b/deploy/docker/hocuspocus/test/package.json @@ -0,0 +1,17 @@ +{ + "name": "lowcoder-hocuspocus-tests", + "private": true, + "type": "module", + "engines": { + "node": ">=22.0.0" + }, + "scripts": { + "test": "node --test \"*.test.mjs\"" + }, + "devDependencies": { + "@hocuspocus/provider": "3.4.4", + "@hocuspocus/server": "4.3.0", + "ws": "8.18.3", + "yjs": "13.6.27" + } +} diff --git a/deploy/docker/hocuspocus/test/server.test.mjs b/deploy/docker/hocuspocus/test/server.test.mjs new file mode 100644 index 0000000000..bebfb51d27 --- /dev/null +++ b/deploy/docker/hocuspocus/test/server.test.mjs @@ -0,0 +1,275 @@ +// Tests of client/packages/lowcoder/hocuspocus-server.js with @hocuspocus/server 4.3.0, the version +// both images install: health and root answers, Yjs sync between providers, token checks, start +// failure. The server runs from a temporary copy of the image layout (helpers/hocuspocusProcess.mjs). +// +// External mode: with HOCUSPOCUS_TEST_URL=ws://host:port (and HOCUSPOCUS_TEST_SECRET when that +// server has HOCUSPOCUS_SECRET set) the tests that only need a running server use it; the ones that +// need control of its environment, its port or its start are skipped. +import { after, test } from "node:test"; +import assert from "node:assert/strict"; +import os from "node:os"; +import { HocuspocusProvider } from "@hocuspocus/provider"; +import * as Y from "yjs"; +import WebSocket from "ws"; +import { + EXIT_FAILED, + EXIT_OK, + LOOPBACK, + STATUS_OK, + cleanup, + freePort, + httpGet, + runClient, + spawnUntilExit, + startServer, +} from "./helpers/hocuspocusProcess.mjs"; + +const SECRET = "t3-secret"; +const EXTERNAL_URL = (process.env.HOCUSPOCUS_TEST_URL ?? "").trim(); +const EXTERNAL_SECRET = process.env.HOCUSPOCUS_TEST_SECRET ?? ""; +const EXTERNAL = EXTERNAL_URL !== ""; +// The server admits only signal_ rooms (checked against the api-service) and the bridge rooms typeform_*, +// googleform_* and website_*, which the shared secret alone gates; these tests have no api-service, so they use a bridge room +const BRIDGE_ROOM_PREFIX = "website_"; +const DOCUMENT_A = `${BRIDGE_ROOM_PREFIX}t3-document-a`; +const DOCUMENT_B = `${BRIDGE_ROOM_PREFIX}t3-document-b`; +const ROOMS_REPORTED = "app-read-check"; +const REFUSED_ROOMS = ["t3-document-a", "signal_t3-app", "signal_bad/app", "typeform"]; +const WELCOME_TEXT = "Welcome to Hocuspocus!"; +const SHARED_MAP = "t3"; +const SHARED_KEY = "value"; +const SYNC_TIMEOUT_MS = 10000; +const SETTLE_MS = 500; +const LOG_POLL_MS = 25; +const LOG_TIMEOUT_MS = 5000; +const SKIP_EXTERNAL = EXTERNAL ? "needs control of the server's environment or port (HOCUSPOCUS_TEST_URL is set)" : false; +const SKIP_NO_SECRET = EXTERNAL && !EXTERNAL_SECRET ? "needs HOCUSPOCUS_TEST_SECRET (HOCUSPOCUS_TEST_URL is set)" : false; + +const started = []; +after(() => { + for (const server of started) server.stop(); + cleanup(); +}); + +// Prints actual and expected before asserting +function check(description, actual, expected) { + console.log(` ${description}: actual=${JSON.stringify(actual)} expected=${JSON.stringify(expected)}`); + assert.deepEqual(actual, expected, description); +} + +async function local(env = {}) { + const server = await startServer(env); + started.push(server); + return server; +} + +// The server under test: the external one, or a local one with `env` +async function target(env = {}) { + if (!EXTERNAL) return { ...(await local(env)), external: false }; + const { hostname, port, protocol } = new URL(EXTERNAL_URL); + const httpPort = port || (protocol === "wss:" ? "443" : "80"); + return { external: true, port: Number(httpPort), host: hostname, url: EXTERNAL_URL, output: () => "(external target: no server output)" }; +} + +const targetHost = (server) => server.host ?? LOOPBACK; +const targetSecret = (server) => (server.external ? EXTERNAL_SECRET : SECRET); + +// The server logs a rejection after the client has seen it, so a count taken right away can be one short. +// Polls the server output until `count` lines contain `text` or LOG_TIMEOUT_MS has passed; returns the matching lines. +async function waitForLogLines(server, text, count) { + const matching = () => server.output().split("\n").filter((line) => line.includes(text)); + const deadline = Date.now() + LOG_TIMEOUT_MS; + while (matching().length < count && Date.now() < deadline) { + await new Promise((resolve) => setTimeout(resolve, LOG_POLL_MS)); + } + return matching(); +} + +function message(description, server, extra = "") { + return `${description}\n${extra}--- server output ---\n${server.output()}`; +} + +test("health: GET /health reports ok and the auth state", async () => { + if (EXTERNAL) { + const server = await target(); + const res = await httpGet(targetHost(server), server.port, "/health"); + assert.equal(res.status, STATUS_OK, res.body); + const body = JSON.parse(res.body); + check("status and auth", { status: body.status, auth: body.auth }, { status: "ok", auth: EXTERNAL_SECRET ? "enabled" : "disabled" }); + return; + } + const open = await target(); + check("without a secret", JSON.parse((await httpGet(LOOPBACK, open.port, "/health")).body), { + status: "ok", + host: LOOPBACK, + port: open.port, + auth: "disabled", + rooms: ROOMS_REPORTED, + }); + const secured = await target({ HOCUSPOCUS_SECRET: SECRET }); + check("with a secret", JSON.parse((await httpGet(LOOPBACK, secured.port, "/health")).body), { + status: "ok", + host: LOOPBACK, + port: secured.port, + auth: "enabled", + rooms: ROOMS_REPORTED, + }); +}); + +test("root: GET / names the websocket URL and /health", async () => { + const server = await target(); + const res = await httpGet(targetHost(server), server.port, "/"); + assert.equal(res.status, STATUS_OK, res.body); + const body = JSON.parse(res.body); + if (!EXTERNAL) { + check("body", body, { name: "lowcoder-hocuspocus", websocket: `ws://${LOOPBACK}:${server.port}`, health: "/health" }); + return; + } + // the server echoes its own HOST and PORT, which the test does not control + const health = JSON.parse((await httpGet(targetHost(server), server.port, "/health")).body); + check("name and health", { name: body.name, health: body.health }, { name: "lowcoder-hocuspocus", health: "/health" }); + check("websocket", body.websocket, `ws://${health.host}:${health.port}`); + check("reported port", health.port, server.port); +}); + +test("root: other paths answer Welcome to Hocuspocus!", async () => { + const server = await target(); + const res = await httpGet(targetHost(server), server.port, "/anything-else"); + check("status and body", { status: res.status, body: res.body }, { status: STATUS_OK, body: WELCOME_TEXT }); +}); + +test("no secret: sync with an empty and an arbitrary token", { skip: SKIP_EXTERNAL }, async () => { + const server = await target(); + for (const token of ["", "arbitrary-token"]) { + const result = await runClient("sync", server.url, token, DOCUMENT_A); + assert.equal(result.code, EXIT_OK, message(`token "${token}"`, server, `${result.output}\n`)); + } +}); + +test("no secret: reject mode fails because any token is accepted", { skip: SKIP_EXTERNAL }, async () => { + const server = await target(); + const result = await runClient("reject", server.url, "arbitrary-token", DOCUMENT_A); + assert.equal(result.code, EXIT_FAILED, message("reject mode", server, `${result.output}\n`)); + assert.ok(result.output.includes("synced, expected the server to refuse the token"), result.output); +}); + +test("secret: sync with the secret", { skip: SKIP_NO_SECRET }, async () => { + const server = await target({ HOCUSPOCUS_SECRET: SECRET }); + const result = await runClient("sync", server.url, targetSecret(server), DOCUMENT_A); + assert.equal(result.code, EXIT_OK, message("sync with the secret", server, `${result.output}\n`)); +}); + +test("secret: wrong and empty tokens are refused with permission-denied", { skip: SKIP_NO_SECRET }, async () => { + const server = await target({ HOCUSPOCUS_SECRET: SECRET }); + for (const token of ["wrong", ""]) { + const result = await runClient("reject", server.url, token, DOCUMENT_A); + assert.equal(result.code, EXIT_OK, message(`token "${token}"`, server, `${result.output}\n`)); + assert.ok(result.output.includes("authentication failed (permission-denied)"), result.output); + } + if (!server.external) { + const rejected = server.output().split("\n").filter((line) => line.includes(`rejected connection for ${DOCUMENT_A}: invalid token`)); + check("server log lines about rejected connections", rejected.length, 2); + } +}); + +// A provider on `url` for `name`; resolves { document, provider } once synced +function openDocument(url, name, token) { + const document = new Y.Doc(); + return new Promise((resolve, reject) => { + // a provider that never syncs keeps reconnecting and the test process never exits: destroy it on failure + let provider; + const fail = (message) => { + clearTimeout(timer); + provider?.destroy(); + reject(new Error(message)); + }; + const timer = setTimeout(() => fail(`${name}: not synced after ${SYNC_TIMEOUT_MS} ms`), SYNC_TIMEOUT_MS); + provider = new HocuspocusProvider({ + url, + name, + document, + token: token || undefined, + WebSocketPolyfill: WebSocket, + onSynced: () => { + clearTimeout(timer); + resolve({ document, provider }); + }, + onAuthenticationFailed: ({ reason }) => fail(`${name}: authentication failed (${reason})`), + }); + }); +} + +test("documents: a value written in document A is not visible in document B", async () => { + const server = await target(EXTERNAL ? {} : { HOCUSPOCUS_SECRET: SECRET }); + const token = targetSecret(server); + const opened = []; + try { + const writer = await openDocument(server.url, DOCUMENT_A, token); + opened.push(writer); + const sameDocument = await openDocument(server.url, DOCUMENT_A, token); + opened.push(sameDocument); + const otherDocument = await openDocument(server.url, DOCUMENT_B, token); + opened.push(otherDocument); + const expected = `written-${Date.now()}`; + const received = new Promise((resolve) => { + const map = sameDocument.document.getMap(SHARED_MAP); + map.observe(() => map.get(SHARED_KEY) === expected && resolve()); + }); + writer.document.getMap(SHARED_MAP).set(SHARED_KEY, expected); + await received; // positive control: the value did travel through the server to document A + await new Promise((resolve) => setTimeout(resolve, SETTLE_MS)); + check("document A, second client", sameDocument.document.getMap(SHARED_MAP).get(SHARED_KEY), expected); + check("document B", otherDocument.document.getMap(SHARED_MAP).get(SHARED_KEY), undefined); + } finally { + for (const { provider } of opened) provider.destroy(); + } +}); + +test("rooms: a room that is no bridge room is refused with permission-denied, whatever the token", { skip: SKIP_EXTERNAL }, async () => { + // signal_ rooms ask the api-service (none runs here, so the check fails closed); any other name is refused outright + const server = await target({ HOCUSPOCUS_SECRET: SECRET }); + for (const name of REFUSED_ROOMS) { + const admitted = openDocument(server.url, name, SECRET).then(({ provider }) => { + provider.destroy(); // a failing run must not leave a connected provider that keeps the process alive + throw new Error(`${name}: admitted`); + }); + await assert.rejects(admitted, /authentication failed \(permission-denied\)/, message(`room ${name}`, server)); + } + const rejected = await waitForLogLines(server, "rejected connection for", REFUSED_ROOMS.length); + check("server log lines about rejected connections", rejected.length >= REFUSED_ROOMS.length, true); +}); + +test("start: a second server on the same port exits non-zero", { skip: SKIP_EXTERNAL }, async () => { + // No "[hocuspocus] failed to start" line is printed today: the listen error escapes the try + // block as an unhandled 'error' event (README F7). Only the exit code and EADDRINUSE are pinned. + const first = await local(); + const second = await spawnUntilExit({ PORT: String(first.port), HOST: LOOPBACK }); + console.log(` second server: code=${second.code} signal=${second.signal}`); + assert.equal(second.code, EXIT_FAILED, second.output); + assert.ok(second.output.includes(`EADDRINUSE: address already in use :::${first.port}`), second.output); + const health = await httpGet(LOOPBACK, first.port, "/health"); + assert.equal(health.status, STATUS_OK, "the first server still answers"); +}); + +const nonLoopbackAddress = Object.values(os.networkInterfaces()) + .flat() + .find((entry) => entry && entry.family === "IPv4" && !entry.internal)?.address; + +test( + "todo (F7): HOST=127.0.0.1 must not answer on a non-loopback address", + { + todo: true, + skip: SKIP_EXTERNAL || (nonLoopbackAddress ? false : "this machine has no non-loopback IPv4 address"), + }, + async () => { + const server = await local(); + let answered; + try { + answered = (await httpGet(nonLoopbackAddress, server.port, "/health")).status; + } catch (error) { + answered = `refused (${error.cause?.code ?? error.message})`; + } + console.log(` GET http://${nonLoopbackAddress}:${server.port}/health -> ${answered}`); + assert.match(String(answered), /^refused/, `HOST=${LOOPBACK} answered on ${nonLoopbackAddress}`); + } +); diff --git a/deploy/docker/hocuspocus/test/versions.test.mjs b/deploy/docker/hocuspocus/test/versions.test.mjs new file mode 100644 index 0000000000..ebe0fbc072 --- /dev/null +++ b/deploy/docker/hocuspocus/test/versions.test.mjs @@ -0,0 +1,45 @@ +// Guards the versions the images and the clients use: the @hocuspocus/server these tests install +// must be the one both Dockerfiles pin, and the @hocuspocus/provider must be the one the client and +// proxy-service lockfiles resolve and runtime-test.sh installs. A pattern that matches nothing fails +// with the file and what it holds. +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import path from "node:path"; +import { REPO_ROOT, TEST_PACKAGE_DIR } from "./helpers/hocuspocusProcess.mjs"; + +const read = (...segments) => readFileSync(path.join(REPO_ROOT, ...segments), "utf8"); +const installed = (name) => JSON.parse(readFileSync(path.join(TEST_PACKAGE_DIR, "node_modules", name, "package.json"), "utf8")).version; + +// The first capture group of `pattern` in `text`, or a failure naming the file +function capture(file, text, pattern) { + const match = pattern.exec(text); + assert.ok(match, `${file}: nothing matches ${pattern}`); + return match[1]; +} + +function check(description, actual, expected) { + console.log(` ${description}: actual=${JSON.stringify(actual)} expected=${JSON.stringify(expected)}`); + assert.equal(actual, expected, description); +} + +test("versions: @hocuspocus/server matches both Dockerfile ARGs", () => { + const arg = /^ARG HOCUSPOCUS_SERVER_VERSION=(\S+)$/m; + const standalone = "deploy/docker/hocuspocus/Dockerfile"; + const allInOne = "deploy/docker/Dockerfile"; + const version = installed("@hocuspocus/server"); + check(standalone, capture(standalone, read(standalone), arg), version); + check(allInOne, capture(allInOne, read(allInOne), arg), version); +}); + +test("versions: @hocuspocus/provider matches the lockfiles and runtime-test.sh", () => { + const version = installed("@hocuspocus/provider"); + const clientLock = "client/yarn.lock"; + const proxyLock = "server/proxy-service/yarn.lock"; + const runtimeTest = "deploy/helm/tests/runtime-test.sh"; + // yarn berry: `"@hocuspocus/provider@npm:^3.4.4":\n version: 3.4.4` + check(clientLock, capture(clientLock, read(clientLock), /^"@hocuspocus\/provider@[^"]*":\n version: (\S+)$/m), version); + // yarn 1: `"@hocuspocus/provider@^3.4.4":\n version "3.4.4"` + check(proxyLock, capture(proxyLock, read(proxyLock), /^"@hocuspocus\/provider@[^"]*":\n version "([^"]+)"$/m), version); + check(runtimeTest, capture(runtimeTest, read(runtimeTest), /^readonly HOCUSPOCUS_PROVIDER_VERSION="([^"]+)"$/m), version); +}); diff --git a/deploy/helm/README.md b/deploy/helm/README.md index 220b0bee75..6ae7019b74 100644 --- a/deploy/helm/README.md +++ b/deploy/helm/README.md @@ -199,7 +199,7 @@ you do not use the meeting components. Without credentials `/rte/...` answers HT | `global.config.encryption.password` | Encryption password - CHANGE IT! | `lowcoder.org` | | `global.config.encryption.salt` | Encryption salt - CHANGE IT! | `lowcoder.org` | | `global.config.superuser.username` | Lowcoder superadmin username | `admin@localhost` | -| `global.config.superuser.password` | Lowcoder superadmin password - if not supplied, it will be generated | | +| `global.config.superuser.password` | Lowcoder superadmin password - when set, it replaces the stored password at every start; if not supplied, one is generated at the first start only and printed once into the log | | | `global.config.apiKeySecret` | API-KEY secret, should be a string of at least 32 random characters - CHANGE IT | `5a41b0905...` | | `global.config.maxQueryTimeout` | Maximum query timeout in seconds | `120` | | `global.config.maxRequestSize` | Maximum request size | `20mb` | diff --git a/deploy/helm/tests/runtime-test.sh b/deploy/helm/tests/runtime-test.sh index 5ad8950c0a..10a5cc158d 100755 --- a/deploy/helm/tests/runtime-test.sh +++ b/deploy/helm/tests/runtime-test.sh @@ -53,7 +53,7 @@ readonly INGRESS_HOST="lowcoder.test" readonly INGRESS_PORT="80" readonly HOCUSPOCUS_SECRET="hocuspocus-secret-91c2" readonly WRONG_HOCUSPOCUS_SECRET="not-the-secret" -readonly HOCUSPOCUS_DOCUMENT="runtime-test-room" +readonly HOCUSPOCUS_DOCUMENT="website_runtime-test-room" readonly FRONTEND_HOCUSPOCUS_PATH="/hocuspocus" readonly FRONTEND_AGORA_PREFIX="/agora-token-service" # Dummy 32-hex credentials: the token service only needs the format to build tokens diff --git a/docs/lowcoder-extension/opensource-contribution/README.md b/docs/lowcoder-extension/opensource-contribution/README.md index 549541012e..1b5b071124 100644 --- a/docs/lowcoder-extension/opensource-contribution/README.md +++ b/docs/lowcoder-extension/opensource-contribution/README.md @@ -336,7 +336,7 @@ Please read more information in the following guides: #### Preparation -To develop and test Datasource Plugins locally in the Node-Service, you should have Node.js installed in Version from v14.18.0 or from v16.0.0. +To develop and test Datasource Plugins locally in the Node-Service, you should have Node.js 24 or later installed; the version the node-service image uses is in `server/node-service/.nvmrc`. #### Start of Development diff --git a/docs/setup-and-run/self-hosting/README.md b/docs/setup-and-run/self-hosting/README.md index f01f854c6d..050f8f3bc2 100644 --- a/docs/setup-and-run/self-hosting/README.md +++ b/docs/setup-and-run/self-hosting/README.md @@ -282,7 +282,7 @@ ENV Variables for Helm, Docker Compose, and Docker installations are to find in This image contains all services needed to run Lowcoder platform in one container. -
Environment variableDescriptionDefault-Value
LOWCODER_REDIS_ENABLEDIf true redis server is started in the containertrue
LOWCODER_MONGODB_ENABLEDIf true mongo database is started in the containertrue
LOWCODER_MONGODB_EXPOSEDIf true mongo database accept connections from outside the dockerfalse
LOWCODER_API_SERVICE_ENABLEDIf true lowcoder api-service is started in the containertrue
LOWCODER_NODE_SERVICE_ENABLEDIf true lowcoder node-service is started in the containertrue
LOWCODER_FRONTEND_ENABLEDIf true lowcoder web frontend is started in the containertrue
LOWCODER_PUIDID of user running services. It will own all created logs and data.9001
LOWCODER_PGIDID of group of the user running services.9001
LOWCODER_MONGODB_URLMongo database connection stringmongodb://localhost:27017/lowcoder?authSource=admin
LOWCODER_REDIS_URLRedis server URLredis://localhost:6379
LOWCODER_DB_ENCRYPTION_PASSWORDEncryption passwordlowcoder.org
LOWCODER_DB_ENCRYPTION_SALTSalt used for encrypting passwordlowcoder.org
LOWCODER_CORS_DOMAINSCORS allowed domains, comma-separated; only a listed, non-wildcard origin's own script may read a credentialed answer cross-origin (not a CSRF defense)*
LOWCODER_PUBLIC_URLThe URL of the public User Interfacelocalhost:3000
LOWCODER_MAX_REQUEST_SIZELowcoder max request size20m
LOWCODER_MAX_QUERY_TIMEOUTLowcoder max query timeout (in seconds)120
LOWCODER_DEFAULT_QUERY_TIMEOUTLowcoder default query timeout (in seconds)10
LOWCODER_API_RATE_LIMITNumber of max Request per Second100
LOWCODER_API_SERVICE_URLLowcoder API service URLhttp://localhost:8080
LOWCODER_NODE_SERVICE_URLLowcoder Node service (js executor) URLhttp://localhost:6060
LOWCODER_MAX_ORGS_PER_USERDefault maximum organizations per user100
LOWCODER_MAX_MEMBERS_PER_ORGDefault maximum members per organization1000
LOWCODER_MAX_GROUPS_PER_ORGDefault maximum groups per organization100
LOWCODER_MAX_APPS_PER_ORGDefault maximum applications per organization1000
LOWCODER_MAX_DEVELOPERSDefault maximum developers100
LOWCODER_WORKSPACE_MODESAAS to activate, ENTERPRISE to switch off - WorkspacesSAAS
LOWCODER_EMAIL_SIGNUP_ENABLEDControl if users create their own Workspace automatic when Sign Uptrue
LOWCODER_EMAIL_AUTH_ENABLEDControl if Users can Sign Up / Login using the Standard Email Fieldtrue
LOWCODER_CREATE_WORKSPACE_ON_SIGNUPIF LOWCODER_WORKSPACE_MODE = SAAS, controls if a own workspace is created for the user after sign uptrue
LOWCODER_MARKETPLACE_PRIVATE_MODEControl if not to show Apps on the local Marketplace to anonymous userstrue
LOWCODER_SUPERUSER_USERNAMEUsername of the Super-User of an Lowcoder Installationadmin@localhost
LOWCODER_SUPERUSER_PASSWORDPassword of the Super-User, if not present or empty, it will be generated`generated and printed into log file
+
Environment variableDescriptionDefault-Value
LOWCODER_REDIS_ENABLEDIf true redis server is started in the containertrue
LOWCODER_MONGODB_ENABLEDIf true mongo database is started in the containertrue
LOWCODER_MONGODB_EXPOSEDIf true mongo database accept connections from outside the dockerfalse
LOWCODER_API_SERVICE_ENABLEDIf true lowcoder api-service is started in the containertrue
LOWCODER_NODE_SERVICE_ENABLEDIf true lowcoder node-service is started in the containertrue
LOWCODER_FRONTEND_ENABLEDIf true lowcoder web frontend is started in the containertrue
LOWCODER_PUIDID of user running services. It will own all created logs and data.9001
LOWCODER_PGIDID of group of the user running services.9001
LOWCODER_MONGODB_URLMongo database connection stringmongodb://localhost:27017/lowcoder?authSource=admin
LOWCODER_REDIS_URLRedis server URLredis://localhost:6379
LOWCODER_DB_ENCRYPTION_PASSWORDEncryption passwordlowcoder.org
LOWCODER_DB_ENCRYPTION_SALTSalt used for encrypting passwordlowcoder.org
LOWCODER_CORS_DOMAINSCORS allowed domains, comma-separated; only a listed, non-wildcard origin's own script may read a credentialed answer cross-origin (not a CSRF defense)*
LOWCODER_PUBLIC_URLThe URL of the public User Interfacelocalhost:3000
LOWCODER_MAX_REQUEST_SIZELowcoder max request size20m
LOWCODER_MAX_QUERY_TIMEOUTLowcoder max query timeout (in seconds)120
LOWCODER_DEFAULT_QUERY_TIMEOUTLowcoder default query timeout (in seconds)10
LOWCODER_API_RATE_LIMITNumber of max Request per Second100
LOWCODER_API_SERVICE_URLLowcoder API service URLhttp://localhost:8080
LOWCODER_NODE_SERVICE_URLLowcoder Node service (js executor) URLhttp://localhost:6060
LOWCODER_MAX_ORGS_PER_USERDefault maximum organizations per user100
LOWCODER_MAX_MEMBERS_PER_ORGDefault maximum members per organization1000
LOWCODER_MAX_GROUPS_PER_ORGDefault maximum groups per organization100
LOWCODER_MAX_APPS_PER_ORGDefault maximum applications per organization1000
LOWCODER_MAX_DEVELOPERSDefault maximum developers100
LOWCODER_WORKSPACE_MODESAAS to activate, ENTERPRISE to switch off - WorkspacesSAAS
LOWCODER_EMAIL_SIGNUP_ENABLEDControl if users create their own Workspace automatic when Sign Uptrue
LOWCODER_EMAIL_AUTH_ENABLEDControl if Users can Sign Up / Login using the Standard Email Fieldtrue
LOWCODER_CREATE_WORKSPACE_ON_SIGNUPIF LOWCODER_WORKSPACE_MODE = SAAS, controls if a own workspace is created for the user after sign uptrue
LOWCODER_MARKETPLACE_PRIVATE_MODEControl if not to show Apps on the local Marketplace to anonymous userstrue
LOWCODER_SUPERUSER_USERNAMEUsername of the Super-User of an Lowcoder Installationadmin@localhost
LOWCODER_SUPERUSER_PASSWORDPassword of the Super-User. When set, it replaces the stored password at every start. When empty, a password is generated only while the account has none (first start) and printed once into the log; later starts keep the stored passwordgenerated at first start, printed once into the log file
#### API Key Secret @@ -298,7 +298,7 @@ To enable secure Password Reset flow for the users, you need to configure your o ### ENV Variables for the api-service image -
Environment variableDescriptionDefault-Value
LOWCODER_PUIDID of user running services. It will own all created logs and data.9001
LOWCODER_PGIDID of group of the user running services.9001
LOWCODER_MONGODB_URLMongo database connection stringmongodb://localhost:27017/lowcoder?authSource=admin
LOWCODER_REDIS_URLRedis server URLredis://localhost:6379
LOWCODER_DB_ENCRYPTION_PASSWORDEncryption passwordlowcoder.org
LOWCODER_DB_ENCRYPTION_SALTSalt used for encrypting passwordlowcoder.org
LOWCODER_CORS_DOMAINSCORS allowed domains, comma-separated; only a listed, non-wildcard origin's own script may read a credentialed answer cross-origin (not a CSRF defense)*
LOWCODER_PUBLIC_URLThe URL of the public User Interfacelocalhost:3000
LOWCODER_MAX_ORGS_PER_USERDefault maximum organizations per user100
LOWCODER_MAX_MEMBERS_PER_ORGDefault maximum members per organization1000
LOWCODER_MAX_GROUPS_PER_ORGDefault maximum groups per organization100
LOWCODER_MAX_APPS_PER_ORGDefault maximum applications per organization1000
LOWCODER_MAX_DEVELOPERSDefault maximum developers100
LOWCODER_MAX_REQUEST_SIZELowcoder max request size20m
LOWCODER_MAX_QUERY_TIMEOUTLowcoder max query timeout (in seconds)120
LOWCODER_DEFAULT_QUERY_TIMEOUTLowcoder default query timeout (in seconds)10
LOWCODER_WORKSPACE_MODESAAS to activate, ENTERPRISE to switch off - WorkspacesSAAS
LOWCODER_EMAIL_SIGNUP_ENABLEDControl is users can create their own Workspace when Sign Uptrue
LOWCODER_CREATE_WORKSPACE_ON_SIGNUPIF LOWCODER_WORKSPACE_MODE = SAAS, controls if a own workspace is created for the user after sign uptrue
LOWCODER_MARKETPLACE_PRIVATE_MODEControl if not to show Apps on the local Marketplace to anonymous userstrue
LOWCODER_SUPERUSER_USERNAMEUsername of the Super-User of an Lowcoder Installationadmin@localhost
LOWCODER_SUPERUSER_PASSWORDPassword of the Super-User, if not present or empty, it will be generated`generated and printed into log file
+
Environment variableDescriptionDefault-Value
LOWCODER_PUIDID of user running services. It will own all created logs and data.9001
LOWCODER_PGIDID of group of the user running services.9001
LOWCODER_MONGODB_URLMongo database connection stringmongodb://localhost:27017/lowcoder?authSource=admin
LOWCODER_REDIS_URLRedis server URLredis://localhost:6379
LOWCODER_DB_ENCRYPTION_PASSWORDEncryption passwordlowcoder.org
LOWCODER_DB_ENCRYPTION_SALTSalt used for encrypting passwordlowcoder.org
LOWCODER_CORS_DOMAINSCORS allowed domains, comma-separated; only a listed, non-wildcard origin's own script may read a credentialed answer cross-origin (not a CSRF defense)*
LOWCODER_PUBLIC_URLThe URL of the public User Interfacelocalhost:3000
LOWCODER_MAX_ORGS_PER_USERDefault maximum organizations per user100
LOWCODER_MAX_MEMBERS_PER_ORGDefault maximum members per organization1000
LOWCODER_MAX_GROUPS_PER_ORGDefault maximum groups per organization100
LOWCODER_MAX_APPS_PER_ORGDefault maximum applications per organization1000
LOWCODER_MAX_DEVELOPERSDefault maximum developers100
LOWCODER_MAX_REQUEST_SIZELowcoder max request size20m
LOWCODER_MAX_QUERY_TIMEOUTLowcoder max query timeout (in seconds)120
LOWCODER_DEFAULT_QUERY_TIMEOUTLowcoder default query timeout (in seconds)10
LOWCODER_WORKSPACE_MODESAAS to activate, ENTERPRISE to switch off - WorkspacesSAAS
LOWCODER_EMAIL_SIGNUP_ENABLEDControl is users can create their own Workspace when Sign Uptrue
LOWCODER_CREATE_WORKSPACE_ON_SIGNUPIF LOWCODER_WORKSPACE_MODE = SAAS, controls if a own workspace is created for the user after sign uptrue
LOWCODER_MARKETPLACE_PRIVATE_MODEControl if not to show Apps on the local Marketplace to anonymous userstrue
LOWCODER_SUPERUSER_USERNAMEUsername of the Super-User of an Lowcoder Installationadmin@localhost
LOWCODER_SUPERUSER_PASSWORDPassword of the Super-User. When set, it replaces the stored password at every start. When empty, a password is generated only while the account has none (first start) and printed once into the log; later starts keep the stored passwordgenerated at first start, printed once into the log file
#### API Key Secret diff --git a/e2e/AGENTS.md b/e2e/AGENTS.md index ea064607b4..e51fb8e877 100644 --- a/e2e/AGENTS.md +++ b/e2e/AGENTS.md @@ -138,11 +138,11 @@ Coordinates, DSL item ids, test ids and labels used by one spec only may be loca MUST: - Quarantine rule: a test that asserts the DESIRED behaviour and fails today gets `tag: TAGS.QUARANTINE` (excluded from - the default run). Existing: `editor/drop-size.spec.ts` (D-5) and the icon switch in `components/displays.spec.ts` (CD-9 candidate, with a `defect` annotation). + the default run). Existing: the API-key delete helper test in `foundation/security-helpers.spec.ts` (D-45 candidate); the security and lifecycle tests are quarantined through the maps in `src/security/quarantine.ts`. - A characterisation or workaround test that passes while documenting a defect is NOT quarantined. Give it `annotation: { type: "defect", description: "" }` (examples: `tests/logic/temporary-state.spec.ts` CD-7, `components/npm-components.spec.ts` CD-5; conditional form - `testInfo.annotations.push({ type: "defect", description })` in `components/choices.spec.ts`, CD-8 candidate). D-5's - `drop-size.spec.ts` and CD-3's `timer.spec.ts` carry no annotation today; adding one is allowed. + `testInfo.annotations.push({ type: "defect", description })` in `components/choices.spec.ts`, CD-8 candidate). CD-3's + `timer.spec.ts` carries no annotation today; adding one is allowed. - Other annotation types: `D-3 retry`, `handler retry` (retries of S1, M3, `foundation/editor-modules.spec.ts`), `observation` (`modules/module-versions.spec.ts`). - Cite the defect id in a comment where a test works around it (D-3, D-5, CD-3, CD-5, CD-7). The README table defines them. @@ -192,7 +192,7 @@ MUST NOT: | node-service plugin ids and catalogue | `NODE_PLUGIN_IDS`, `nodePluginIdsOf`, `NODE_PLUGIN_FIXTURE_PLACEHOLDER_URL`, `OPEN_API_FIXTURE_SPEC` (canned OpenAPI document for the generic `openApi` plugin), `parseBasicAuthorization` (decodes a Basic `Authorization` header an echo record holds), `parseSigV4Authorization` (splits an AWS SigV4 `Authorization` header into key, date, region, service, signed headers and signature) | `src/datasource/node-plugins.ts` | | negative and counter reads, local storage | `expectTextStays`, `countAfterEquals`, `parseCounter`, `rawLocalStorage` | `src/logic/helpers.ts` | | media | `PNG_RED`, `PNG_BLUE`, `WAV`, `WEBM`, `MP4`, `PDF`, `PDF_RAW_B64` | `src/media.ts` | -| security actors, quarantine, answers, tokens | `Actor`, `adminOfApiUser`, `joinWorkspace`, `makeDeveloper`, `makeAdmin`, `grantApp`, `seedPrivateApp`, `sceneOf`, `memberOf`, `roleOf`, `permissionIdOf`, `securityTestDetails`, `securityCandidateDetails`, `expectAnswer`, `expectDeniedAs`, `forgeApiKeyToken`, `forgeUnsignedToken`, `withRandomSignature`, `tokenIsSignedWith`, `superAdminCredentials`, `SUPER_ADMIN_ENV`, `enterpriseAdmin` (ENTERPRISE stack: an actor the super admin makes admin of the one workspace), `echoTargetPath`, `echoReadPrefix`, `echoBaseUrl`, `echoUrlByIp` (an echo target URL with its host replaced by the echo's IP address, `E2E_ECHO_IP`: for a plugin that derives a host name from its endpoint, e.g. an S3 bucket call; never address a bucket of the `e2e-echo` alias), `recordsContain` (requests the SERVER makes, read back from the HTTP echo sidecar: the `echo` fixture gives a test its own target `url` and `received()`; a denial must follow a positive control that the echo does receive from that path; compare a secret with `recordsContain(...)` as a boolean, never as a matcher's value) (the `actor`, `superAdmin` and `echo` fixtures are in `src/fixtures.ts`; the raw-answer helper `apiRaw` and the other security API helpers are in `src/api/client.ts`) | `src/security/actors.ts`, `scene.ts`, `quarantine.ts`, `assertions.ts`, `tokens.ts`, `super-admin.ts`, `enterprise.ts`, `echo.ts` | +| security actors, quarantine, answers, tokens | `Actor`, `adminOfApiUser`, `joinWorkspace`, `makeDeveloper`, `makeAdmin`, `grantApp`, `seedPrivateApp`, `sceneOf`, `memberOf`, `roleOf`, `permissionIdOf`, `securityTestDetails`, `securityCandidateDetails` (both bound from `securityDetailsFor(defectOf)`, whose injected lookup is how the unit spec tests a listed id while both maps are empty), `expectAnswer`, `expectDeniedAs`, `forgeApiKeyToken`, `forgeUnsignedToken`, `withRandomSignature`, `tokenIsSignedWith`, `superAdminCredentials`, `SUPER_ADMIN_ENV`, `enterpriseAdmin` (ENTERPRISE stack: an actor the super admin makes admin of the one workspace), `echoTargetPath`, `echoReadPrefix`, `echoBaseUrl`, `echoUrlByIp` (an echo target URL with its host replaced by the echo's IP address, `E2E_ECHO_IP`: for a plugin that derives a host name from its endpoint, e.g. an S3 bucket call; never address a bucket of the `e2e-echo` alias), `recordsContain` (requests the SERVER makes, read back from the HTTP echo sidecar: the `echo` fixture gives a test its own target `url` and `received()`; a denial must follow a positive control that the echo does receive from that path; compare a secret with `recordsContain(...)` as a boolean, never as a matcher's value) (the `actor`, `superAdmin` and `echo` fixtures are in `src/fixtures.ts`; the raw-answer helper `apiRaw` and the other security API helpers are in `src/api/client.ts`) | `src/security/actors.ts`, `scene.ts`, `quarantine.ts`, `assertions.ts`, `tokens.ts`, `super-admin.ts`, `enterprise.ts`, `echo.ts` | | Firebird sidecar connection (opt-in sidecar: throws `FirebirdSidecarMissingError` when `E2E_FIREBIRD_HOST` is unset), the rows of `fixtures/firebird/init.sql` | `firebirdConnection`, `FirebirdSidecarMissingError`, `FIREBIRD_ITEMS` | `src/datasource/firebird.ts` | | libSQL sidecar connection (opt-in sidecar: throws `LibsqlSidecarMissingError` when `E2E_LIBSQL_HOST` is unset) and a direct pipeline call to it from the test process (the control that shows the server's own answer) | `libsqlConnection`, `libsqlDirect`, `LibsqlSidecarMissingError`, `LIBSQL_PIPELINE_PATH` | `src/datasource/libsql.ts` | | CouchDB sidecar connection (opt-in sidecar: throws `CouchdbSidecarMissingError` when `E2E_COUCHDB_HOST` is unset) and a direct HTTP call to it from the test process, plain or as the sidecar's admin (the control that shows the server's own status and body, and the way a test makes and removes its own database) | `couchdbConnection`, `couchdbDirect`, `couchdbAdmin`, `CouchdbSidecarMissingError` | `src/datasource/couchdb.ts` | @@ -248,14 +248,15 @@ and are NOT VERIFIED in tracked evidence. - **`networkidle` after an iframe was added:** a component that adds a frame later (`iframe`, `custom`) keeps network idle from firing; await it first. `tests/components/insert-all.spec.ts`. - **numberInput:** it writes `value` when editing finishes; press Enter or blur. `tests/components/inputs.spec.ts`. -- **Icon from a name to a `data:` URI keeps the old icon** (CD-9 candidate; `@quarantine`). - `tests/components/displays.spec.ts`. +- **Icon from a name to a `data:` URI kept the old icon** (CD-9, fixed on this branch: the control draws a value that is not an icon + reference as an image at once). `tests/components/displays.spec.ts` asserts the image; the control's unit test is + `client/packages/lowcoder/src/comps/controls/iconControl.test.tsx`. - **floatingButton group intercepts clicks:** give it its own column (`FLOATING_BUTTON_COLUMN`) and click its option by `FLOATING_OPTION_ONE_SELECTOR`. `tests/components/buttons.spec.ts`. - **Handler retry (M3):** `setTempStateAction(state, value, { eventName, retryAllowed, onRetry })` retries once through the existing handler; pass `retryAllowed: false` when the caller's `HandlerRetryBudget` is spent. `TableView.headerCell(title)` matches the exact title; `ExtensionsPanel.tile(kind, pkg)` and `tileVersion(kind, pkg)` take the list kind first. -- **Drop right after the editor opens:** width 0 (D-5) or a lost save (D-3). Open with `EditorPage.open()`. +- **Drop right after the editor opens:** width 0 (D-5, fixed on this branch; `editor/drop-size.spec.ts` is its regression test and opens the page with `settleGrid: false`) or a lost save (D-3, still open). Open with `EditorPage.open()`, which waits `GRID_SETTLE_MS` for the second. - **Parallel writes to `notes` without the `owner` scope:** tests see each other's rows (4 of 4 parallel copies failed when measured; NOT VERIFIED here). diff --git a/e2e/README.md b/e2e/README.md index fcf7d15563..5b260c7fb2 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -198,7 +198,7 @@ Tags (`TAGS` in `src/constants.ts`): | `@quarantine` | asserts the desired behaviour of a known product defect and fails today (on 3.0.1-e2e, 2026-11-22) | no, `E2E_INCLUDE_QUARANTINE=1` | | `@insert-all` | S1: insert, save, publish and load each of the 112 types | no, `E2E_INCLUDE_INSERT_ALL=1` | | `@security` | access-control tests of `tests/security/` | yes (except the rows that also carry an opt-in tag) | -| `@lifecycle` | user-lifecycle tests, ids `LC-` (areas `AU PR AK WM GR SH PW DL IP OT`; `src/security/quarantine.ts`) | yes (the quarantined ones, 12 of 109 as of D-34 and D-49 (LC-PR13 and LC-PW08 left the quarantine; the rest of this count predates several later fixes and is pending the combined final re-measurement), are excluded like `@security`) | +| `@lifecycle` | user-lifecycle tests, ids `LC-` (areas `AU PR AK WM GR SH PW DL IP OT`; `src/security/quarantine.ts`) | yes (no `@lifecycle` test is quarantined any more; the decided behaviours of D-30 and of the creator right are pins; `--grep @lifecycle` lists 119 in the default run, measured 2026-11-27) | | `@enterprise` | the second stack in ENTERPRISE workspace mode (SEC-E01 to SEC-E07b, `tests/security/enterprise*.spec.ts`); SEC-E05 also carries `@enterprise-takeover` and `@superadmin`, SEC-E07a and SEC-E07b also carry `@superadmin` | no, never on the default stack; the only ones with `E2E_STACK_PROFILE=enterprise` (SEC-E05 aside) | | `@enterprise-takeover` | SEC-E05 only: it resets the super admin's password, so it never shares a stack with another test | no, never on the default stack; on the enterprise profile only with `E2E_INCLUDE_ENTERPRISE_TAKEOVER=1`, and then it is the ONLY test of the run | | `@signup-disabled` | the third stack with `LOWCODER_EMAIL_SIGNUP_ENABLED=false` (LC-AU20 to LC-AU24, `tests/auth/signup-disabled.spec.ts`): every fixture that makes a user signs up, so nothing else runs there | no, never on another stack; the only tests of a run with `E2E_STACK_PROFILE=signup-disabled` | @@ -268,7 +268,7 @@ e2e/ pages/ page objects: AppList, AppView, Auth, Datasource, Editor, Extensions panel, Login, Property panel, Query panel, Setting, TableView, UserMenu logic/helpers.ts rawLocalStorage, countAfterEquals, parseCounter, expectTextStays, DEBOUNCE_SETTLE_MS datasource/notes-queries.ts query builders: shared read-only products, owner-scoped notes - datasource/node-plugins.ts `NODE_PLUGIN_IDS` (the 46 node plugin ids), `nodePluginIdsOf`, `NODE_PLUGIN_FIXTURE_PLACEHOLDER_URL` + datasource/node-plugins.ts `NODE_PLUGIN_IDS` (the 45 node plugin ids), `nodePluginIdsOf`, `NODE_PLUGIN_FIXTURE_PLACEHOLDER_URL` components/ insert-all.ts (S1 helpers), insert-catalog.ts (112 types), scenario.ts (boundText, withValueAt, openSeededView) simple-components/seed.ts container and slot seeds, openSeededApp modules/moduleScenario.ts module scenario DSL, saved-instance polling, HandlerRetryBudget @@ -284,7 +284,7 @@ e2e/ Test titles carry these ids. -- LC- user-lifecycle tests (`@lifecycle`, quarantined through the same two maps as the SEC ids). Built: OT01 to OT05 (the new-user tour, the profile counts, navigation by role, the member detail and the admin sign-in page, `apps/onboarding.spec.ts` and `account/other.spec.ts`), AU20 to AU24 (the sign-up-disabled stack, `auth/signup-disabled.spec.ts`), AU01 to AU16 (sign-up and sign-in edge cases, `auth/signup-edge.spec.ts` and `auth/signin-session.spec.ts`), PR01 to PR15 (profile and password, `account/profile.spec.ts` and `account/password.spec.ts`), PW01 to PW16 (password recovery and invitation mails, `auth/password-recovery.spec.ts`), DL01 to DL15 (leaving, removal and workspace deletion, `workspace/leave-removal.spec.ts`), IP01 to IP05, IP07, IP08 (sign-in provider configuration, `auth/providers-config.spec.ts`), IP10 to IP15 (sign-in through a mock provider, `auth/providers-login.spec.ts`), AK01 to AK08 (API keys, `account/api-keys.spec.ts`), WM01, WM03, WM04, WM06, WM08 to WM12 (members and workspaces in the UI, `workspace/members-gui.spec.ts` and `workspace/workspaces-gui.spec.ts`), GR01 to GR10 (groups, `workspace/groups-gui.spec.ts`), SH01 to SH06 (sharing, `workspace/share-gui.spec.ts`). +- LC- user-lifecycle tests (`@lifecycle`, quarantined through the same two maps as the SEC ids). Built: OT01 to OT05 (the new-user tour, the profile counts, navigation by role, the member detail and the admin sign-in page, `apps/onboarding.spec.ts` and `account/other.spec.ts`), AU20 to AU24 (the sign-up-disabled stack, `auth/signup-disabled.spec.ts`), AU01 to AU18c (sign-up and sign-in edge cases, `auth/signup-edge.spec.ts` and `auth/signin-session.spec.ts`), PR01 to PR15 (profile and password, `account/profile.spec.ts` and `account/password.spec.ts`), PW01 to PW16 (password recovery and invitation mails, `auth/password-recovery.spec.ts`), DL01 to DL15 (leaving, removal and workspace deletion, `workspace/leave-removal.spec.ts`), IP01 to IP05, IP07, IP08 (sign-in provider configuration, `auth/providers-config.spec.ts`), IP10 to IP15 (sign-in through a mock provider, `auth/providers-login.spec.ts`), AK01 to AK08 (API keys, `account/api-keys.spec.ts`), WM01, WM03, WM04, WM06, WM08 to WM12 (members and workspaces in the UI, `workspace/members-gui.spec.ts` and `workspace/workspaces-gui.spec.ts`), GR01 to GR10 (groups, `workspace/groups-gui.spec.ts`), SH01 to SH06 (sharing, `workspace/share-gui.spec.ts`). - S1 insert, save, publish, load every one of the 112 types (`@insert-all`; catalog unit tests in `insert-catalog.spec.ts`). - S2 text inputs; S3 choice components; S4 date and time; S5 sliders and colour picker; S6 buttons and menus; S7 display components. @@ -296,13 +296,13 @@ Test titles carry these ids. - D3 the plugin catalogue of node-service: the image serves exactly the registered node plugins, each definition has a form and a query config, the Java-native types carry no definition (`@node-service`; the catalogue only, no plugin query runs). - D4 the DuckDB plugin of node-service, run in the app container with an in-memory database and no network: rows, the published view after a click, a BIGINT as a string, a fresh database per run, a syntax error as a failed query (`@node-service`). - D5 the Turso and Slack plugins of node-service against the echo sidecar: a Turso query sends one Hrana pipeline and answers its rows, `includeRaw` answers values and raw, a non-OK answer and an `error` result fail the query (the latter prints `[object Object]`, D-66 candidate), the published view after a click; a Slack query posts the form payload to the webhook (`@node-service`; the request shape and the answer's path into the app, not the vendor service). -- D6 the GitLab and Shopify GraphQL plugins of node-service against the echo sidecar: a GitLab query posts the query, the variables and every header (data source, query and the access token), a GraphQL error answer fails the query, the published view after a click; a Shopify query reaches the endpoint, and the header the query sets does not (D-67 candidate) (`@node-service`; the request shape and the answer's path into the app, not the vendor service). +- D6 the GitLab and Shopify GraphQL plugins of node-service against the echo sidecar: a GitLab query posts the query, the variables and every header (data source, query and the access token), a GraphQL error answer fails the query, the published view after a click; a Shopify query reaches the endpoint, and the header the query sets reaches it too (D-67 candidate, fixed on the upgraded node-service) (`@node-service`; the request shape and the answer's path into the app, not the vendor service). - D7 the generic Open API plugin of node-service against the echo sidecar: the data source form's dynamic config reads the OpenAPI document from its URL (the echo serves a canned document) and answers the spec and the key field, an operation runs against the server URL with the key in the header the document names, the key comes from the data source (no key, no header), an error status answers its body as a successful result (D-69 candidate), the published view after a click, the dynamic config answer is cached in memory per request body, with no expiry (observation) (`@node-service`). - D8 the Open API wrapper plugins of node-service with a server URL (CouchDB, Jira, Datadog, WooCommerce, Supabase Management API) against the echo sidecar: one read-only operation each reaches the server URL (the target's path survives as the base path) with its credentials and answers the canned data, CouchDB JWT credential alone and with a Basic one (observation), WooCommerce server URL forms and refusal of v1/v2, a trailing slash after the API path doubles it (D-70 candidate), concurrent queries against two server URLs each reach their own server (`@node-service`). -- D9 the Open API wrapper plugins of node-service with a server URL (Lowcoder API, OpenAI, APITemplate.io, Carbone, UiPath) against the echo sidecar: one read-only operation each reaches the server URL with its credentials and answers the canned data (Carbone `get_status` sends no token: observation), every Lowcoder spec version, an OpenAI chat completion posts its JSON body, OpenAI on spec version v1.0 sends no key (D-72 candidate), an error status answered as success (D-69 candidate), UiPath fails every query and its query configuration request (HTTP 500) and sends nothing (D-71 candidate; its desired behaviour is quarantined), concurrent queries against two server URLs each reach their own server (`@node-service`). +- D9 the Open API wrapper plugins of node-service with a server URL (Lowcoder API, OpenAI, APITemplate.io, Carbone, UiPath) against the echo sidecar: one read-only operation each reaches the server URL with its credentials and answers the canned data (Carbone `get_status` sends no token: observation), every Lowcoder spec version, an OpenAI chat completion posts its JSON body, OpenAI sends the key as a Bearer header on every spec version (D-72 candidate, fixed on the upgraded node-service), an error status answered as success (D-69 candidate), a UiPath folders query reaches the server URL with its Bearer token and its query configuration lists the operations (D-71 candidate, fixed on the upgraded node-service), concurrent queries against two server URLs each reach their own server (`@node-service`). - D10 the DynamoDB and S3 plugins of node-service (AWS SDK v3) against the echo sidecar: a DynamoDB call is a signed JSON POST to `/ddb/` (`x-amz-target`, credential scope with the access key and region, the secret never sent), GetItem, PutItem and Query wrap the request's values and unwrap the answer's typed attributes, a service error fails the query with its message, the published view after a click; the S3 connection test lists the buckets (API and the form's Test Connection button), a refused test answers `code` 500 with the service's text (HTTP 200), a listBuckets query answers the names, every call that takes a bucket (listObjects with and without a presigned URL, readFile, uploadData, deleteFile) is path-style `/s3//` on the echo's IP address, a service error fails the query, a bucket call without a bucket sends nothing (readFile, uploadData and deleteFile show the SDK's text, D-73 candidate) (`@node-service`; the signed request's shape and the answer's path into the app, not the vendor service). -- D11 the Supabase Storage plugin of node-service (`supabase-js`, project URL `/sb`) against the echo sidecar: every operation (listBuckets, listObjects, readFile, uploadData, deleteFile, createSignedUrl) sends its Storage API request below `/sb/storage/v1` with the key in `apikey` and `authorization` and nowhere else, a trailing slash of the project URL changes nothing, a storage error fails the query with `{"size":0,"timeout":0}` and not the API's message (D-74 candidate), the signed-URL validity is an epoch time in milliseconds (D-75 candidate), the `search` field of listObjects is not sent (D-76 candidate), only listObjects refuses an empty bucket (D-77 candidate), the published view after a click (`@node-service`; the request shape and the answer's path into the app, not Supabase). -- D12 the Firebird plugin of node-service against the opt-in Firebird sidecar (`@node-service-sidecar`, only with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1`): the connection test attaches, a wrong password and a missing database file fail it with the server's text, a named parameter answers the lower-cased row, every column type of the seeded table, parameters bound in SQL order, not object order, an unknown parameter is refused with its name, an INSERT is read back by its own owner, a SQL error is the failed query's message, the lower-case option, a failing query leaves its attachment open (D-78 candidate), and the runner reaches the sidecar over TCP. +- D11 the Supabase Storage plugin of node-service (`supabase-js`, project URL `/sb`) against the echo sidecar: every operation (listBuckets, listObjects, readFile, uploadData, deleteFile, createSignedUrl) sends its Storage API request below `/sb/storage/v1` with the key in `apikey` and `authorization` and nowhere else, a trailing slash of the project URL changes nothing, a storage error fails the query with the API's message (D-74 candidate, fixed on the upgraded node-service), the signed-URL validity is 300 seconds (D-75 candidate, fixed), the `search` field of listObjects is sent (D-76 candidate, fixed), only listObjects refuses an empty bucket (D-77 candidate), the published view after a click (`@node-service`; the request shape and the answer's path into the app, not Supabase). +- D12 the Firebird plugin of node-service against the opt-in Firebird sidecar (`@node-service-sidecar`, only with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1`): the connection test attaches, a wrong password and a missing database file fail it with the server's text, a named parameter answers the lower-cased row, every column type of the seeded table, parameters bound in SQL order, not object order, an unknown parameter is refused with its name, an INSERT is read back by its own owner, a SQL error is the failed query's message, the lower-case option, a failing query detaches its attachment like a succeeding one (D-78 candidate, fixed on the upgraded node-service), and the runner reaches the sidecar over TCP. - D13 the Turso plugin of node-service against the opt-in libSQL server sidecar (`@node-service-sidecar`, only with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1`): create, insert and select answer typed rows (integer, real, a lower-case `boolean`, `datetime`, NULL), `includeRaw` answers the server's own result set, a write answers no values and its raw result counts the change, a blob cell is dropped from the row (D-79 candidate), an integer beyond 2^53 is rounded (D-80 candidate), a real SQL error (syntax, unknown column, constraint, two statements) fails the query with `[object Object]` (D-66 candidate, the defect of D5d against a real server), a token of another key or a malformed one is a 401, a read-only token reads and its write is a 403, the published view after a click, a trailing slash after the URL is a 404, and the runner reaches the sidecar. The `libsql://` rewrite is not covered. - D14 the CouchDB plugin of node-service against the opt-in CouchDB server sidecar (`@node-service-sidecar`, only with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1`): a database is created, listed (by a key range), described and deleted, and the server agrees at each step; a document is created, read, updated by its revision, read at its old revision, listed and deleted; a stale revision (as a query parameter or as `If-Match`) answers a conflict body and changes nothing (D-69 candidate); a missing database or document and an existing database answer their error bodies (D-69 candidate); a wrong password answers an unauthorized body and writes nothing (D-69 candidate); five wrong passwords lock the account for the client address and even the right password then gets the lockout's 403 body (D-69 candidate); `docGet` cannot run without `If-None-Match` and a matching ETag fails with `status: 304` (D-81 candidate); the listing options (`startkey`, `endkey`, `descending`, `skip`, `limit`) reach the server; the published view shows a document after a click; and the runner reaches the sidecar. The JWT credential and cookie sessions are not covered. - D15 the DynamoDB plugin of node-service against the opt-in DynamoDB Local server sidecar (`@node-service-sidecar`, only with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1`): a table is created (the description's complete shape), refused when it exists, listed and paged by name, and the server agrees at each step (D15a); an item of every type the plugin writes (string, empty string, integers, negative, fraction, booleans, null, map, number set, string set, mixed list, list of maps) is stored in the typed form and read back as plain values (D15b); Query (key condition, range, projection, descending, `Limit`) and Scan (filter, `Select: COUNT`) answer unwrapped items with the counts, `LastEvaluatedKey` stays typed, and a scan with `Limit: 2` is paged by feeding each returned typed key into the next request until none is returned: no item missing or twice, no page above the limit, at least three requests, the last page without a key (D15c); UpdateItem and DeleteItem change the server's data, a failed condition changes nothing, and `ReturnValues` answers `Attributes` that stay typed (D15d, D15e, D-82 candidate); a missing table, a failed condition, a missing or mistyped key, an empty key, a bad table name and an existing table fail the query with the server's own message (D15f); an array of strings or numbers is always a set (order lost, duplicates and an empty array refused, D-83 candidate, D15g); a binary attribute reads as an object with index keys and a number beyond a double loses digits (D-84 candidate, D15h); an `ExclusiveStartKey` in the plain form fails with the SDK's `TypeError` (D-85 candidate, D15i); any access key reaches the same tables and a closed port of the sidecar's host fails with the connection error (D15j); the published view shows an item after a click (D15k); and the runner reaches the sidecar (D15l). DescribeTable and DeleteTable are not offered by the form (direct calls only); indexes, transactions, batch operations and streams are not covered. @@ -312,10 +312,10 @@ Test titles carry these ids. ## Test catalogue Counts (re-measured 2026-11-26 with `LOWCODER_BASE_URL=http://localhost:1 ./node_modules/.bin/playwright test --list --reporter=list` from `e2e/`; this is a static listing, not a Docker run. Docker evidence: (1) the "confirmed in the combined run" notes of the security and lifecycle rows below come from an earlier run against an image built from the security-fix branch (tag `secfix-combined-e2e`, 693 of 696 default tests passed); that run predates the node-service specs (D3 to D10) and says nothing about them. (2) The full default run of the 859-test suite after the S3 sidecar scenarios (D16) landed, `e2e/scripts/run-in-docker.sh` without arguments on the default image `3.0.0-e2e` (no variable set): 44 failed, 815 passed (6.8 min). It started no Firebird, libSQL, CouchDB, DynamoDB Local or S3 container (the script's log shows only the PostgreSQL, echo and app `Starting` lines; a default `tests/smoke` run watched with a container sampler (one `docker ps` every 0.3 s) showed the PostgreSQL, echo, app and runner containers only) and ran no D12 to D16 test (they are not in the listing). The baseline from a clean `git worktree` of the previous commit (850 tests, same command and image, run before the edits): 45 failed, 805 passed (6.7 min). The failing sets are identical except one test (compared by test name, 45 against 44 lines): `components/media.spec.ts` S12 "carousel shows its two slides and the second dot fires change" failed in the baseline and passed in this run (it is not related to the node-service work and was not re-run to see whether it is intermittent). By tag the 44 failures are 25 `@security`, 17 `@lifecycle` (LC-PW02 of them also `@core`), 1 more `@core` (`apps/card-menu.spec.ts` export and import) and 1 `@npm` (`components/npm-components.spec.ts` calendar, also `@slow`), the same as the baseline's apart from the carousel test; the security and lifecycle ones depend on security fixes the unfixed image lacks (classified by tag, not analysed one by one). `SEC-R09d` failed in both runs (it is intermittent: it passed in earlier full runs); the periodic trigger test of `logic/triggers.spec.ts` failed in neither. The ten extra passes are the nine new unit tests of `foundation/node-plugins.spec.ts` and the carousel test. No node-service scenario failed. The D12, D13 and D14 evidence is a separate gate each, `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1 e2e/scripts/run-in-docker.sh --repeat-each=10 --workers=4 `: for `tests/datasource/plugin-firebird.spec.ts` 110 passed on `3.0.0-e2e` and 110 passed on `3.0.1-e2e` (measured when D12 landed), for `tests/datasource/plugin-turso-libsql.spec.ts` 110 passed on `3.0.0-e2e` and 110 passed on `3.0.1-e2e` (measured when D13 landed), for `tests/datasource/plugin-couchdb.spec.ts` 100 passed on `3.0.0-e2e` and 100 passed on `3.0.1-e2e`, and after the readiness probes got their time limits 110 passed for the Firebird spec and 110 for the libSQL spec on `3.0.0-e2e` (all three sidecars start; the app was ready 15 s after the first container started with the flag against 14 s without it). For `tests/datasource/plugin-dynamodb-local.spec.ts` (D15) 120 passed on `3.0.0-e2e` and 120 passed on `3.0.1-e2e`, run after the last change of the spec (all four sidecars start; `docker events` showed the PostgreSQL, echo, Firebird, libSQL, CouchDB and DynamoDB Local containers created within one second, and the script logged every readiness wait as `ready after 0s`, the last one three seconds after the first container was created; the readiness waits run after the app container is started, so they do not delay it). Dangling volumes, measured by hand on one machine (no artifact is committed): before the PostgreSQL and Firebird sidecars got a tmpfs over their declared data volumes (`/var/lib/postgresql/data`, `/var/lib/firebird/data`), a default run left one anonymous volume (PostgreSQL's) and a flagged run two (PostgreSQL's and Firebird's); the libSQL and CouchDB sidecars already mounted a tmpfs over theirs, and the images of DynamoDB Local, the echo and the app declare none. Method: `docker volume ls -q -f dangling=true` sorted and diffed before and after each run, and `docker events --since --until --filter type=volume --filter event=create` over the run. Results (count before to after, volume-create events, 0 in every row but the control): the default `tests/smoke` run 222 to 222; the flagged single-spec runs of Firebird, libSQL, CouchDB and DynamoDB Local 222 to 222 each; a deliberately failing flagged run (one assertion of the Firebird spec inverted, then restored; the run exited 1) 222 to 222; the five gates (`--repeat-each=10 --workers=4` of the four sidecar specs with the flag, and of `tests/smoke` without it) 223 to 223 each, and the Firebird gate on `lowcoderorg/lowcoder-ce:3.0.1-e2e` 223 to 223; in none of them did the list gain a name. A control, the pinned PostgreSQL image started without the tmpfs and then removed, logged exactly one create event and took the count from 222 to 223 (the new name was in the diff), so the method does see a leak. The count of the machine drifted between sessions (222, then 223) because of unrelated Docker activity, so only before/after pairs taken close together are evidence, not the absolute numbers. The 130 or more dangling volumes of earlier runs were not touched; `docker volume ls -q -f dangling=true` lists them, and it may list other projects' volumes, so delete them only knowing whose they are. With the flag, `--grep @node-service-sidecar` ran all the sidecar tests (D12, D13, D14) in one run when D14 landed: 32 passed; D15 was run through its own gate above, not in that combined run. After the four readiness loops got their elapsed-time deadline, `tests/datasource/plugin-firebird.spec.ts` (11), `plugin-turso-libsql.spec.ts` (11) and `plugin-couchdb.spec.ts` (10) each ran once on `3.0.0-e2e` with the flag and passed, and the D15 gate above was repeated (120 passed on both images). For `tests/datasource/plugin-s3-server.spec.ts` (D16) `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1 e2e/scripts/run-in-docker.sh --repeat-each=10 --workers=4 tests/datasource/plugin-s3-server.spec.ts`: 150 passed on `3.0.0-e2e` (34.8 s) and 150 passed on `lowcoderorg/lowcoder-ce:3.0.1-e2e` (36.0 s) (all five sidecars start; the script logged every readiness wait as `ready after 0s` or `1s`). With the flag, `--grep @node-service-sidecar --workers=4` ran all five sidecar specs in one run: 59 passed (D12 11, D13 11, D14 10, D15 12, D16 15; 16.9 s). Ten inverted assertions of the D16 spec (the wrong-secret message, a bucket listed after its create, the stored content type, the limited listing, the truncated answer, the deleted key's status, the tampered-signature code, the missing-key message, the empty-bucket message and the large body's size) failed in one run and the restored file passed again; six deliberate changes of the run script (the S3 loop back to the sleep-only counter, its accepted status widened, its abort limit removed, one tmpfs removed, the trap's container removed, a network alias added) made five structural tests fail, and three changes of `src/datasource/s3.ts` (the string to sign, the IPv4 check, the key encoding) made three unit tests fail; each was restored and checked by checksum. A deliberately failing flagged run (one D16h assertion inverted, restored afterwards) ended with the run exiting 1, no container and no network left (`docker ps -a` and `docker network ls` filtered on the run's name prefix: 0 and 0). A default `tests/smoke` run, the flagged hold run that made the hand measurements above, and that failing flagged run each took the dangling-volume count from 223 to 223 with no volume-create event (`docker events`), and the new names diff was empty. These Docker results were measured by hand on one machine; no result files are committed, so re-run the commands named here to reproduce them.): -default **862 tests in 115 files**; with `E2E_INCLUDE_QUARANTINE=1` **875 in 116**; with `E2E_INCLUDE_SUPERADMIN=1` **867 in 115**; with both of those **880 in 116**; -with `E2E_INCLUDE_INSERT_ALL=1` **974 in 116**; with all three opt-in variables **992 in 117** (the takeover variable changes nothing on the default stack); with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1` **921 in 120** (the 11 D12 tests of the Firebird sidecar, the 11 D13 tests of the libSQL sidecar, the 10 D14 tests of the CouchDB sidecar, the 12 D15 tests of the DynamoDB Local sidecar and the 15 D16 tests of the S3 sidecar, which no other variable lists), and **1051 in 122** with the other three variables as well. With `E2E_STACK_PROFILE=enterprise`: +default **879 tests in 116 files**; with `E2E_INCLUDE_QUARANTINE=1` **880 in 116**; with `E2E_INCLUDE_SUPERADMIN=1` **884 in 116**; with both of those **885 in 116**; +with `E2E_INCLUDE_INSERT_ALL=1` **978 in 117**; with all three opt-in variables **991 in 117** (the takeover variable changes nothing on the default stack); with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1` **925 in 121** (the 11 D12 tests of the Firebird sidecar, the 11 D13 tests of the libSQL sidecar, the 10 D14 tests of the CouchDB sidecar, the 12 D15 tests of the DynamoDB Local sidecar and the 15 D16 tests of the S3 sidecar, which no other variable lists), and **1050 in 122** with the other three variables as well. With `E2E_STACK_PROFILE=enterprise`: **8 in 1** (SEC-E01 to E04, E06a, E06b, E07a, E07b as of D-34; also with `E2E_INCLUDE_QUARANTINE=1` alone, which opens nothing extra), **1 in 1** with `E2E_INCLUDE_ENTERPRISE_TAKEOVER=1` alone (SEC-E05 alone, no quarantine flag needed any more); `E2E_INCLUDE_INSERT_ALL` and `E2E_INCLUDE_SUPERADMIN` add nothing there. `@enterprise` is 9 tests, none in a default-stack listing. With `E2E_STACK_PROFILE=signup-disabled`: **5 in 1** (LC-AU20 to AU24). -Default-run tag counts (`--list --reporter=list --grep `): `@smoke` 7, `@core` 57, `@slow` 39, `@npm` 32, `@security` 157, `@lifecycle` 112, `@node-service` 154 in 10 files (the 63 unit tests of `foundation/node-plugins.spec.ts` plus the 91 scenario tests of the plugin specs: D3a to D3c, D4a to D4e, D5a to D5f, D6a to D6e, D7a to D7f, D8a to D8i (11 tests), D9a to D9k with the four D9m tests (15 tests) and D10a to D10q (19 tests: D10m and D10n have two each) and D11a to D11q (21 tests: D11b and D11g have two each, D11n three); a selection tag, they stay in the default run; **213 in 15 files** with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1`, which adds the 11 D12 tests, the 11 D13 tests, the 10 D14 tests, the 12 D15 tests and the 15 D16 tests); `@node-service-sidecar` 0 (**59 in 5 files** with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1`: D12a to D12k, the Firebird sidecar tests, D13a to D13k, the libSQL sidecar tests, D14a to D14j, the CouchDB sidecar tests, D15a to D15l, the DynamoDB Local sidecar tests, and D16a to D16o, the S3 sidecar tests). On request: `@quarantine` 13 (with `E2E_INCLUDE_QUARANTINE=1`; no `@quarantine` test also carries `@superadmin` any more, so the same 13 with both variables), `@superadmin` 5 (the four SEC-R16 tests and the `superAdmin` fixture helper test), `@insert-all` 112. The 13 `@quarantine` tests: the lifecycle ones are LC-AU15 (D-30) and the three new creator-shortcut candidates LC-DL13 to LC-DL15 (`workspace/leave-removal.spec.ts`, D-26/D-60 residual, an open scope question for the owner); the rest are the open security findings SEC-C17c (D-30, two variants), SEC-R17f (D-46), SEC-A10b (D-13), the two quarantined tests of `foundation/security-helpers.spec.ts` (D-45, D-46 candidates), `editor/drop-size.spec.ts` (D-5), the icon switch of `components/displays.spec.ts` (CD-9 candidate) and D9l of `datasource/plugin-openapi-wrappers-apps.spec.ts` (the UiPath query that should reach the server URL with its Bearer token; D-71 candidate; it fails on `3.0.0-e2e` and `3.0.1-e2e`). For all of these except D9l, whether each PASSES as expected (quarantined ones failing, default-run ones passing) on a built image is confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`). That run predates the node-service specs, so it says nothing about D9l: D9l was checked separately with `E2E_INCLUDE_QUARANTINE=1` on the default image `3.0.0-e2e` and on `lowcoderorg/lowcoder-ce:3.0.1-e2e`, where it fails with "the query succeeded" as intended. +Default-run tag counts (`--list --reporter=list --grep `): `@smoke` 7, `@core` 57, `@slow` 39, `@npm` 32, `@security` 162, `@lifecycle` 119, `@node-service` 154 in 10 files (the 63 unit tests of `foundation/node-plugins.spec.ts` plus the 91 scenario tests of the plugin specs: D3a to D3c, D4a to D4e, D5a to D5f, D6a to D6e, D7a to D7f, D8a to D8i (11 tests), D9a to D9k with the four D9m tests (15 tests) and D10a to D10q (19 tests: D10m and D10n have two each) and D11a to D11q (21 tests: D11b and D11g have two each, D11n three); a selection tag, they stay in the default run; **213 in 15 files** with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1`, which adds the 11 D12 tests, the 11 D13 tests, the 10 D14 tests, the 12 D15 tests and the 15 D16 tests); `@node-service-sidecar` 0 (**59 in 5 files** with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1`: D12a to D12k, the Firebird sidecar tests, D13a to D13k, the libSQL sidecar tests, D14a to D14j, the CouchDB sidecar tests, D15a to D15l, the DynamoDB Local sidecar tests, and D16a to D16o, the S3 sidecar tests). On request: `@quarantine` 1 (with `E2E_INCLUDE_QUARANTINE=1`; no `@quarantine` test also carries `@superadmin` any more, so the same 1 with both variables), `@superadmin` 5 (the four SEC-R16 tests and the `superAdmin` fixture helper test), `@insert-all` 112. The one `@quarantine` test is the quarantined test of `foundation/security-helpers.spec.ts` (D-45 candidate); both quarantine maps are empty. The anonymous e-mail lookup (D-13, SEC-A10b) left the quarantine on 2026-11-26 as by design and is pinned. The creator (`createdBy`) right to read its app and bundle and to manage its folder after a removal or rejoin (D-26/D-60 residual, LC-DL13 to LC-DL15) is by design (owner decision 2026-11-26) and pinned. The join through a workspace's sign-in or sign-up page (D-30, SEC-C17c and LC-AU15) left it on 2026-11-26 as by design and is pinned; the bundle recycle (D-46), the drop width (D-5) and the icon switch (CD-9) left it the same day (they pass 10 of 10 on `qfix-full-e2e`). Whether each PASSES as expected (quarantined ones failing, default-run ones passing) on a built image is confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`). Since the reassessment of 2026-11-22 on `lowcoderorg/lowcoder-ce:3.0.1-e2e` the quarantine holds only what still fails there: 25 tests whose test passed on 3.0.1 left it and are in the default run (SEC-R16c and SEC-R16d are in the `@superadmin` run), and LC-GR03, LC-PR06 and LC-IP07 left the open list. ### smoke (6) @@ -328,12 +328,12 @@ Since the reassessment of 2026-11-22 on `lowcoderorg/lowcoder-ce:3.0.1-e2e` the | smoke/network-guard.spec.ts | requests to lowcoder.cloud are blocked, the app is let through | @smoke | 1 | | smoke/api-docs.spec.ts | the springdoc OpenAPI document is served anonymously, and the Swagger UI page renders one operation block per operation of it | @smoke | 2 | -### auth, workspace, apps (88 default, 95 with the quarantined), account (25 default, 27 with the quarantined) +### auth, workspace, apps (102 default, none quarantined), account (27 default, none quarantined) | File | Proves | Tags | Tests | |---|---|---|---| | auth/login.spec.ts | sign-in and sign-out; wrong password stays on sign-in | @core | 2 | -| auth/signup-edge.spec.ts | LC-AU01 to AU08, AU15 to AU17: a registered address in any casing, a malformed address, the password rules of the form, the invitation link, a workspace sign-up page, a mismatched confirmation, an admin's create-user route with a weak password (LC-AU15 is quarantined: D-30; LC-AU07 fixed on this branch: D-48) | @lifecycle, @core for AU08, @quarantine for 1 | 11 (10 default) | +| auth/signup-edge.spec.ts | LC-AU01 to AU08, AU15 to AU18c: a registered address in any casing, a malformed address, the password rules of the form, the invitation link, a workspace sign-up page, a mismatched confirmation, an admin's create-user route with a weak password (LC-AU15 pins the join of D-30, by design; LC-AU07 fixed on this branch: D-48); LC-AU18a to c: a sign-up or sign-in through an invitation answers success and joins the invited workspace, and an invitation of a removed member lets nobody in (D-90, fixed on this branch) | @lifecycle, @core for AU08 | 14 default | | auth/signin-session.spec.ts | LC-AU09 to AU14: unknown address, choosing among two workspaces, UI sign-out ends the server session, cookie lifetime, redirects of signed-in and anonymous visitors | @lifecycle, @core for AU11 | 6 | | auth/password-recovery.spec.ts | LC-PW01 to PW16: the forgot page mails one reset link, the reset page sets the password from the link as mailed (PW02), a token works once, a new request kills the earlier token, a wrong or another user's token is refused, the answer hides whether an address has an account, the invitation mail from the dialog is opened as mailed and lets the addressee in with one slash before `invite/` (PW13), a reset to a weak password is refused and the token stays usable, the invite dialog's success notice is the exact localized text (PW15, fixed on this branch: D-55); PW08 fixed on this branch: D-34, PW12 fixed on this branch: D-54, PW16 fixed on this branch: D-48, all four Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`); PW09, PW10, PW11 and PW14 pass and run by default, PW11 fixed on this branch: D-58. Trace off: the pages and requests carry tokens | @lifecycle, @core for PW02 | 16 (16 default) | | auth/signup-disabled.spec.ts | LC-AU20 to AU24 on the sign-up-disabled stack: a sign-up through the API is refused (400 / 5003), the register page redirects to the sign-in page, the sign-in page and an invitation page offer no sign-up, an admin's create-user call is refused | @lifecycle, @signup-disabled | 5 (0 on the default stack) | @@ -345,7 +345,7 @@ Since the reassessment of 2026-11-22 on `lowcoderorg/lowcoder-ce:3.0.1-e2e` the | account/api-keys.spec.ts | LC-AK01 to AK08: a key created in the UI authenticates, the token is shown once and listed masked, a key deleted in the UI stops working, no key card for a plain member, a name is required, a key follows the user's current workspace, two keys of one second never share a token (LC-AK08 passes: D-51 fixed) | @lifecycle | 8 default | | workspace/members-gui.spec.ts | LC-WM01, WM03, WM04, WM06, WM12: the All Users group page (group roles, Remove from Group leaves the membership: O-16), the invite dialog's link lets a user in, a plain member has no settings and the API leave works, an unknown invitation code | @lifecycle, @core for WM04 | 5 | | workspace/workspaces-gui.spec.ts | LC-WM08 to WM11: Create Workspace in the avatar menu, switching, renaming, deleting with the exact name | @lifecycle | 4 | -| workspace/leave-removal.spec.ts | LC-DL01 to DL15: a removed member leaves the groups and loses its app grants (and does not get them back on rejoin), a leave cleans the same, an app of a removed developer stays with the workspace, a removed user keeps its account and own workspace, a user in no workspace is told 'User not found', deleting a workspace removes it for its members and its groups can no longer be read, its apps can no longer be opened, its invitation admits nobody; a removed member's bundle grant does not survive a rejoin (LC-DL12); the creator-shortcut candidates (LC-DL13 to LC-DL15, quarantined) assert the denial the member-leave clean-up does not give a removed/rejoined creator of an app, a folder and a bundle (D-26, D-60 residuals, an open scope question for the owner) | @lifecycle, @quarantine for 3 | 15 (12 default) | +| workspace/leave-removal.spec.ts | LC-DL01 to DL15: a removed member leaves the groups and loses its app grants (and does not get them back on rejoin), a leave cleans the same, an app of a removed developer stays with the workspace, a removed user keeps its account and own workspace, a user in no workspace is told 'User not found', deleting a workspace removes it for its members and its groups can no longer be read, its apps can no longer be opened, its invitation admits nobody; a removed member's bundle grant does not survive a rejoin (LC-DL12); the creator's permanent `createdBy` right is pinned (LC-DL13 to LC-DL15, by design, owner decision 2026-11-26): a removed or rejoined creator still views its app and reads its bundle's elements (the editing view stays denied), and a rejoined creator renames its folder again, each with controls that rule out every other source of the access (member role, no user row, no listed group, no public flag) | @lifecycle | 15 default | | workspace/groups-gui.spec.ts | LC-GR01 to GR10: create, rename (an empty name refused), delete (a deleted group's grant no longer stays on 3.0.1-e2e: D-53 fixed, LC-GR03 passes), add members, group roles, remove, exit (the only group admin cannot), the built-in groups (a rename refused with UNSUPPORTED_OPERATION, D-52 fixed), the developers group makes a developer | @lifecycle | 10 (10 default) | | workspace/share-gui.spec.ts | LC-SH01 to SH06: the share dialog of the editor (add a viewer, change to editor, remove, the public switch, no Publish button for a non-owner editor) and the data source's Access Control (Can Use) | @lifecycle, @core for SH01 | 6 | | workspace/member-access.spec.ts | invited member sees only shared apps; invitation link flow | @core | 2 | @@ -363,7 +363,7 @@ Since the reassessment of 2026-11-22 on `lowcoderorg/lowcoder-ce:3.0.1-e2e` the | editor/rename-component.spec.ts | rename on canvas, in the saved app, after reload | @core | 1 | | editor/move-resize.spec.ts | drag and resize handle are saved | @core | 2 | | editor/js-query.spec.ts | a JS query written in the editor runs | @core | 1 | -| editor/drop-size.spec.ts | a component dropped right after ready has width above 0 (D-5) | @quarantine | 1 | +| editor/drop-size.spec.ts | a component dropped right after ready has width above 0 (D-5, regression test) | none | 1 | ### datasource (101 default, 133 with `E2E_INCLUDE_NODE_SERVICE_SIDECARS=1`) @@ -373,20 +373,20 @@ Since the reassessment of 2026-11-22 on `lowcoderorg/lowcoder-ce:3.0.1-e2e` the | datasource/table.spec.ts | D2: editor-built table bound to a query; published table; sort, page, select, filter, notes edit/save | @core @slow | 3 | | datasource/query-feeds-components.spec.ts | D1: query feeds text and table, owner-scoped writes re-read, chart renders | @core @slow @npm | 1 | | datasource/notes-queries.spec.ts | unit tests of the query builders | none | 4 | -| datasource/plugin-duckdb.spec.ts | D4: DuckDB through the app container, database `:memory:`, no network. D4a a query answers rows, D4b the published view shows the result after a click, D4c a BIGINT and a HUGEINT arrive as exact strings, D4d each run is a fresh database (a table created by one run is gone in the next), D4e a syntax error is a failed query (`success: false`, `queryCode: FAILED`; the field `code` is 1 either way). D4a to D4c assert the measured row shape, keys are the column positions (D-68 candidate) | @node-service | 5 | +| datasource/plugin-duckdb.spec.ts | D4: DuckDB through the app container, database `:memory:`, no network. D4a a query answers rows, D4b the published view shows the result after a click, D4c a BIGINT and a HUGEINT arrive as exact strings, D4d each run is a fresh database (a table created by one run is gone in the next), D4e a syntax error is a failed query (`success: false`, `queryCode: FAILED`; the field `code` is 1 either way). D4a to D4c assert rows keyed by the column names (the upgraded node-service changed this on purpose; the images before it keyed rows by position, D-68 candidate) | @node-service | 5 | | datasource/plugin-turso-slack.spec.ts | D5: Turso and Slack against the echo sidecar (the data source URL is the test's own echo target). D5a a Turso query sends one POST of `{requests: [execute, close]}` to `/v2/pipeline` with `Authorization: Bearer ` and answers the rows keyed by column name (an `integer` cell as a number), D5b `includeRaw` answers `{values, raw}`, D5c a 500 answer fails the query (`Endpoint returned 500`), D5d an `error` result fails the query with `Cannot parse result, received error: [object Object]` (D-66 candidate: the server's message is lost), D5e the published view shows the row after a click, D5f a Slack query posts `payload=` as `application/x-www-form-urlencoded;charset=UTF-8` to the webhook path and answers the webhook's text. Not covered: the `libsql://` rewrite (the echo does not speak TLS) | @node-service | 6 | -| datasource/plugin-graphql.spec.ts | D6: GitLab and Shopify against the echo sidecar (the endpoint is the test's own echo target plus `/api/graphql`). D6a a GitLab query posts one JSON body `{query, variables: {n: 3}, operationName}` (the variable's text `3` arrives as the number 3) with `PRIVATE-TOKEN`, the data source header and the query header, and answers the `data` member, D6b a `{"errors":[...]}` answer fails the query with `: `, D6c a Shopify query posts `{query, variables: {}}` and answers the `data` member (control), D6d the header the Shopify query sets reaches the echo neither as name nor as value (D-67 candidate), D6e the published view shows the GitLab answer after a click | @node-service | 5 | +| datasource/plugin-graphql.spec.ts | D6: GitLab and Shopify against the echo sidecar (the endpoint is the test's own echo target plus `/api/graphql`). D6a a GitLab query posts one JSON body `{query, variables: {n: 3}, operationName}` (the variable's text `3` arrives as the number 3) with `PRIVATE-TOKEN`, the data source header and the query header, and answers the `data` member, D6b a `{"errors":[...]}` answer fails the query with `: `, D6c a Shopify query posts `{query, variables: {}}` and answers the `data` member (control), D6d the header the Shopify query sets reaches the echo under its own name with its value (D-67 candidate, fixed on the upgraded node-service), D6e the published view shows the GitLab answer after a click | @node-service | 5 | | datasource/plugin-openapi.spec.ts | D7: the generic Open API plugin against the echo sidecar (spec URL `/spec.json`, server URL `/api`; the document is `OPEN_API_FIXTURE_SPEC`: `GET /items`, operation `listItems`, parameter `q`, API key header `X-E2E-Key`, placeholder server). D7a the dynamic config call (`path` `$.dataSourceConfig.extra`) answers `[{data: {spec}, extraParams}]` with the key field `E2EKeyAuth.value` labelled `X-E2E-Key` and fetches the document with exactly one GET, D7b `listItems` sends `GET /api/items?q=` with `x-e2e-key` and answers the canned `[{id: 1}]`, D7c a data source with an empty `dynamicParamsConfig` sends no key header, D7d a canned 404 `{"message":"e2e-missing"}` is answered as `success: true`, `queryCode: "OK"`, data the 404 body (D-69 candidate), D7e the published view shows the first item's id only after the click (echo 0 requests before, exactly 1 after), D7f the same dynamic config request answers from the cache after the document changed on the echo (one fetch), while a request with another body fetches again; the cache is an in-process object keyed on path, query and body with no expiry (observation) | @node-service | 6 | | datasource/plugin-openapi-wrappers-data.spec.ts | D8: CouchDB, Jira, Datadog, WooCommerce and the Supabase Management API against the echo sidecar (server URL ``, one read-only operation of each bundled document). D8a couchdb `GET /_all_dbs` with `Authorization: Basic` of the configured user and password, D8b jira `GET /rest/api/3/myself` with Basic, D8c datadog `GET /api/v1/validate` with `dd-api-key` and `dd-application-key`, D8d woocommerce `GET /wp-json/wc/v3/products?context=view&order=asc&orderby=date&status=any&type=simple&stock_status=instock` with Basic, D8e supabaseApi `GET /v1/projects` with `Authorization: Bearer `; each asserts echo empty before, exactly one request (method, full path and query, no body, the complete header set) and the canned body as the query's data; D8f couchdb: a JWT credential alone is sent as `Authorization`, with a Basic credential too only the Basic one is (observation), each request asserted completely; D8g woocommerce: a plain, a slash-terminated and an already `/wp-json/wc/v3` server URL each give the API path once, `/wc/v1` and `/wc/v2` are refused with `only woocommerce api v3 is supported` and send nothing; D8h woocommerce: a server URL ending in `/wp-json/wc/v3/` gets the API path twice (D-70 candidate); D8i couchdb, woocommerce and datadog: 8, 8 and 4 queries against two server URLs, with the echo withholding every answer (a barrier) until all of them are waiting, so the canned data reaches them only if all requests were waiting at the echo at the same time (nothing is claimed about node-service's internals); each then reaches only its own server with its full request (measured: no cross-over, so the tests run in parallel with no serial mode) | @node-service | 11 | -| datasource/plugin-openapi-wrappers-apps.spec.ts | D9: the Lowcoder API, OpenAI, APITemplate.io, Carbone and UiPath against the echo sidecar (server URL ``, one read-only operation of each bundled document). D9a lowcoder `GET /api/users/currentUser` with `Authorization: Bearer `, D9b OpenAI (spec version v2.3) `GET /models` with `Authorization: Bearer `, D9c apiTemplate `GET /v2/list-templates` with `x-api-key`, D9d carboneIo `GET /status` with NO credential header (observation: that operation lists no security scheme), D9e carboneIo `GET /template/` with `Authorization: Bearer ` and `carbone-version: 4`; each asserts echo empty before, exactly one request (method, full path and query, body, the complete header set) and the canned body as the query's data; D9f lowcoder: spec versions v1.0 to v1.3 send the same request; D9g OpenAI: a chat completion `POST /chat/completions` carries the JSON body, `content-type`, `content-length` and the key, and answers the canned completion; D9h OpenAI: spec version v1.0, chosen or by default, sends no `Authorization` header while v2.3 with the same key does (D-72 candidate); D9i apiTemplate: a canned 404 body is reported as a successful result (D-69 candidate); D9j uiPath: a query fails with the message `Maximum call stack size exceeded` and sends no request, after a control that another wrapper's query reaches the same echo target (D-71 candidate); D9k uiPath: the form's query configuration request for the UiPath document answers 500 / code 5000 `get dynamic config error`, while the identical request for apiTemplate answers success and lists its operations (D-71 candidate; the test asserts the failure and the control, not its cause); D9l uiPath (`@quarantine`, not counted in the default run): the folders query should reach `GET /odata/Folders` with `Bearer ` exactly and answer the canned data, fails today; D9m lowcoder, apiTemplate, carboneIo and OpenAI: 8, 8, 8 and 4 queries against two server URLs, with the echo withholding every answer (a barrier) until all of them are waiting, so the canned data reaches them only if all requests were waiting at the echo at the same time (nothing is claimed about node-service's internals); each then reaches only its own server with its full request (measured: no cross-over, so the tests run in parallel with no serial mode) | @node-service | 15 (+1 `@quarantine`) | +| datasource/plugin-openapi-wrappers-apps.spec.ts | D9: the Lowcoder API, OpenAI, APITemplate.io, Carbone and UiPath against the echo sidecar (server URL ``, one read-only operation of each bundled document). D9a lowcoder `GET /api/users/currentUser` with `Authorization: Bearer `, D9b OpenAI (spec version v2.3) `GET /models` with `Authorization: Bearer `, D9c apiTemplate `GET /v2/list-templates` with `x-api-key`, D9d carboneIo `GET /status` with NO credential header (observation: that operation lists no security scheme), D9e carboneIo `GET /template/` with `Authorization: Bearer ` and `carbone-version: 4`; each asserts echo empty before, exactly one request (method, full path and query, body, the complete header set) and the canned body as the query's data; D9f lowcoder: spec versions v1.0 to v1.3 send the same request; D9g OpenAI: a chat completion `POST /chat/completions` carries the JSON body, `content-type`, `content-length` and the key, and answers the canned completion; D9h OpenAI: every spec version, chosen or by default, sends the key as `Authorization: Bearer ` (D-72 candidate, fixed on the upgraded node-service); D9i apiTemplate: a canned 404 body is reported as a successful result (D-69 candidate); D9j uiPath: a folders query reaches `GET /odata/Folders` with `Bearer ` exactly and answers the canned data (D-71 candidate, fixed on the upgraded node-service: the images before it overflowed the stack on the UiPath document); D9k uiPath: the form's query configuration request answers success and lists `Folders_Get`, like the identical request for apiTemplate; D9m lowcoder, apiTemplate, carboneIo and OpenAI: 8, 8, 8 and 4 queries against two server URLs, with the echo withholding every answer (a barrier) until all of them are waiting, so the canned data reaches them only if all requests were waiting at the echo at the same time (nothing is claimed about node-service's internals); each then reaches only its own server with its full request (measured: no cross-over, so the tests run in parallel with no serial mode) | @node-service | 15 | | datasource/plugin-aws-sdk.spec.ts | D10: DynamoDB and S3 against the echo sidecar (endpoints `/ddb` and `/s3`; bucket calls on the echo's IP address). Measured on 3.0.0-e2e and 3.0.1-e2e (the SDK version printed in its user agent is 3.668.0 on 3.0.0-e2e; the tests match the shape, not the version): the SDK keeps the endpoint's path, DynamoDB posts to `/ddb/`, S3 without a bucket gets `/s3/?x-id=ListBuckets`, and with a bucket on an IP-address endpoint it is path-style (`/s3//`, `Host` the IP address). Every request a D10 test makes is asserted completely: method, path and query, body, the whole header set (per-request values by shape: date, invocation id, user agents, signature), the credential scope (access key, date, region, service) and the signed-header list, and every D10 test that sends a request also asserts that the secret key is in no header, path or body of the echo's records (with a control that the access key is: it travels in the credential scope). The rows of D10q that send nothing assert that the echo holds no record, after which a control call with a bucket is asserted completely. The presigned URL of D10l is asserted by its stable query parameters and by shape, not by value. D10a DynamoDB ListTables (region `eu-central-1` in the scope, body `{TableName: "", Limit: 10}`, answer without `$metadata`), D10b GetItem wraps the key and unwraps a string, a number, a string set and a boolean, D10c PutItem wraps a number, a string and a boolean, D10d Query keeps the expression and unwraps the items, D10e a 400 `ResourceNotFoundException` fails the query (`Requested resource not found`, one request), D10f the published view after a click, D10g the connection test (`code` 1, `success`, `data` true; one `GET /s3/?x-id=ListBuckets`), D10h a 403 test answers HTTP 200 with `code` 500, `success` false and `Failed to connect data source: Access Denied.`, and the same body succeeds once the endpoint answers 200, D10i the form's Test Connection button shows that text, then `Connection Successful`, D10j listBuckets answers `[{name}]`, D10k listObjects is path-style on the IP with `delimiter`, `max-keys` and `prefix` and answers name, size, time, file URL, D10l `returnSignedUrl` adds a presigned URL (`X-Amz-Expires=300`, signed header `host`, no extra request), D10m readFile as text and base64, D10n uploadData of text and of base64 without a content type (`application/octet-stream`), D10o deleteFile, D10p a 403 and a 404 fail the query with the service's text, D10q a bucket call without a bucket sends nothing: listObjects says `Bucket is required`, readFile, uploadData and deleteFile say `Empty value provided for input HTTP label: Bucket.` (D-73 candidate), after a control that a call with a bucket reaches the echo. Not covered: a real DynamoDB or S3 service, the SDK's retry of a 5xx answer | @node-service | 19 | -| datasource/plugin-supabase-storage.spec.ts | D11: the Supabase Storage plugin against the echo sidecar (project URL `/sb`; the Storage API is `/sb/storage/v1/...`). Measured on 3.0.0-e2e and 3.0.1-e2e (same requests and answers; supabase-js 2.45.4 in `x-client-info`, matched by shape): the client keeps the project URL's path with or without a trailing slash and derives no host name; every request carries `apikey: `, `authorization: Bearer `, the `node-fetch` user agent, `accept-encoding: gzip,deflate` and `connection: close`. Every request a D11 test makes is asserted completely (method, path and query, body, the whole header set), and every test that sends one also asserts that the key is in no header besides those two, no path or body, and no answer of the query (the whole query answer; in D11q the view's whole `q.data` as text); control: it is in those two. D11a listBuckets `GET /bucket` and the buckets as the API answered, D11b the project URL with and without a trailing slash reach the same path, D11c listObjects `POST /object/list/` with `{limit: 10, offset: 0, sortBy: {column: name, order: asc}, prefix}` and the public URL of each file in the answer, D11d limit, offset and sort order of the query, D11e the `search` field is not sent (D-76 candidate), D11f `returnSignedUrl` adds `POST /object/sign/` with `{expiresIn, paths}` and the signed URL in the answer, D11g readFile as text and base64 (`GET /object//`, answer `{data, type}`), D11h readFile with a transform goes to `/render/image/authenticated//?width=10`, D11i uploadData of text `POST /object//` with the text, its content type, `cache-control: max-age=3600` and `x-upsert: false`, D11j base64 without a content type sends an empty `content-type` header (observation), D11k uploadData with `returnSignedUrl` uploads then signs, D11l deleteFile `DELETE /object/` with `{prefixes: [name]}`, D11m createSignedUrl sends `expiresIn` as an integer above 1e12, an epoch time in milliseconds computed once (the second query, asserted completely too, sends the same number; the bounds allow one hour of clock skew and a plugin load up to six hours old; D-75 candidate, also asserted in D11f and D11k), D11n a 400, a 404 and a 401 answer fail the query with `{"size":0,"timeout":0}` instead of the answer's message, each followed by a control that the same query succeeds once the API answers 200 (D-74 candidate), D11o the signing and the listing fail the same way, each followed by a control that both succeed once the API answers 200 on their paths, D11p an empty bucket: listObjects says `Bucket is required` and sends nothing, readFile, uploadData, deleteFile and createSignedUrl send requests with an empty bucket segment (D-77 candidate), D11q the published view shows the bucket name only after the click (echo empty before, one request after). Not covered: a real Supabase project; the connection test (none is wired up for this plugin) | @node-service | 21 | -| datasource/plugin-firebird.spec.ts | D12: the Firebird plugin against the opt-in Firebird sidecar (Firebird 3.0.12, `fixtures/firebird/init.sql`; host, port, database path and login of the sidecar written over the recorded form body). Measured on 3.0.0-e2e and 3.0.1-e2e. D12a the connection test answers `code` 1, `success` true, `data` true; D12b a wrong password answers `code` 500 with `Failed to connect data source: Your user name and password are not defined. Ask your database\nadministrator to set up a Firebird login\n.` and a missing database file with the server's `I/O error for file ...` (the right fields attach first); D12c `SELECT ID, NAME FROM FB_ITEMS WHERE ID = :id` with `{"id": 2}` answers `[{id: 2, name: "beta"}]`; D12d the three seeded rows with `price` as a number and a NULL as `null`; D12e parameters bind in the order the names appear in the SQL, not the key order of the parameter object (`CAST(:first AS INTEGER) - CAST(:second AS INTEGER)` with 10 and 3 answers 7 whichever order the object lists them); D12f an unknown name fails with `Named parameter "missing" not found in Query Parameters object.` (the same SQL with the name present runs); D12g an INSERT answers `{}` and is read back by the test's own owner (the owner has no row before); D12h a syntax error and an unknown table answer the server's text; D12i `lowercaseKeys: false` answers upper-case keys; D12j a query that fails after the attach leaves its attachment open on the server, a succeeding one does not: two failing runs of a statement that tags its attachment with a per-test context variable leave exactly two tagged attachments in `MON$CONTEXT_VARIABLES`, and a succeeding tagged run does not add a third (D-78 candidate, `defect` annotation); D12k the runner connects to the sidecar's port 3050, and a closed port of the same host is refused. Limits: `role`, `blobAsText` and Firebird 4 and 5 are not covered; the sidecar authenticates with Legacy_Auth (see the architecture bullet) | @node-service @node-service-sidecar (opt-in) | 11 | +| datasource/plugin-supabase-storage.spec.ts | D11: the Supabase Storage plugin against the echo sidecar (project URL `/sb`; the Storage API is `/sb/storage/v1/...`). Measured on the upgraded node-service image (the D-74, D-75 and D-76 defects of 3.0.0-e2e and 3.0.1-e2e are fixed there and the tests pin the fixed behaviour; the request shape is the same on both; supabase-js's version in `x-client-info` is matched by shape): the client keeps the project URL's path with or without a trailing slash and derives no host name; every request carries `apikey: `, `authorization: Bearer `, the `node-fetch` user agent, `accept-encoding: gzip,deflate` and `connection: close`. Every request a D11 test makes is asserted completely (method, path and query, body, the whole header set), and every test that sends one also asserts that the key is in no header besides those two, no path or body, and no answer of the query (the whole query answer; in D11q the view's whole `q.data` as text); control: it is in those two. D11a listBuckets `GET /bucket` and the buckets as the API answered, D11b the project URL with and without a trailing slash reach the same path, D11c listObjects `POST /object/list/` with `{limit: 10, offset: 0, sortBy: {column: name, order: asc}, prefix}` and the public URL of each file in the answer, D11d limit, offset and sort order of the query, D11e the `search` field is sent (D-76 candidate, fixed on the upgraded node-service), D11f `returnSignedUrl` adds `POST /object/sign/` with `{expiresIn, paths}` and the signed URL in the answer, D11g readFile as text and base64 (`GET /object//`, answer `{data, type}`), D11h readFile with a transform goes to `/render/image/authenticated//?width=10`, D11i uploadData of text `POST /object//` with the text, its content type, `cache-control: max-age=3600` and `x-upsert: false`, D11j base64 without a content type sends an empty `content-type` header (observation), D11k uploadData with `returnSignedUrl` uploads then signs, D11l deleteFile `DELETE /object/` with `{prefixes: [name]}`, D11m createSignedUrl sends `expiresIn` 300, the validity in seconds (D-75 candidate, fixed on the upgraded node-service), the same on a second query (also asserted in D11f and D11k), D11n a 400, a 404 and a 401 answer fail the query with the answer's message, each followed by a control that the same query succeeds once the API answers 200 (D-74 candidate, fixed on the upgraded node-service), D11o the signing and the listing fail the same way, each followed by a control that both succeed once the API answers 200 on their paths, D11p an empty bucket: listObjects says `Bucket is required` and sends nothing, readFile, uploadData, deleteFile and createSignedUrl send requests with an empty bucket segment (D-77 candidate), D11q the published view shows the bucket name only after the click (echo empty before, one request after). Not covered: a real Supabase project; the connection test (none is wired up for this plugin) | @node-service | 21 | +| datasource/plugin-firebird.spec.ts | D12: the Firebird plugin against the opt-in Firebird sidecar (Firebird 3.0.12, `fixtures/firebird/init.sql`; host, port, database path and login of the sidecar written over the recorded form body). Measured on 3.0.0-e2e and 3.0.1-e2e. D12a the connection test answers `code` 1, `success` true, `data` true; D12b a wrong password answers `code` 500 with `Failed to connect data source: Your user name and password are not defined. Ask your database\nadministrator to set up a Firebird login\n.` and a missing database file with the server's `I/O error for file ...` (the right fields attach first); D12c `SELECT ID, NAME FROM FB_ITEMS WHERE ID = :id` with `{"id": 2}` answers `[{id: 2, name: "beta"}]`; D12d the three seeded rows with `price` as a number and a NULL as `null`; D12e parameters bind in the order the names appear in the SQL, not the key order of the parameter object (`CAST(:first AS INTEGER) - CAST(:second AS INTEGER)` with 10 and 3 answers 7 whichever order the object lists them); D12f an unknown name fails with `Named parameter "missing" not found in Query Parameters object.` (the same SQL with the name present runs); D12g an INSERT answers `{}` and is read back by the test's own owner (the owner has no row before); D12h a syntax error and an unknown table answer the server's text; D12i `lowercaseKeys: false` answers upper-case keys; D12j a query that fails after the attach detaches its attachment like a succeeding one (D-78 candidate, fixed on the upgraded node-service): a control block that tags its own attachment counts 1 in `MON$CONTEXT_VARIABLES`, then two failing runs of a statement that tags its attachment with a per-test context variable and a succeeding one leave 0 tagged attachments; D12k the runner connects to the sidecar's port 3050, and a closed port of the same host is refused. Limits: `role`, `blobAsText` and Firebird 4 and 5 are not covered; the sidecar authenticates with Legacy_Auth (see the architecture bullet) | @node-service @node-service-sidecar (opt-in) | 11 | | datasource/plugin-turso-libsql.spec.ts | D13: the Turso plugin against the opt-in libSQL sidecar (sqld 0.24.33 with a JWT key; the data source URL is `http://e2e-libsql:8080`, the recorded `turso` form body with the sidecar's URL and token written over it; each test makes its own table `e2e_t_`). Measured on 3.0.0-e2e and 3.0.1-e2e. D13a CREATE, two INSERTs and a SELECT: a CREATE and an INSERT answer `[]`, the empty table answers `[]` before the inserts, then `integer` is a number, `real` 2 stays 2, a `boolean` column written in lower case is `true`/`false`, a `datetime` text is the ISO text of a `Date` (`2024-01-02T03:04:05.000Z`), NULL is `null`; D13b `includeRaw` answers `values` and the server's `raw` (columns with their declared types, cells such as `{type:"integer", value:"7"}`, the counters; the timing is only checked to be a number); D13c an INSERT answers `[]` with and without `includeRaw`, its raw result has `affected_row_count` 1 and `last_insert_rowid` `"2"` (a string) for the second row; D13d a blob cell is missing from the row (`[{id: 1}]`) while `includeRaw` shows the server sent `{type:"blob", base64:"AP8Q"}` (D-79 candidate); D13e `SELECT 9007199254740993` answers 9007199254740992 while the raw cell is the exact string (D-80 candidate); D13f `SELEC 1`, an unknown column, a duplicate key and `SELECT 1; SELECT 2` are errors of the server with codes `SQL_PARSE_ERROR`, `SQL_INPUT_ERROR`, `SQLITE_CONSTRAINT` and `SQL_MANY_STATEMENTS` (read by direct calls), and every one of them reaches the app as `Cannot parse result, received error: [object Object]` (D-66 candidate; a valid query of the same app succeeds first); D13g a token signed by another key and a string that is no JWT fail with `Failed to execute query. Endpoint returned 401: Unauthorized.` (the sidecar's own token reads the row first; direct calls show the server's `The JWT is invalid` and, without a header, `Expected authorization header but none given`); D13h a read-only token reads, its INSERT fails with `Endpoint returned 403: Forbidden.` and writes nothing (the read-write token then inserts the same row); D13i the published view shows a row after a click; D13j a URL with a trailing slash fails with `Endpoint returned 404: Not Found.` (the plugin builds `//v2/pipeline`; the same URL without it works); D13k the runner reaches the sidecar over HTTP and TCP, a closed port of the same host is refused. Limits: the `libsql://` to `https://` rewrite, a stream with a baton, and Turso's cloud features are not covered | @node-service @node-service-sidecar (opt-in) | 11 | | datasource/plugin-couchdb.spec.ts | D14: the CouchDB plugin against the opt-in CouchDB sidecar (Apache CouchDB 3.5.1; the data source URL is `http://e2e-couchdb:5984`; the recorded `couchdb` form body with the sidecar's URL and admin written over it; each test makes its own database `e2e_couch_` and removes it). Measured on 3.0.0-e2e and 3.0.1-e2e. D14a a database is created (`{ok: true}`), listed by a key range (`[]` before, `[]` after), described (`GET /`: the member set of 3.5.1, `doc_count` 0), and deleted, with direct reads of the server at each step; D14b a document is created (`{ok, id, rev: 1-...}`), read (`{_id, _rev, ...body}`), updated with `rev` as a query parameter (`2-...`), read at its first revision, listed with `include_docs`, and deleted (`3-...`; the server then answers `deleted`), and the server's own copy matches; D14c a stale revision (query parameter and `If-Match`, on write and delete) and a write without a revision answer `{error: "conflict", reason: "Document update conflict."}` as the data of a SUCCESSFUL query (the server's status is 409), change nothing, and the current revision is accepted by a write and by both kinds of delete (D-69 candidate); D14d a missing document, a document of a missing database, the information and the delete of a missing database (404 bodies) and a create of an existing database (412 `file_exists`) are successful queries with the error body as the data (D-69 candidate), with successful controls through the same operations (an existing document is read, an existing database is described and deleted, a new one is created); D14e a wrong password answers `{error: "unauthorized", reason: "Name or password is incorrect."}` as the data of a successful query and the refused create made no database, while the right password on the same queries lists and creates (D-69 candidate; the account is a second admin the test makes); D14f `docGet` with an empty `If-None-Match` fails with the plugin's own `Required parameter If-None-Match is not provided` (the server reads the same document without the header), a value that is not the current ETag reads the document, and the current ETag (the server answers 304) fails with `status: 304` (D-81 candidate); D14g `startkey`/`endkey`, `descending`, `skip` and `limit` give the lists the server gives, for databases and for the documents of a database (`total_rows` counts all of them), and an unscoped list holds the three system databases and the test's own; D14h the published view shows the document's title after a click; D14i the runner reaches the sidecar over HTTP and TCP (`Welcome`, version 3.5.1, `_all_dbs` needs credentials), a closed port of the same host is refused; D14j five wrong passwords of an account are 401 bodies, the sixth and the right password after them are the lockout's 403 body as the data of a successful query (the runner, another client address, is not locked until it fails five times itself, then the server's own status is 403) (D-69 candidate). Limits: JWT and cookie authentication, replication, design documents, partitions, attachments and bulk operations are not covered | @node-service @node-service-sidecar (opt-in) | 10 | | datasource/plugin-dynamodb-local.spec.ts | D15: the DynamoDB plugin against the opt-in DynamoDB Local sidecar (DynamoDB Local 3.3.2, `-inMemory -sharedDb`; the endpoint is `http://e2e-dynamodb:8000`; the recorded `dynamodb` form body with the sidecar's endpoint and throw-away key written over it; each test makes its own tables `e2e_ddb_` and removes them). Measured on 3.0.0-e2e and 3.0.1-e2e. D15a to D15l as in the catalogue (D15): table create, list and paging, the typed round trip of every type, Query and Scan with pagination keys, UpdateItem and DeleteItem with conditions and `ReturnValues`, the server's error messages, sets, binary and big numbers, the plain `ExclusiveStartKey`, any access key and a closed port, the published view, and the runner's reach. D-82 to D-85 candidates are characterised and annotated. Not covered: indexes, transactions, batch operations, streams, TTL, the signature (the server does not verify it) | @node-service @node-service-sidecar (opt-in) | 12 | | datasource/plugin-s3-server.spec.ts | D16: the S3 plugin against the opt-in S3 sidecar (versitygw v1.11.0 with its POSIX backend in tmpfs; the endpoint is the sidecar's IP address `http://:7070`, never a name; the recorded `s3` form body and the five recorded queries with the sidecar's endpoint and throw-away key pair written over them; each test makes its own bucket `e2e-s3-` INSIDE its `try` and removes its objects and the bucket in the `finally`; direct signed calls from the test process, `s3Direct`, are the controls that show what the server holds). Measured on 3.0.0-e2e and 3.0.1-e2e. D16a to D16o as in the catalogue (D16). D-73, D-86, D-87, D-88 and D-89 candidates are characterised and annotated. Not covered: a real AWS S3 (the server differs in limits, versioning, ACLs, storage classes and checksums), multipart upload, an expired presigned URL | @node-service @node-service-sidecar (opt-in) | 15 | -| datasource/node-plugins-catalogue.spec.ts | D3: the catalogue serves exactly the 46 registered node plugins (measured on 3.0.0-e2e and 3.0.1-e2e, so `duckdb` loads), every definition has a form and a query config, all 14 Java-native types of the catalogue answer `definition: null` (an explicit list, so a dropped or renamed type fails) | @node-service | 3 | +| datasource/node-plugins-catalogue.spec.ts | D3: the catalogue serves exactly the 45 registered node plugins (measured on the upgraded node-service image, so `duckdb` loads; the `fauna` plugin was removed on purpose), every definition has a form and a query config, all 14 Java-native types of the catalogue answer `definition: null` (an explicit list, so a dropped or renamed type fails) | @node-service | 3 | ### logic (22) @@ -407,7 +407,7 @@ Since the reassessment of 2026-11-22 on `lowcoderorg/lowcoder-ce:3.0.1-e2e` the | modules/module-editor-host.spec.ts | M3: host built in the editor, D-3 retry and handler retry | @slow | 1 | | modules/module-helpers.spec.ts | unit tests of `src/modules/moduleScenario.ts` | none | 6 | -### components (102 default, 215 with S1 and the quarantined one) +### components (103 default, 215 with S1) | File | Proves | Tags | Tests | |---|---|---|---| @@ -416,7 +416,7 @@ Since the reassessment of 2026-11-22 on `lowcoderorg/lowcoder-ce:3.0.1-e2e` the | components/date-time.spec.ts | S4 typed dates and times; invalid date refused | none | 1 | | components/sliders-color.spec.ts | S5 slider, rangeSlider, colorPicker | none | 1 | | components/buttons.spec.ts | S6 each button, link, dropdown, navigation, step, floatingButton handler | none | 1 | -| components/displays.spec.ts | S7 bound properties change on state change; icon cases | none, @quarantine for the icon switch | 3 | +| components/displays.spec.ts | S7 bound properties change on state change; icon cases | none | 3 | | components/containers.spec.ts | S8 container bodies and slots | none | 8 | | components/overlays.spec.ts | S9 modal, drawer, toast, tour | none | 4 | | components/forms.spec.ts | S10 form, jsonSchemaForm | none | 3 | @@ -433,10 +433,10 @@ Since the reassessment of 2026-11-22 on `lowcoderorg/lowcoder-ce:3.0.1-e2e` the | components/scenario-helpers.spec.ts | unit tests of `src/components/scenario.ts` | none | 5 | | components/simple-helpers.spec.ts | unit tests of `src/simple-components/seed.ts` | none | 9 | -### security (157 default; 4 more with `E2E_INCLUDE_QUARANTINE=1`; 4 more with `E2E_INCLUDE_SUPERADMIN=1`; needs the stack; measured 2026-11-24 from `e2e/`: `LOWCODER_BASE_URL=http://localhost:1 ./node_modules/.bin/playwright test --list --reporter=list --grep @security` and the same with each opt-in variable) +### security (162 default; none quarantined; 4 more with `E2E_INCLUDE_SUPERADMIN=1`; needs the stack; measured 2026-11-26 from `e2e/`: `LOWCODER_BASE_URL=http://localhost:1 ./node_modules/.bin/playwright test --list --reporter=list --grep @security` and the same with each opt-in variable) Access-control tests, API level plus UI checks in SEC-R01a, R01e, R02a, R04a+, R05b, R06b, R06d+, R07a, R07c, R08d, R10b, R11a, R13, A06a, A11 and the UI rows of the cross-workspace tests (page objects `SettingPage`, `DatasourcePage`, `AppListPage`, `AppViewPage`, `EditorPage`; where a measurement contradicts the expected UI behaviour, the test encodes what was measured and says so). -Titles are `SEC- `, tags `@security` (the P0 set also `@core`); each denial asserts HTTP status and `code` (`API_ERRORS`; exceptions: SEC-A10b, whose desired answer is only "no workspace id in the body", SEC-R15c, which accepts the two refusals of the folder grant but asserts one exact answer for the decisive step, and the rows that are not a denial, SEC-A11 to A13); the +Titles are `SEC- `, tags `@security` (the P0 set also `@core`); each denial asserts HTTP status and `code` (`API_ERRORS`; exceptions: SEC-R15c, which accepts the two refusals of the folder grant but asserts one exact answer for the decisive step, and the rows that are not a denial, SEC-A11 to A13); the scenarios that try to change something also read the resource back with the owner's session (read-only scenarios assert a before control and the denial). A scenario that asserts the desired behaviour and fails on the image under test (latest assessed: 3.0.1-e2e) is `@quarantine` with the `defect` annotation of `src/security/quarantine.ts` (`OPEN_DEFECTS`; `FIXED_ON_BRANCH` is empty); a failure nobody expected is first a "candidate" (`securityCandidateDetails`, annotation ` candidate: ...`) until it gets a D id in the table "Security findings" below; none is open now. @@ -514,23 +514,23 @@ first makes sure some admin exists (accepting both answers), so none depends on |---|---|---|---| | security/enterprise.spec.ts | SEC-E01 (new users join the super admin's workspace as members), E02 and E03 (a removed user's session and API key stop at once), E04 (a removed user cannot sign in again), E06a (no second workspace), E06b (no account oracle in the e-mail lookup), E07a and E07b (an admin's reset ends the member's sessions; a self-reset keeps the asking session and ends the others, D-34, Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)) | @security, @enterprise, @superadmin for E01 to E04, E06a, E07a, E07b | 8, only with `E2E_STACK_PROFILE=enterprise` | | security/enterprise-takeover.spec.ts | SEC-E05 (D-40, fixed on this branch): an admin cannot reset the super admin's password; alone on its own stack | @security, @enterprise, @enterprise-takeover, @superadmin | 1, only with `E2E_STACK_PROFILE=enterprise` and `E2E_INCLUDE_ENTERPRISE_TAKEOVER=1` | -| security/cross-org.spec.ts | cross-workspace rows (C01 to C22): another workspace's app, datasource, query, settings, roles, members, folders, groups, permission rows; C16g+ (the app's editor may call the slug route), C16h (an unknown app id answers NO_RESOURCE_FOUND); 2 tests are `@quarantine` (C17c); C09, C10, C11, C13, C15, C16b, C16c, C16f, C16g+, C16h, C17a, C17b, C18b, C19a, C19b, C20, C21 and C22e pass and run by default (C09, C11, C19a, C19b and C22e fixed on this branch: D-7, D-6; C10 fixed on this branch: D-8; C16f, C16g+ and C16h fixed on this branch: D-37, the app slug route now needs EDIT_APPLICATIONS; C21 fixed on this branch: D-31; all four Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)) | @security, @core for 8 (the P0 rows), @quarantine for 1 | 41 default + 3 quarantined (C17c has an API and a UI test) | -| security/bundles.spec.ts | C23 (another workspace's bundle cannot be viewed, recycled, shared, reordered, published, renamed or created in; C23a and C23c pass on 3.0.1-e2e) and R17 (a developer's bundle: R17a+ positive, R17b a member whose own workspace is current cannot create a bundle in another workspace (D-11, D-41, fixed on this branch: the dev check now reads the target workspace, Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)), R17c viewer gets no editing DSL of an app it may not edit (D-42, Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)), R17d viewer cannot recycle or delete, R17e editor cannot grant owner, R17f the creator's recycle, R17g a public bundle's published view carries no app editing DSL, an anonymous caller is refused (401); only R17f `@quarantine`) | @security, @quarantine for 1 | 12 default + 1 quarantined | +| security/cross-org.spec.ts | cross-workspace rows (C01 to C22): another workspace's app, datasource, query, settings, roles, members, folders, groups, permission rows; C16g+ (the app's editor may call the slug route), C16h (an unknown app id answers NO_RESOURCE_FOUND); C17c (API and UI variants) pins the join of D-30, by design; C09, C10, C11, C13, C15, C16b, C16c, C16f, C16g+, C16h, C17a, C17b, C18b, C19a, C19b, C20, C21 and C22e pass and run by default (C09, C11, C19a, C19b and C22e fixed on this branch: D-7, D-6; C10 fixed on this branch: D-8; C16f, C16g+ and C16h fixed on this branch: D-37, the app slug route now needs EDIT_APPLICATIONS; C21 fixed on this branch: D-31; all four Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)) | @security, @core for 8 (the P0 rows) | 44 default (C17c has an API and a UI test) | +| security/bundles.spec.ts | C23 (another workspace's bundle cannot be viewed, recycled, shared, reordered, published, renamed or created in; C23a and C23c pass on 3.0.1-e2e) and R17 (a developer's bundle: R17a+ positive, R17b a member whose own workspace is current cannot create a bundle in another workspace (D-11, D-41, fixed on this branch: the dev check now reads the target workspace, Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)), R17c viewer gets no editing DSL of an app it may not edit (D-42, Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)), R17d viewer cannot recycle or delete, R17e editor cannot grant owner, R17f the creator's recycle, R17g a public bundle's published view carries no app editing DSL, an anonymous caller is refused (401), R17h the creator's restore from the trash (D-46 restore, fixed on this branch: measured 500 / 5005 on `nsu-full-e2e`, success on `qfix-full-e2e`); none `@quarantine`) | @security | 14 | | security/roles.spec.ts | R01 to R10: member without grant, viewer, editor, developer, plain member, anonymous visitor are held to their rights, the data source rows (R09), the workspace admin rows (R07, R08); R01d to R01g+: the app record route needs EDIT (member and viewer refused, the viewer still opens the published view; editor and workspace admin allowed, D-32, Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)); R03f+: an owner of the app changes its status through the update route; R06c and R06e: a member whose own workspace is current cannot create an app or a data source in another workspace (D-11, D-41); R07d and R07e: no sign-in client secret in a member's workspace or profile answer (D-14); R16: the instance super admin opens a private app's editing view and writes a config key (R16a, R16b), a workspace admin cannot demote or remove it (R16c D-23, R16d D-24); no security test of this file is quarantined any more; R06c, R07d, R09d and R03b fixed on this branch (R06c: D-11, the dev check now reads the target workspace, not the visitor's current one; R07d: D-14; R09d: D-38, each data source of a batch is now decided in its own workspace, so it no longer borrows the admin role of E's own workspace and is no longer intermittent; R03b: D-9, a status change through the update route now needs MANAGE_APPLICATIONS, not just EDIT_APPLICATIONS; all four Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)); R08c, R08d, R09c, R11b, R16c and R16d pass on 3.0.1-e2e | @security, @core for the 10 P0 rows, @superadmin for 4 (R16a to R16d) | 44 default + 0 quarantined + 4 `@superadmin` | | security/draft-queries.spec.ts | R19 (D-10): R19a+ an app editor runs a draft-only query; R19b a viewer cannot run draft queries; R19c a host editor runs a module's published query, never its draft; R19d a host editor without a right on the module cannot run it through the host; R19e a never-published module's draft runs for a host editor who may read it, not in its own editor without edit | @security | 5 | | security/group-grants.spec.ts | R05 (group grants, a member removed from the group loses the right, UI after reload) and R14 (group administration) | @security | 6 | -| security/membership-changes.spec.ts | R11 to R13 (a removed member, a demoted admin, a removed permission row with a session open) and R15 (folder rights); R11b passes on 3.0.1-e2e, R15c passes and runs by default, fixed on this branch: D-7 | @security | 9 | +| security/membership-changes.spec.ts | R11 to R13 (a removed member, a demoted admin, a removed permission row with a session open) and R15 (folder rights); R11b passes on 3.0.1-e2e (a removed creator still views its app through the permanent creator right, by design; the editing view is denied), R15c passes and runs by default, fixed on this branch: D-7 | @security | 9 | | security/credentials.spec.ts | A01 to A05: forged, unsigned and wrongly signed tokens, API keys (a removed member's key, a member's key), logged-out and made-up cookies, forwarding headers; A04 fixed on this branch (D-34, Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)); A02a passes on 3.0.1-e2e (D-45 fixed; the 3.0.0 server kept the user's last API key after a delete) | @security, @core for A01a and A03a | 9 default | | security/mass-assignment.spec.ts | A06 to A08: a member cannot promote itself, an update cannot move an app or change its creator or public flag, a viewer's eight write routes (A08a to A08h); A06b and A07a pass on 3.0.1-e2e | @security, @core for A06a and A07b | 13 | -| security/public-leakage.spec.ts | A09 and A10: what a public app and the session-free routes show an anonymous visitor (A09b and A09d are pins); quarantined: A10b (A09a passes on 3.0.1-e2e; A09c, A10a and A10c are un-quarantined by this branch's fix, Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)) | @security, @quarantine for 1 | 6 default + 1 quarantined | +| security/public-leakage.spec.ts | A09 and A10: what a public app and the session-free routes show an anonymous visitor (A09b, A09d and A10b are pins; A10b pins the anonymous e-mail lookup, D-13, by design: per workspace its id and name only, in the shared paged envelope; A09a passes on 3.0.1-e2e; A09c, A10a and A10c are un-quarantined by this branch's fix, Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)) | @security | 7 | | security/outbound.spec.ts | SEC-X01a to X01e: the npm registry proxy against the echo sidecar (X01a+, X01d+ and X01e+ pass; X01b and X01c, D-35, fixed on this branch, Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`); X01e+: a module's npm component inside a host app loads through the host app id) | @security | 5 default | | security/outbound-n8n.spec.ts | SEC-X02a and X02b: the n8n plugin's request against the echo sidecar (X02a+ and X02b pass; X02b, D-27, passes on 3.0.1-e2e); trace off for the file | @security | 2 | | security/collab-room.spec.ts | A11: a chat controller of another workspace does not receive the room of a private app (two browser sessions, the image's hocuspocus); passes and runs by default, fixed on this branch: D-36 | @security | 1 | | security/transport.spec.ts | A12 (CORS: a foreign origin is not allowed to read credentialed answers; passes and runs by default, fixed on this branch: D-33's CORS-credentials half) and A13 (session cookie flags) | @security | 2 | -SEC-R09d (D-38) left the quarantine: the check took the workspace of the first id of a `HashSet`; each id is now decided in its own workspace (Java unit and MongoDB integration tests green 2026-11-24; Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)). Accounting of the earlier 3.0.0 run `E2E_INCLUDE_QUARANTINE=1 e2e/scripts/run-in-docker.sh --workers=4 --reporter=list --grep "@quarantine" tests/security` (measured before the `@superadmin` tag existed and before the reassessment, so it listed 44 tests, 19 of which have since left the quarantine): 44 listed, 43 failed, 1 passed (SEC-R09d); the two quarantined tests of `foundation/security-helpers.spec.ts` are outside that folder. +SEC-R09d (D-38) left the quarantine: the check took the workspace of the first id of a `HashSet`; each id is now decided in its own workspace (Java unit and MongoDB integration tests green 2026-11-24; Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)). Accounting of the earlier 3.0.0 run `E2E_INCLUDE_QUARANTINE=1 e2e/scripts/run-in-docker.sh --workers=4 --reporter=list --grep "@quarantine" tests/security` (measured before the `@superadmin` tag existed and before the reassessment, so it listed 44 tests, 19 of which have since left the quarantine): 44 listed, 43 failed, 1 passed (SEC-R09d); the quarantined test of `foundation/security-helpers.spec.ts` is outside that folder. -### foundation (319 default, 322 with the quarantined and the `@superadmin` ones; unit and builder tests; several touch the stack) +### foundation (341 default, 343 with the quarantined and the `@superadmin` ones; unit and builder tests; several touch the stack) | File | Proves | Tags | Tests | |---|---|---|---| @@ -547,7 +547,7 @@ SEC-R09d (D-38) left the quarantine: the check took the workspace of the first i | foundation/products-table.spec.ts | products fixture and `TableView` | none | 2 | | foundation/table-view-header.spec.ts | header lookup is exact | none | 1 | | foundation/d3-threshold-reporter.spec.ts | D-3 gate verdicts of the reporter | none | 9 | -| foundation/security-helpers.spec.ts | the security helpers of `src/api/client.ts`, `src/security/actors.ts` and `src/security/scene.ts` against the stack (`apiRaw`, `actor`, `joinWorkspace`, `makeDeveloper`, grants, folders, datasources, API keys, bundles, `publishBundle`, `setBundlePublicToAll`, `signIn`, `getApp`, `listGroupMembers`, `sceneOf`, `memberOf`, `roleOf`, `permissionIdOf`, `adminOfApiUser`, the `superAdmin` fixture, ...); 2 tests are `@quarantine` (D-45 API-key delete, D-46 bundle recycle) | none, @superadmin for 1, @quarantine for 2 | 37 default + 1 `@superadmin` + 2 quarantined | +| foundation/security-helpers.spec.ts | the security helpers of `src/api/client.ts`, `src/security/actors.ts` and `src/security/scene.ts` against the stack (`apiRaw`, `actor`, `joinWorkspace`, `makeDeveloper`, grants, folders, datasources, API keys, bundles, `publishBundle`, `setBundlePublicToAll`, `signIn`, `getApp`, `listGroupMembers`, `sceneOf`, `memberOf`, `roleOf`, `permissionIdOf`, `adminOfApiUser`, the `superAdmin` fixture, ...); 1 test is `@quarantine` (D-45 API-key delete; the bundle recycle test, D-46, is in the default run since 2026-11-26) | none, @superadmin for 1, @quarantine for 1 | 38 default + 1 `@superadmin` + 1 quarantined | | foundation/security-pages.spec.ts | the page objects `SettingPage` (settings sidebar, members rows and role selects, provider page) and `DatasourcePage` (the form's save answer) as admin, developer and plain member, and `AppViewPage.openAndAwaitQuery` (the status of the query a seeded app runs on load) | none | 4 | | foundation/security-echo.spec.ts | the echo sidecar (`scripts/echo-server.js` started on a loopback port: record and read back, per-target prefixes, control paths, body cut, canned answers, barriers) and `src/security/echo.ts` (incl. `echoUrlByIp` and that `run-in-docker.sh` passes `E2E_ECHO_IP`), `n8nDatasourceBody`, `npmRegistryPath` (no stack) | none | 21 | | foundation/security-api-raw.spec.ts | `apiRaw` against a local server: status, code, body, params, request and response headers; `executeAppQueryRaw`'s path (no stack) | none | 8 | @@ -570,26 +570,26 @@ SEC-R09d (D-38) left the quarantine: the check took the workspace of the first i | Id | What | Suite handling | |---|---|---| | D-3 | an edit made right after the editor opens can be lost; `EditorPage.open()` waits for `data-editor-ready` and `GRID_SETTLE_MS`, which narrows but does not close the race | tests that save through the editor poll the saved DSL; S1 and M3 retry once (below) | -| D-5 | a component dropped right after ready is saved with width 0 | `GRID_SETTLE_MS` in `src/constants.ts`; `editor/drop-size.spec.ts` asserts the desired width and is `@quarantine` (no annotation) | +| D-5 | a component dropped right after ready is saved with width 0 | **Fixed on this branch** (client: a component dropped while the root canvas is still unmeasured keeps its default width; run 2026-11-26, image `qfix-full-e2e` built from this branch; the unit test is `client/packages/lowcoder/src/layout/calculateUtils.test.ts`); `editor/drop-size.spec.ts` asserts the width (default run, no annotation); `GRID_SETTLE_MS` in `src/constants.ts` stays for the other editor specs and D-3 | | CD-3 | the timer's `start`/`resume` events and state do not reach bindings | `components/timer.spec.ts` asserts display text and the `pause` event only (no annotation) | | CD-5 | confirmed by code (2026-11-22 reading): the exposed `data` of `barChart` is hard-coded `func: (input) => []` (the same in 19 other charts); `barChart1.data` reads empty while the chart draws the bound data | `components/npm-components.spec.ts` (bound barChart test) asserts today's `chart=0` and carries `{type:"defect", description:"CD-5"}`; `datasource/query-feeds-components.spec.ts` asserts the binding through a text | | CD-7 | `setIn` with a bad path or on a scalar fails silently (query ends as success) | `logic/temporary-state.spec.ts` asserts today's behaviour, annotation `{type:"defect", description:"CD-7"}`, default run | | CD-8 | `transfer` list titles are in the wrong order: confirmed by code (`titles={[targetTitle, sourceTitle]}`, 2026-11-22 reading) | conditional `defect` annotation in `components/choices.spec.ts` (the annotation still says candidate) | -| CD-9 | an icon switched from a name to an image URL keeps the old icon: confirmed (failed 3 of 3 on 3.0.1-e2e; code: the old icon is cached under the new URL and `undefined === undefined` keeps it) | `components/displays.spec.ts`, `@quarantine`, `defect` annotation (still named candidate there) | +| CD-9 | an icon switched from a name to an image URL keeps the old icon: confirmed (failed 3 of 3 on 3.0.1-e2e; code: the old icon is cached under the new URL and `undefined === undefined` keeps it) | **Fixed on this branch** (client: a value that is not an icon reference is drawn as an image at once; run 2026-11-26, image `qfix-full-e2e` built from this branch; the unit test is `client/packages/lowcoder/src/comps/controls/iconControl.test.tsx`); `components/displays.spec.ts` asserts the image (default run). Known limit, pinned by the unit test: a quoted empty value `'""'` still keeps the old icon | | CD-11 candidate | a carousel's `change` event is lost when its slider list resizes while a slide is running: react-slick (`@ant-design/react-slick` 1.1.2) answers a resize 50 ms later with `resizeWindow`, which cancels the pending `afterChange` without calling it; the slide still moves. The carousel resizes its list once after every mount (it sets the slides' height from `useResizeDetector`), so a dot click in the first moments after the carousel shows can lose the event too. Measured on lowcoder-ce:asu-full-e2e: a viewport 40 px narrower right after a dot click lost `change` in 40 of 40 runs (0 of 40 with the same resize 1 s before the click); a click right after the first slide showed lost it in 17 of 80. The id is provisional until the owner assigns one | `components/media.spec.ts` (S12 carousel) waits for the slides' height and `CAROUSEL_RESIZE_SETTLE_MS` before the dot click (workaround), annotation `{type:"defect", description:"CD-11 candidate"}`; no test asserts the desired behaviour yet | | D-66 candidate | the Turso plugin prints a pipeline `error` result as `${result.error}`, an object: a failed statement reaches the app as `Cannot parse result, received error: [object Object]` and the server's own message is lost; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one | `datasource/plugin-turso-slack.spec.ts` D5d asserts today's message (characterisation, default run), annotation `{type:"defect", description:"D-66 candidate"}`; it changes when the plugin prints the message. Against the real libSQL sidecar the same text is printed for a syntax error, an unknown column, a constraint violation and a two-statement string, each of which the server answers with its own message and code (`datasource/plugin-turso-libsql.spec.ts` D13f, same annotation) | -| D-68 candidate | the DuckDB plugin answers rows keyed by the column position, not the column name (`SELECT 42 AS answer` arrives as `{"0": 42}`): `getRows()` answers arrays and `serializeBigInts` copies `Object.entries(row)`; measured on 3.0.0-e2e and 3.0.1-e2e. An app cannot read `row.answer`. The id is provisional until the owner assigns one | `datasource/plugin-duckdb.spec.ts` D4a to D4c assert today's keys (characterisation, default run), annotation `{type:"defect", description:"D-68 candidate"}`; they change when the plugin keys rows by name | -| D-67 candidate | the Shopify plugin reads the query's headers and passes `{}` on, and its data source has only `endpoint`: it cannot send Shopify's access token (`X-Shopify-Access-Token`); measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one | `datasource/plugin-graphql.spec.ts` D6d asserts today's behaviour after a control that the request did reach the echo (characterisation, default run), annotation `{type:"defect", description:"D-67 candidate"}`; it changes when the query's headers are forwarded | +| D-68 candidate | the DuckDB plugin answers rows keyed by the column position, not the column name (`SELECT 42 AS answer` arrives as `{"0": 42}`): `getRows()` answers arrays and `serializeBigInts` copies `Object.entries(row)`; measured on 3.0.0-e2e and 3.0.1-e2e. An app cannot read `row.answer`. The id is provisional until the owner assigns one **Fixed:** fixed on the node-service upgrade (image built from the `node-service-upgrades` branch, run 2026-11-26); still present on 3.0.0-e2e and 3.0.1-e2e | `datasource/plugin-duckdb.spec.ts` D4a to D4c assert rows keyed by the column names (default run). The change is intended by the owner, so it is not a defect of the upgrade; an app that read rows by position (`row["0"]`) must be changed | +| D-67 candidate | the Shopify plugin reads the query's headers and passes `{}` on, and its data source has only `endpoint`: it cannot send Shopify's access token (`X-Shopify-Access-Token`); measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one **Fixed:** fixed on the node-service upgrade (image built from the `node-service-upgrades` branch, run 2026-11-26); still present on 3.0.0-e2e and 3.0.1-e2e | `datasource/plugin-graphql.spec.ts` D6d asserts that the query's header arrives under its own name with its value, after a control that the request reached the echo and a GitLab control (default run) | | D-69 candidate | the generic Open API plugin returns the body of an error status answer as the query result (`runOpenApi` catch, `e.response.body`): a canned 404 `{"message":"e2e-missing"}` is reported as `success: true`, `queryCode: "OK"`; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one | `datasource/plugin-openapi.spec.ts` D7d asserts today's behaviour after a control that the request reached the echo (characterisation, default run), annotation `{type:"defect", description:"D-69 candidate"}`; it changes when an error status fails the query. `datasource/plugin-openapi-wrappers-apps.spec.ts` D9i shows the same for APITemplate (wrappers share `runOpenApi`). Against the real CouchDB sidecar `datasource/plugin-couchdb.spec.ts` D14c, D14d, D14e and D14j show it for the server's own 409 (stale revision), 404 (missing database or document), 412 (database exists), 401 (wrong password) and 403 (locked account) answers: each is `success: true`, `queryCode: "OK"` with the error body as the data and the status is lost; each test first shows the server's status by direct calls and has these successful controls: D14c the current revision accepted by a write and by a delete (as a query parameter and as `If-Match`); D14d an existing document read, the information of an existing database, the delete of an existing database and the create of a new one; D14e the same two queries with the right password; D14j the right password listing before the five failures, and the sidecar's own admin still working after them. Annotation `D-69 candidate` | | D-70 candidate | the WooCommerce plugin appends `wp-json/wc/v3` to a server URL unless it ends exactly in `/wc/v3`, so a server URL copied with a trailing slash (`/wp-json/wc/v3/`) is requested at `/wp-json/wc/v3/wp-json/wc/v3/products`; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one | `datasource/plugin-openapi-wrappers-data.spec.ts` D8h asserts today's behaviour (characterisation, default run), annotation `{type:"defect", description:"D-70 candidate"}`; it changes when a trailing slash is accepted | -| D-71 candidate | the UiPath plugin cannot run: `getSchemaExample` (`plugins/openApi/util.ts`) recurses without end on a circular schema of the bundled document, so the query configuration (`POST /api/datasources/getPluginDynamicConfig`, path `$.queryConfig`) answers 500 / code 5000 `get dynamic config error` (the editor lists no operation and cannot save a UiPath query) and every query fails with `Maximum call stack size exceeded` before any request is sent; the cause (`RangeError: Maximum call stack size exceeded` at `getSchemaExample`, from a circular schema) was read in the app container's node-service log while recording, not asserted: the suite asserts only the HTTP 500 / code 5000 of the configuration request, the query's failure message and that no request is sent; measured on 3.0.0-e2e and 3.0.1-e2e. Whether UiPath sends its `Authorization` header (a doubled `Bearer`, or none) cannot be measured today. The id is provisional until the owner assigns one | `datasource/plugin-openapi-wrappers-apps.spec.ts` D9j and D9k assert today's behaviour after a control that another plugin reaches the echo / lists its operations (characterisation, default run), annotation `{type:"defect", description:"D-71 candidate"}`; D9l asserts the desired behaviour (`GET /odata/Folders` with `Authorization: Bearer ` exactly), `@quarantine`, same annotation; they change when the plugin runs | -| D-72 candidate | an OpenAI data source on spec version `v1.0` (the version an empty choice selects) sends no `Authorization` header: the plugin hands the key over as `ApiKeyAuth.value`, the security scheme of the `v2.3` document, while the `v1.0` document names its scheme `ApiKey`; with `v2.3` the same key is sent as `Authorization: Bearer `; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one | `datasource/plugin-openapi-wrappers-apps.spec.ts` D9h asserts today's behaviour after a control that v2.3 sends the key to the same echo (characterisation, default run), annotation `{type:"defect", description:"D-72 candidate"}`; it changes when the key reaches the `v1.0` document's scheme | +| D-71 candidate | the UiPath plugin cannot run: `getSchemaExample` (`plugins/openApi/util.ts`) recurses without end on a circular schema of the bundled document, so the query configuration (`POST /api/datasources/getPluginDynamicConfig`, path `$.queryConfig`) answers 500 / code 5000 `get dynamic config error` (the editor lists no operation and cannot save a UiPath query) and every query fails with `Maximum call stack size exceeded` before any request is sent; the cause (`RangeError: Maximum call stack size exceeded` at `getSchemaExample`, from a circular schema) was read in the app container's node-service log while recording, not asserted: the suite asserts only the HTTP 500 / code 5000 of the configuration request, the query's failure message and that no request is sent; measured on 3.0.0-e2e and 3.0.1-e2e. Whether UiPath sends its `Authorization` header (a doubled `Bearer`, or none) cannot be measured today. The id is provisional until the owner assigns one **Fixed:** fixed on the node-service upgrade (image built from the `node-service-upgrades` branch, run 2026-11-26); still present on 3.0.0-e2e and 3.0.1-e2e | `datasource/plugin-openapi-wrappers-apps.spec.ts` D9j asserts `GET /odata/Folders` with `Authorization: Bearer ` exactly and D9k that the query configuration lists `Folders_Get`, after a control for apiTemplate (default run; the former quarantined D9l is D9j now) | +| D-72 candidate | an OpenAI data source on spec version `v1.0` (the version an empty choice selects) sends no `Authorization` header: the plugin hands the key over as `ApiKeyAuth.value`, the security scheme of the `v2.3` document, while the `v1.0` document names its scheme `ApiKey`; with `v2.3` the same key is sent as `Authorization: Bearer `; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one **Fixed:** fixed on the node-service upgrade (image built from the `node-service-upgrades` branch, run 2026-11-26); still present on 3.0.0-e2e and 3.0.1-e2e | `datasource/plugin-openapi-wrappers-apps.spec.ts` D9h asserts that the default, v1.0 and v2.3 requests all carry `Authorization: Bearer ` (default run) | | D-73 candidate | the S3 plugin checks the bucket itself only for `listObjects` (`Bucket is required`); `readFile`, `uploadData` and `deleteFile` with an empty bucket reach the AWS SDK, which refuses before any request with its own text `Empty value provided for input HTTP label: Bucket.`, so the user sees an SDK message and the checks are inconsistent; no request is sent in any of the four cases; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one | `datasource/plugin-aws-sdk.spec.ts` D10q asserts today's messages after a control that a call with a bucket reaches the echo (characterisation, default run), annotation `{type:"defect", description:"D-73 candidate"}`; it changes when the three operations check the bucket like `listObjects`. The same four messages are asserted against the S3 sidecar by `datasource/plugin-s3-server.spec.ts` D16l, next to a control that a call with a real bucket works and that nothing was stored | -| D-74 candidate | a storage error answer of the Supabase Storage plugin (any status: 400, 401 and 404 measured) fails the query with `{"size":0,"timeout":0}`, the JSON of node-fetch's `Response`, not with the API's message (`e2e-storage-error` in the canned answer): storage-js recognises an HTTP error only as an instance of the global `Response`, and node-service's proxy fetch answers with node-fetch's class; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one | `datasource/plugin-supabase-storage.spec.ts` D11n and D11o assert today's message after a control that the same query succeeds when the API answers 200 (characterisation, default run), annotation `{type:"defect", description:"D-74 candidate"}`; they change when the message of the answer reaches the user | -| D-75 candidate | the Supabase Storage plugin sends the signed-URL validity as `expiresIn: Date.now() + 5 minutes` in milliseconds (13 digits, about 1.8e12 when measured), computed once when node-service loads the plugin, where the API takes seconds: every signing request of one node-service process carries the same number; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one | `datasource/plugin-supabase-storage.spec.ts` D11f, D11k and D11m assert the magnitude (above 1e12, and within clock-skew and plugin-age allowances of now plus five minutes) and, in D11m, that two queries send the same value (characterisation, default run), annotation `{type:"defect", description:"D-75 candidate"}`; they change when the validity is 300 | -| D-76 candidate | the `search` field of the Supabase Storage listObjects query is never sent: the request body is `{limit, offset, sortBy, prefix}` whatever the field holds; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one | `datasource/plugin-supabase-storage.spec.ts` D11e asserts today's body after a positive control that the query's prefix travels (characterisation, default run), annotation `{type:"defect", description:"D-76 candidate"}`; it changes when the search text is sent | +| D-74 candidate | a storage error answer of the Supabase Storage plugin (any status: 400, 401 and 404 measured) fails the query with `{"size":0,"timeout":0}`, the JSON of node-fetch's `Response`, not with the API's message (`e2e-storage-error` in the canned answer): storage-js recognises an HTTP error only as an instance of the global `Response`, and node-service's proxy fetch answers with node-fetch's class; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one **Fixed:** fixed on the node-service upgrade (image built from the `node-service-upgrades` branch, run 2026-11-26); still present on 3.0.0-e2e and 3.0.1-e2e | `datasource/plugin-supabase-storage.spec.ts` D11n and D11o assert that the answer's message reaches the user, after a control that the same query succeeds when the API answers 200 (default run) | +| D-75 candidate | the Supabase Storage plugin sends the signed-URL validity as `expiresIn: Date.now() + 5 minutes` in milliseconds (13 digits, about 1.8e12 when measured), computed once when node-service loads the plugin, where the API takes seconds: every signing request of one node-service process carries the same number; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one **Fixed:** fixed on the node-service upgrade (image built from the `node-service-upgrades` branch, run 2026-11-26); still present on 3.0.0-e2e and 3.0.1-e2e | `datasource/plugin-supabase-storage.spec.ts` D11f, D11k and D11m assert `expiresIn` 300 and, in D11m, that two queries send the same value (default run) | +| D-76 candidate | the `search` field of the Supabase Storage listObjects query is never sent: the request body is `{limit, offset, sortBy, prefix}` whatever the field holds; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one **Fixed:** fixed on the node-service upgrade (image built from the `node-service-upgrades` branch, run 2026-11-26); still present on 3.0.0-e2e and 3.0.1-e2e | `datasource/plugin-supabase-storage.spec.ts` D11e asserts that the search text travels in the body next to the prefix (default run) | | D-77 candidate | the Supabase Storage plugin checks the bucket itself only for listObjects (`Bucket is required`); readFile, uploadData, deleteFile and createSignedUrl with an empty bucket send a request whose path has an empty bucket segment (`GET /object//x.txt`, `POST /object//x.txt`, `DELETE /object/`, `POST /object/sign//x.txt`), and the queries succeed against a server that answers; measured on 3.0.0-e2e and 3.0.1-e2e. The id is provisional until the owner assigns one | `datasource/plugin-supabase-storage.spec.ts` D11p asserts today's requests next to listObjects refusing the same empty bucket and sending nothing (characterisation, default run), annotation `{type:"defect", description:"D-77 candidate"}`; it changes when the four operations check the bucket like listObjects | -| D-78 candidate | the Firebird plugin never detaches a connection when its query fails after the attach (`firebirdsql/run.ts`: `detachAsync()` comes after the awaited query, and the unknown-parameter check also runs after the attach), so the attachment stays open on the server; a succeeding query detaches. Measured on 3.0.0-e2e and 3.0.1-e2e against the Firebird sidecar: after two failing runs of a statement that tags its attachment (`RDB$SET_CONTEXT`, then a division by zero) `MON$CONTEXT_VARIABLES` holds exactly 2 attachments with the tag, and a succeeding tagged run leaves it at 2. The id is provisional until the owner assigns one | `datasource/plugin-firebird.spec.ts` D12j, `defect` annotation `D-78 candidate`; passes today, expect it to fail once the plugin detaches in `finally` | +| D-78 candidate | **Fixed:** fixed on the node-service upgrade (run 2026-11-26); still present on 3.0.0-e2e and 3.0.1-e2e. Was: the Firebird plugin never detaches a connection when its query fails after the attach (`firebirdsql/run.ts`: `detachAsync()` comes after the awaited query, and the unknown-parameter check also runs after the attach), so the attachment stays open on the server; a succeeding query detaches. Measured on 3.0.0-e2e and 3.0.1-e2e against the Firebird sidecar: after two failing runs of a statement that tags its attachment (`RDB$SET_CONTEXT`, then a division by zero) `MON$CONTEXT_VARIABLES` holds exactly 2 attachments with the tag, and a succeeding tagged run leaves it at 2. The id is provisional until the owner assigns one | `datasource/plugin-firebird.spec.ts` D12j asserts that no tagged attachment stays open after failing and succeeding runs, after a control that the observation counts a live attachment (sidecar run) | | D-79 candidate | the Turso plugin drops a `blob` cell: the server answers it as `{type:"blob", base64}` with no `value`, `parseValue` returns `undefined` for it, and the key is missing from the row (`SELECT id, data` answers `[{id: 1}]`). Measured on 3.0.0-e2e and 3.0.1-e2e against the libSQL sidecar. The id is provisional until the owner assigns one | `datasource/plugin-turso-libsql.spec.ts` D13d, `defect` annotation `D-79 candidate`; passes today, expect it to fail once the plugin returns the bytes | | D-80 candidate | the Turso plugin parses an `integer` cell (which the server sends as a string, exact) with `Number.parseInt`, so an integer above 2^53 is rounded: `SELECT 9007199254740993` answers 9007199254740992 while `includeRaw` shows the exact string. Measured on 3.0.0-e2e and 3.0.1-e2e against the libSQL sidecar. The id is provisional until the owner assigns one | `datasource/plugin-turso-libsql.spec.ts` D13e, `defect` annotation `D-80 candidate`; passes today, expect it to fail once the plugin keeps large integers exact | | D-81 candidate | the CouchDB plugin cannot run `docGet` without an `If-None-Match` header: the bundled API document marks it required (the server treats it as optional: a read without it answers the document), and `runOpenApi` refuses the query with `Required parameter If-None-Match is not provided`; a value that is not the current ETag (`e2e-no-match` measured) reads the document, and a value equal to the document's current ETag (`""`) makes the server answer 304 with no body, which fails the query with `status: 304`. So a read of a document cannot be made without a header the user has no use for. Measured on 3.0.0-e2e and 3.0.1-e2e against the CouchDB sidecar. The id is provisional until the owner assigns one | `datasource/plugin-couchdb.spec.ts` D14f, `defect` annotation `D-81 candidate` (characterisation, passes today after controls that the server reads the document without the header and answers 304 to the current ETag); it changes when the header is optional | @@ -610,7 +610,9 @@ SEC-R09d (D-38) left the quarantine: the check took the workspace of the first i | O-16 | observation: the 3.0.0 client has no working page for a workspace's own members (`orgUsersPermission.tsx` is not routed): `/setting/permission/users` is the All Users group page with group roles, and its Remove from Group takes the user off that page but leaves the workspace membership; changing a workspace role or removing a member is API-only | `workspace/members-gui.spec.ts` LC-WM01, LC-WM03 (annotation `observation`) | | O-17 | observation: switching a workspace's e-mail sign-in off (`DELETE /api/auth/config/EMAIL` with a second provider present) answers 200 and ends the caller's session AND the instance super admin's (both answer 401 afterwards; the super admin is a member of every workspace and every worker shares its session), while an e-mail sign-in with and without the workspace id still answered 200 (measured on the image; whether the configuration was stored as disabled was not read back). A test of it would break the run, so LC-IP06 is not built; no test of the suite calls this route against the stack (LC-IP05 only reads the notice in the UI; the helper `removeAuthConfigRaw` is tested against a local server) | measured, not built | | D-45 | on the 3.0.0 image `DELETE /api/auth/api-key/{id}` of the user's last key answered 200 but the key stayed listed and kept authenticating; fixed on 3.0.1 (run 2026-11-22: SEC-A02a passes on lowcoder-ce:3.0.1-e2e and is in the default run) | `security/credentials.spec.ts` SEC-A02a (default run); the helper test in `foundation/security-helpers.spec.ts` is still `@quarantine`, annotation `D-45` (not part of the reassessment); LC-AK04 (the UI delete of the last key) is in the default run: it reloaded the page while its DELETE was still in flight, which aborted the request (a test defect, 15 of 100 runs failed on asu-full-e2e); it now waits for the row to leave the list first (0 of 40 failed) | -| D-46 | present, functional bug, cause: `BusinessEventPublisher` overload (after a successful recycle `BundleController` publishes an event through an overload that looks the bundle id up as an application and fails `NO_RESOURCE_FOUND`, answer 500 / 5005; still failing on 3.0.1-e2e, run 2026-11-22) | `security/bundles.spec.ts` SEC-R17f and the helper test, `@quarantine`, annotation `D-46`; `recycleBundle` tolerates exactly this answer | +| D-46 | **Fixed on this branch** (run 2026-11-26, image `qfix-full-e2e` built from this branch): the recycle now publishes its event from the stored bundle, so it answers success after writing the status; before, `BundleController` published the event through an overload that looked the bundle id up as an application and failed `NO_RESOURCE_FOUND`, answer 500 / 5005, still failing on 3.0.1-e2e | `security/bundles.spec.ts` SEC-R17f and the helper test in `foundation/security-helpers.spec.ts` assert success (default run); `recycleBundle` still tolerates the old answer so the suite works on older images | +| D-46 restore | a bundle restore published its event through the same application lookup, so it answered 500 / 5005 after writing the status (measured on `nsu-full-e2e`, 2026-11-27: `Expected 200 / 1, received 500 / 5005`). **Fixed on this branch** (image `qfix-full-e2e`, 10 of 10): the restore publishes its event from the stored bundle, like the recycle | `security/bundles.spec.ts` SEC-R17h (default run) | +| D-90 | a sign-up or sign-in through an invitation link answered 400 / 5202 `ALREADY_IN_ORGANIZATION` although it joined the workspace, and an invitation whose creator had left the workspace still admitted the visitor: `loginOrRegister` joined the workspace the page names before it redeemed the invitation, so the invitation found a member and its own rules never ran (measured on `nsu-full-e2e` and `qfix-full-e2e` before the change, 2026-11-27: LC-AU18a and b received 400 / 5202 while their controls passed, LC-AU18c found the visitor a member). **Fixed on this branch** (image `qfix-full-e2e`, LC-AU18a to c and every control 10 of 10): the invitation is redeemed first. The UI path (LC-AU08) always passed because the client treats 5202 as a notice and reloads | LC-AU18a, LC-AU18b, LC-AU18c | ## Security findings @@ -629,7 +631,7 @@ and passes. | D-10 | viewers, and anonymous visitors of public apps, run unpublished (draft) queries | fixed on this branch (Java unit tests green 2026-11-23; Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)); in another app's editor a module's queries run its published version; residual: an app or module that was never published has its draft as its live version, so READ on it runs that draft | SEC-A09c, R19a+ to R19e | | D-11 | a plain member creates apps or data sources in a workspace when it is a developer in its current workspace | fixed on this branch (Java unit tests green 2026-11-24; Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)); app, bundle (D-41) and data source creation now check the developer role in the TARGET workspace (the request's `orgId`), not the visitor's current one | SEC-R06c, R06e | | D-12 | anonymous callers resolve names of apps, users, workspaces and more by id (`POST /api/meta/`) | fixed on this branch (Java unit test green 2026-11-23; Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)); residual: any signed-in user still resolves the names, and for users the e-mail addresses, of any id in any workspace (D-12) | SEC-A10a | -| D-13 | anonymous callers list the workspaces of any e-mail address (`GET /api/organizations/byuser/{email}`) | open | SEC-A10b | +| D-13 | anonymous callers list the workspaces of any e-mail address (`GET /api/organizations/byuser/{email}`) | by design (owner decision 2026-11-26: the sign-in and sign-up pages need it to offer the login variants of a workspace). Minimised on this branch: per workspace the answer carries its id and name only (it also carried `createdAt` and `updatedAt`, which no page reads), inside the shared paged envelope (`code`, `message`, `success`, `pageNum`, `pageSize`, `total`; `total` counts the listed workspaces: the address's own in the default mode, the one enterprise workspace for any address in ENTERPRISE mode); pinned by SEC-A10b (10 of 10 on `qfix-full-e2e`; on `nsu-full-e2e`, before the change, it failed on exactly `createdAt` and `updatedAt`). Accepted residuals: the answer tells whether an address has an account (SAAS mode; the "User not found" step needs it), and a default workspace is named after its creator, so `orgName` can show the creator's address | SEC-A10b | | D-14 | the workspace answer carries the auth configs' client secret | fixed on this branch (Java unit tests green: `OrganizationJsonTest`, `OrganizationEndpointsContractTest`, `UserEndpointsContractTest`, `ApplicationEndpointsContractTest`, `AuthenticationEndpointsContractTest`; `Organization#getAuthConfigs` is `@JsonIgnore`, so no answer that holds an `Organization` writes the auth configs; Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)); residual: the workspace answer (`GET /api/organizations/{id}`) and the app home page (`GET /api/applications/home`) still give every member the workspace's full common settings, the npm registry credential and the password-reset template included (the profile drops those two) | SEC-R07d, SEC-R07e | | D-15 | API keys are signed with a published default secret; a forged token is refused only because it must equal a stored key | open, defended (pin) | SEC-A01a | | D-16 | any signed-in user writes deployment-wide server config | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run) | SEC-R08c (positive half SEC-R16b) | @@ -642,11 +644,11 @@ and passes. | D-23 | a workspace admin grants `super_admin` or changes a super admin's role | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run) | SEC-A06b, R16c | | D-24 | an admin removes a super admin or the last admin | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run) | SEC-R08d, R16d | | D-25 | app views, the anonymous view of a public app included, carry the workspace's password-reset mail template | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run); partial: fixed for the password-reset template only, `sanitized()` still leaves the workspace's `npmRegistries` setting with its credentials in the published view that an anonymous visitor of a public app receives (code read, N-1) | SEC-A09a | -| D-26 | an app's creator who left the workspace, and any user on a template app, open the editing view | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run); fixed for editing, a creator outside the workspace keeps READ through the creator-shortcut VIEWER row (`createdBy`), a separate, unrevoked mechanism from the member-leave clean-up's stored-row deletion (D-60 residual, LC-DL13 quarantined candidate, an open scope question for the owner) | SEC-R11b | +| D-26 | an app's creator who left the workspace, and any user on a template app, open the editing view | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run); fixed for editing; a creator outside the workspace keeps READ through the creator-shortcut VIEWER row (`createdBy`), by design (owner decision 2026-11-26: it marks the ownership of an object and cannot be transferred or changed); LC-DL13 pins it, SEC-R11b pins the editing denial | SEC-R11b | | D-27 | the session cookie is forwarded to JS datasource queries | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run) | SEC-X02b | | D-28 | any signed-in user sets any workspace's slug and reads any workspace | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run) | SEC-C16b, C16c | | D-29 | any signed-in user reads any datasource's structure and makes it connect | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run); fixed for the structure read, the sibling `GET /api/datasources/info` has no check (code read, N-2) | SEC-C13 | -| D-30 | signing in with `?orgId=` joins that workspace without an invitation (may be intended for the per-workspace sign-in page; needs an owner decision) | present, by design upstream (`tryAddUserToOrgAndSwitchOrg` has no condition and the admin page publishes the per-workspace sign-in URL; what is missing is an admin opt-in), severity medium | SEC-C17c | +| D-30 | signing in or up through a workspace's own page (`?orgId=`) joins that workspace as a plain member without an invitation and switches to it | by design (owner decision 2026-11-26: the join through a workspace's sign-in/up page is intended; the admin page publishes that URL); pinned by SEC-C17c (API and UI) and LC-AU15, verified 10 of 10 on `qfix-full-e2e` | SEC-C17c, LC-AU15 | | D-31 | an editor of any app reads any history snapshot by id | fixed on this branch (Java unit tests green: `ApplicationHistorySnapshotServiceImplTest`, `ApplicationHistorySnapshotEndpointsTest`, `ApplicationHistorySnapshotEndpointsContractTest`, `PayloadContractCompletenessTest`; both DSL routes now resolve the path key once with `findByIdWithoutDsl`, check EDIT on the resolved object id, and serve a snapshot only when its stored `applicationId` equals that object id and either it carries the `applicationIdResolved` marker the create route now writes, or, for a snapshot stored before this fix, the path's application was created strictly before the snapshot; Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)); residual: a snapshot's DSL may name modules of any workspace and both snapshot routes answer those modules' live DSL (code read, not run); residual: a snapshot saved before this fix through a slug set to exactly another app's id while a lookup still asked for the slug first (same workspace or a different one) is still served through that other app, if that other app was created strictly before the snapshot (code read, not run); residual: the creation-order check compares server wall-clock timestamps, not a monotonic order, so clock skew between nodes could still admit a colliding app's snapshot even outside the slug-first case above; changed: a new snapshot is stored under the app's id even when created through its gid or slug, and listed through that id; a snapshot saved before this fix under an app's gid or slug instead of its id (only a workspace admin can save one, through the API) is still listed through that key but no longer served; one saved before this fix under the app's id is served only when the app was created strictly before the snapshot (both creation times present) | SEC-C21 | | D-32 | any workspace member reads the full live DSL of any of its apps | fixed on this branch (Java unit tests green: `ApplicationRecordApiServiceImplTest`; the app record route, live or a named version, now needs `EDIT_APPLICATIONS` on the record's own application, checked after the workspace match; an empty visitor id is refused; Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)); not changed: the version list still needs only workspace membership (D-21 residual) and the version delete only the developer role and the workspace | SEC-R01d, SEC-R01e, SEC-R01f+, SEC-R01g+ | | D-33 | credentialed CORS from any origin with CSRF protection off (default allowed origins `*`) | CORS-credentials half fixed on this branch (run 2026-11-23: `SecurityConfig` grants credentials only to an origin listed in a non-wildcard `LOWCODER_CORS_DOMAINS` entry; SEC-A12 passes and is in the default run; four new Java tests cover the wildcard-only, single-listed-origin, wildcard-sub-pattern and mixed-configuration cases); CSRF and `SameSite=None` on HTTPS remain open, so a cross-site SIMPLE request (a plain HTML form submit, which needs no credential grant) still reaches a route shaped to accept one, e.g. `POST /api/users/password?password=...` | SEC-A12, SEC-A13 (pin) | @@ -662,7 +664,7 @@ and passes. | D-43 | any signed-in user lists any bundle's elements, each app's editing DSL included | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run) | SEC-C23a | | D-44 | an app's owner adds or moves it into any bundle of any workspace | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run) | SEC-C23c | | D-45 | deleting a user's last API key answered 200 but the key stayed listed and kept authenticating (measured on the 3.0.0 image) | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run); LC-AK04 (UI delete) is in the default run (its intermittent failure was the test reloading during the delete) | SEC-A02a, LC-AK04 and the helper test in `foundation/security-helpers.spec.ts` | -| D-46 | recycling a bundle sets the status and then answers 500 / 5005 (measured on the image) | present, functional bug, cause: `BusinessEventPublisher` overload (500 / 5005 after a successful recycle, still failing on 3.0.1-e2e; restore should fail the same way, not run); not a security finding | SEC-R17f and the helper test; `recycleBundle` tolerates exactly this answer | +| D-46 | recycling a bundle set the status and then answered 500 / 5005 (measured on the 3.0.x images) | **Fixed on this branch** (run 2026-11-26, image `qfix-full-e2e` built from this branch): the recycle publishes its event from the stored bundle; not a security finding; the restore of a bundle had the same defect and got the same fix ("D-46 restore") | SEC-R17f and the helper test; `recycleBundle` tolerates the old answer | | D-47 | the instance super admin's requests hang (HTTP 504) once the stack holds more than about 420 workspaces (measured on the 3.0.0 image: 400 ok in about 100 ms, 450 and more 504 after about 120 s; cause not found) | fixed in code, not re-measured (cause found: `getCurrentOrgMember` filtered a cached membership list whose condition collected the same list; reactor-core stalls above 448 memberships, a Java probe reproduces it; HEAD collects first; a 450-workspace run against the image was not done; the same pattern remains in the workspace data source list and the library query list); SEC-R16a to R16d pass | SEC-R16a to R16d, tagged `@superadmin` | | D-48 | the server enforces no password rule on sign-up (the rule, at least 8 characters with a letter and a digit, is checked in the client only): a sign-up with the password `a` answers 200 and opens a session, and so does `PUT /api/users/password` with the new password `a` (measured on the image; the same code at HEAD, not run) | fixed on this branch (Java unit tests green: `PasswordRuleTest`, `FormAuthRequestTest`, `UserEndpointsContractTest`, `UserCreateInOrgPasswordRuleTest` against real MongoDB; a password a user chooses on sign-up, an admin's create-user route, a password change, a lost-password reset or a first password that breaks the client's rule is refused with `INVALID_PASSWORD` 403 / 5608 before anything is stored or a session opened; Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)); residual: existing weak passwords keep working (no forced rotation); the super admin password from the environment and server-generated passwords are exempt | LC-AU07, LC-PR14, LC-AU17, LC-PW16, LC-IP17 | | D-49 | `POST /api/users/password?password=` sets a password with no old password for a user who already has one (the route of the "Set Password" card); any session, a stolen one included, replaces the password and takes the account (measured on the image; HEAD the same by code, not run) | fixed on this branch (Java unit tests green: `UserServiceImplPasswordTest`, `UserEndpointsContractTest`, the new `UserSetPasswordIfAbsentMongoTest` against real MongoDB; the route answers `INVALID_PASSWORD` 403 / 5608 for an account that already has a password, decided and written in one conditional MongoDB update that is race-proof under concurrent requests; Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`)); residual: the route still accepts a cross-site form post for an account WITHOUT a password (CSRF open, D-33 row) | LC-PR13 | @@ -676,10 +678,11 @@ and passes. | D-57 | an account in no workspace gets no reset mail while the forgot page still confirms (measured on the image: a member removed from its only workspace gets none) | fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run) | LC-PW10 (default run) | | D-58 | a reset request for a display name that is not an address mails that user's token to the typed text: whoever can rename a user sets the victim's name to an address of its own and receives the victim's token | fixed on this branch (run 2026-11-23 on an image rebuilt from this branch's working tree: LC-PW11 passes and is in the default run) | LC-PW11 | | D-59 | a removed developer's data source grant is not deleted: 20 s after the removal the "Can Use" row of the data source was still there, while the group and app rows were gone within 40 ms (measured on the image; HEAD not run) | fixed on this branch: `removeUserDatasourcePermission` now deletes `ResourceType.DATASOURCE` rows instead of `ResourceType.APPLICATION` (copy-paste bug); Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`): LC-DL03 confirmed passing in the default run; low-medium | LC-DL03 | -| D-60 | a removed member's folder grant is not deleted and is live again after a rejoin: the removal listener has no folder step, and the row was still there after the removal and after the rejoin (measured on the image; HEAD listener read: no folder or bundle step) | fixed on this branch: the member-leave clean-up gained a folder and a bundle step (`OrgAndGroupEventListener.onUserLeaveOrg`); Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`): LC-DL04 and LC-DL12 confirmed passing in the default run. Residuals: rows left by removals before the fix stay stored (not a target of this fix; needs an operator audit or a migration); the creator (`createdBy`) access to apps, bundles and folders is a separate, unrevoked mechanism: a removed creator still reads its apps and bundles, and a rejoined creator manages its folders again (LC-DL13 to LC-DL15, quarantined candidates; D-26 residual; an open scope question for the owner) | LC-DL04, LC-DL12 | +| D-60 | a removed member's folder grant is not deleted and is live again after a rejoin: the removal listener has no folder step, and the row was still there after the removal and after the rejoin (measured on the image; HEAD listener read: no folder or bundle step) | fixed on this branch: the member-leave clean-up gained a folder and a bundle step (`OrgAndGroupEventListener.onUserLeaveOrg`); Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`): LC-DL04 and LC-DL12 confirmed passing in the default run. Residuals: rows left by removals before the fix stay stored (not a target of this fix; needs an operator audit or a migration); the creator (`createdBy`) access to apps, bundles and folders stays by design (owner decision 2026-11-26): a removed creator still reads its apps and bundles, and a rejoined creator manages its folders again (pinned by LC-DL13 to LC-DL15, verified 10 of 10 on `nsu-full-e2e`; whether the right should include editing is an open, non-blocking question) | LC-DL04, LC-DL12 | | D-61 | a second sign-in configuration of a provider type that already has one is accepted: a second GitHub configuration with another client id answers 200 and the workspace lists two (the server code names the refusal 400 / 5621 `DUPLICATE_AUTH_CONFIG_ADDITION`; measured on the image, HEAD not run) | partly fixed on 3.0.1 (run 2026-11-22: the test passes on lowcoder-ce:3.0.1-e2e; the test is in the default run); the block applies only to a request without an `id`, a request with a made-up `id` should still add a second config (code only, not run); the e2e test sends no `id` | LC-IP07 (default run) | | D-62 | a provider sign-in whose e-mail claim equals an existing account's address signs in AS that account: the server resolved the provider identity by address, so whoever configures a provider for a workspace could make its user-info answer name any address and receive that user's session, including users of other workspaces | fixed on this branch (run 2026-11-23 on an image rebuilt from this branch's working tree: LC-IP14 passes and is in the default run) | LC-IP14 | | D-63 | the "Info" card "Your Created Apps" of the profile page counts 0 although the user created two apps (`createBy` of the list equals the user's name and the app list shows them; the page filters the redux app list, `UserProfileLayout.tsx`; root cause NOT VERIFIED); measured on the image, HEAD not run | fixed on this branch: `UserProfileLayout` now fetches the app list on mount and whenever the workspace changes (`dispatch(fetchAllApplications({}))`), instead of relying on another component's lazy fetch, which is never mounted on this page; Docker/e2e confirmed in the combined run (2026-11-24, image `secfix-combined-e2e`): LC-OT02 confirmed passing in the default run; not a security finding (display bug); residual (an open scope question for the owner): the counts still compare the creator's display NAME (`createBy`), not user id, so same-name users are counted together and an app whose creator no longer exists counts as shared | LC-OT02 | +| D-90 | an invitation of a member who has left the workspace still admits a visitor through the sign-up or sign-in page: the page names the workspace, the login joins it first, and the invitation's validity rule (its creator is a member, `InvitationApiServiceImpl.tryJoinOrg`) runs after the join and is bypassed (the same join as D-30, which is by design) | **Fixed on this branch** (image `qfix-full-e2e`): the invitation is redeemed before the login joins; the visitor of a refused invitation gets an account and no workspace | LC-AU18c | Quarantine decision rule: a test that asserts the DESIRED behaviour and fails today is `@quarantine`. A characterisation or workaround test that passes while documenting a defect (CD-5, CD-7, CD-3 limits, D-3 handling) is not. diff --git a/e2e/src/api/client.ts b/e2e/src/api/client.ts index 8298508d45..515a86a0e5 100644 --- a/e2e/src/api/client.ts +++ b/e2e/src/api/client.ts @@ -136,22 +136,37 @@ export async function registerUser(request: APIRequestContext, email: string): P /** * The form sign-up of `registerUser` as a raw answer (no unwrap), for the call under test: the answer of a refused - * sign-up is the subject. The request context keeps the session cookie when the sign-up works. `invitation` adds the two + * sign-up is the subject. The request context keeps the session cookie when the sign-up works. `invitation` adds the * query parameters `invitationId` and `orgId` the register page sends when the visitor came through an invitation link - * (`UserApi.formLogin` in `client/packages/lowcoder/src/api/userApi.ts`; the server reads them with `@RequestParam`). + * (`UserApi.formLogin` in `client/packages/lowcoder/src/api/userApi.ts`; the server reads them with `@RequestParam`). A + * missing `orgId` is not sent: the invitation then names the workspace alone. */ export async function registerRaw( request: APIRequestContext, email: string, password: string, - invitation?: { invitationId: string; orgId: string }, + invitation?: InvitationParams, ): Promise { return apiRaw(request, "POST", API_PATHS.LOGIN, { data: { loginId: email, password, register: true, source: AUTH_SOURCE_EMAIL, authId: AUTH_ID_EMAIL }, - params: invitation, + params: invitationQuery(invitation), }); } +/** The invitation parameters of a form sign-up or sign-in: the code, and the workspace the page names (`orgId`) when it sends one. */ +export interface InvitationParams { + invitationId: string; + orgId?: string; +} + +/** The query parameters of `invitation`, without the absent keys (an `undefined` value would not be a missing parameter). */ +function invitationQuery(invitation?: InvitationParams): Record | undefined { + if (!invitation) { + return undefined; + } + return invitation.orgId === undefined ? { invitationId: invitation.invitationId } : { invitationId: invitation.invitationId, orgId: invitation.orgId }; +} + /** * Marks the new-user tour as done. Otherwise the tour (react-joyride) opens on the first visit of the app list * and its overlay intercepts clicks. The tests that are about the tour itself do not exist yet. @@ -870,11 +885,18 @@ export async function signIn(request: APIRequestContext, email: string, password /** * The form sign-in of `signIn` as a raw answer (no unwrap, no throw on a refusal), for a test that measures the answer - * or reads its headers. Like `signIn`, the password never reaches a label or message. + * or reads its headers. Like `signIn`, the password never reaches a label or message. `invitation` is what the sign-in + * page sends when the visitor came through an invitation link (see `registerRaw`). */ -export async function signInRaw(request: APIRequestContext, email: string, password: string = TEST_PASSWORD): Promise { +export async function signInRaw( + request: APIRequestContext, + email: string, + password: string = TEST_PASSWORD, + invitation?: InvitationParams, +): Promise { return apiRaw(request, "POST", API_PATHS.LOGIN, { data: { loginId: email, password, register: false, source: AUTH_SOURCE_EMAIL, authId: AUTH_ID_EMAIL }, + params: invitationQuery(invitation), }); } diff --git a/e2e/src/constants.ts b/e2e/src/constants.ts index bb3ad1f7fa..fc550e511d 100644 --- a/e2e/src/constants.ts +++ b/e2e/src/constants.ts @@ -519,6 +519,8 @@ export const API_ERRORS = { CANNOT_DELETE_SYSTEM_GROUP: { status: 500, code: 5154 }, // :42 NEED_DEV_TO_CREATE_RESOURCE: { status: 500, code: 5155 }, // :44 INVALID_INVITATION_CODE: { status: 400, code: 5200 }, // :47 + /** An invitation redeemed by a visitor who is a member of its workspace already (`BizError.java`). */ + ALREADY_IN_ORGANIZATION: { status: 400, code: 5202 }, // :49 QUERY_NOT_FOUND: { status: 500, code: 5300 }, // :55 ILLEGAL_APPLICATION_PERMISSION_ID: { status: 500, code: 5302 }, // :57 NO_PERMISSION_TO_VIEW: { status: 403, code: 5304 }, // :59 @@ -598,6 +600,10 @@ export function bundleRecyclePath(bundleId: string): string { return `${API_PATHS.BUNDLES}/recycle/${bundleId}`; } +export function bundleRestorePath(bundleId: string): string { + return `${API_PATHS.BUNDLES}/restore/${bundleId}`; +} + export function bundleViewPath(bundleId: string): string { return `${bundlePath(bundleId)}/view`; } diff --git a/e2e/src/datasource/node-plugins.ts b/e2e/src/datasource/node-plugins.ts index 7a851dc3bf..bc5fe64e65 100644 --- a/e2e/src/datasource/node-plugins.ts +++ b/e2e/src/datasource/node-plugins.ts @@ -2,7 +2,7 @@ import type { DatasourceTypeEntry } from "../api/client"; /** * The ids of the node plugins the node-service registry serves, as the registry lists them - * (`server/node-service/src/plugins/index.ts:50-126`, 46 entries). Note the ids that differ from their folder names: + * (`server/node-service/src/plugins/index.ts:48-122`, 45 entries). Note the ids that differ from their folder names: * `OpenAI` (`openAi/index.ts`), `oss` (`aliyunOss/index.ts`) and `firebird` (`firebirdsql/index.ts:10`). The `graphql` type * is a Java-native type (`DatasourceMetaInfoServiceImpl.java:142-146`); node-service's `graphql/` folder is a helper and * is not registered. This is the set the catalogue test measures against the image; never edit it to make that test pass. @@ -12,7 +12,6 @@ export const NODE_PLUGIN_IDS: readonly string[] = [ "dynamodb", "couchdb", "duckdb", - "fauna", "turso", "firebird", // Big Data diff --git a/e2e/src/security/quarantine.ts b/e2e/src/security/quarantine.ts index 60cfa65574..2287ad610f 100644 --- a/e2e/src/security/quarantine.ts +++ b/e2e/src/security/quarantine.ts @@ -76,8 +76,8 @@ export const FIXED_ON_BRANCH: Readonly> = {}; * map: the member-leave clean-up now deletes the data source row by the right resource type and gained a folder and a * bundle step, so LC-DL03 and LC-DL04 are no longer quarantined (LC-DL12 is new and was never quarantined; Docker/e2e * confirmation deferred to the combined final run, NOT VERIFIED yet); rows left by removals before the fix stay - * stored, and a creator's `createdBy` access is a separate, unrevoked mechanism (README D-26 and D-60 residuals, - * LC-DL13 to LC-DL15 candidates). D-52 left this map: `GroupApiServiceImpl.update` now refuses a non-null `groupName` + * stored, and a creator's `createdBy` access is a separate mechanism that stays by design (owner decision 2026-11-26: it + * marks the ownership of an object and cannot be transferred or changed; LC-DL13 to LC-DL15 pin it). D-52 left this map: `GroupApiServiceImpl.update` now refuses a non-null `groupName` * on a system group (any of its three encodings) with UNSUPPORTED_OPERATION and writes nothing, so LC-GR09 is no * longer quarantined (Docker/e2e confirmation deferred to the combined final run, NOT VERIFIED yet); groups renamed * before the fix keep their stored name, never shown (`Group.getName`). D-54 left this map: the password-reset and @@ -87,15 +87,16 @@ export const FIXED_ON_BRANCH: Readonly> = {}; * dialog's success notice now uses the key readers of every other notice in the file use (`memberSettings.*`, not * `membersSettings.*`), so LC-PW15 is no longer quarantined (Docker/e2e confirmation deferred to the combined final * run, NOT VERIFIED yet). D-63 also left this map: the profile now fetches the app list it counts, so LC-OT02 passes - * (Docker/e2e confirmation deferred to the combined final run, NOT VERIFIED yet). LC-AU15 - * (`tests/auth/signup-edge.spec.ts`) is a lifecycle id. + * (Docker/e2e confirmation deferred to the combined final run, NOT VERIFIED yet). D-46 left this map: a bundle's + * recycle now publishes its event from the stored bundle instead of looking the bundle id up as an application, so + * SEC-R17f is no longer quarantined (a bundle restore got the same fix). D-30 left this map by the owner's decision + * (2026-11-26) that the join is intended: anyone who knows a workspace's id becomes its member by signing in or signing up on + * that workspace's own page, so SEC-C17c and LC-AU15 now pin it. D-13 left this map by the owner's decision (2026-11-26) + * that the anonymous e-mail to workspaces lookup stays, because the sign-in and sign-up pages need it to offer the login + * variants of a workspace: the answer now carries only the id and the name of each workspace, and SEC-A10b pins that. + * Both maps are empty. */ -export const OPEN_DEFECTS: Readonly> = { - "SEC-C17c": "D-30", - "SEC-R17f": "D-46", - "SEC-A10b": "D-13", - "LC-AU15": "D-30", -}; +export const OPEN_DEFECTS: Readonly> = {}; /** What a security test passes to `test(title, details, body)`: the `tag` and, for a quarantined test, the annotation. */ export interface SecurityTestDetails { @@ -108,51 +109,71 @@ export function quarantinedDefect(id: string): string | undefined { return FIXED_ON_BRANCH[id] ?? OPEN_DEFECTS[id]; } -/** - * The details of a security test. Every security test passes `securityTestDetails("")`. - * - id in `FIXED_ON_BRANCH` or `OPEN_DEFECTS`: tags `@security` and `@quarantine` (out of the default run, in with - * `E2E_INCLUDE_QUARANTINE`, see src/run-selection.ts) and annotation `{ type: "defect", description: "D-n" }`. - * - any other id: tag `@security` only, no annotation. - * `extraTags` are appended after them (the P0 set passes `[TAGS.CORE]`). - * Throws on an id that is not a scenario id, so a typo cannot silently leave a test out of its quarantine entry. - */ -export function securityTestDetails(id: string, extraTags: readonly string[] = []): SecurityTestDetails { - if (!SECURITY_ID_PATTERN.test(id)) { - throw new Error(`"${id}" is not a security scenario id (pattern ${SECURITY_ID_PATTERN})`); - } - const defect = quarantinedDefect(id); - if (defect === undefined) { - return { tag: [TAGS.SECURITY, ...extraTags] }; - } - return { - tag: [TAGS.SECURITY, TAGS.QUARANTINE, ...extraTags], - annotation: { type: DEFECT_ANNOTATION_TYPE, description: defect }, - }; +/** The two detail functions of the security tests, bound to one scenario-id-to-defect lookup. */ +export interface SecurityDetails { + testDetails(id: string, extraTags?: readonly string[]): SecurityTestDetails; + candidateDetails(id: string, measured: string, extraTags?: readonly string[]): SecurityTestDetails; } /** - * The details of a security test that failed on the image under test for a real server behaviour nobody expected and that - * no defect-list entry names yet (`e2e/AGENTS.md` section 7: " candidate"). Quarantined like a listed id, the annotation - * description names the scenario and what was measured. A candidate leaves this form by getting a D id in - * `FIXED_ON_BRANCH` or `OPEN_DEFECTS` and `securityTestDetails`. Throws on an id that is not a scenario id or that is already - * in a map (use `securityTestDetails` then), and on an empty measurement. + * The detail functions of the security tests (`SEC-` ids, base tag `@security`). `defectOf` is the lookup from scenario id + * to defect id; the default is `quarantinedDefect`, so the two maps stay the single source of the quarantine. + * - `testDetails`: an id the lookup lists gets the tags `@security` and `@quarantine` (out of the default run, in with + * `E2E_INCLUDE_QUARANTINE`, see src/run-selection.ts) and the annotation `{ type: "defect", description: "D-n" }`; any + * other id gets `@security` only and no annotation. `extraTags` are appended after them (the P0 set passes `[TAGS.CORE]`). + * Throws on an id that is not a scenario id, so a typo cannot silently leave a test out of its quarantine entry. + * - `candidateDetails`: for a security test that failed on the image under test for a real server behaviour nobody expected + * and that no defect-list entry names yet (`e2e/AGENTS.md` section 7: " candidate"). Quarantined like a listed id, + * the annotation description names the scenario and what was measured. A candidate leaves this form by getting a D id in + * `FIXED_ON_BRANCH` or `OPEN_DEFECTS` and `securityTestDetails`. Throws on an id that is not a scenario id or that the + * lookup lists (use `testDetails` then), and on an empty measurement. + * + * Limits: a security test that fails on the image and is in neither map fails the default run; a stale entry hides a passing + * test. A lookup passed by a caller is not checked against the maps: it exists for the unit test only (both maps may be + * empty, so no listed id is left to test with), production code uses `securityTestDetails` and `securityCandidateDetails`. */ -export function securityCandidateDetails(id: string, measured: string, extraTags: readonly string[] = []): SecurityTestDetails { - if (!SECURITY_ID_PATTERN.test(id)) { - throw new Error(`"${id}" is not a security scenario id (pattern ${SECURITY_ID_PATTERN})`); - } - if (quarantinedDefect(id) !== undefined) { - throw new Error(`${id} is in a quarantine map; use securityTestDetails`); - } - if (measured.trim() === "") { - throw new Error(`${id}: a candidate names what was measured`); - } +export function securityDetailsFor(defectOf: (id: string) => string | undefined = quarantinedDefect): SecurityDetails { + const refuseBadId = (id: string): void => { + if (!SECURITY_ID_PATTERN.test(id)) { + throw new Error(`"${id}" is not a security scenario id (pattern ${SECURITY_ID_PATTERN})`); + } + }; return { - tag: [TAGS.SECURITY, TAGS.QUARANTINE, ...extraTags], - annotation: { type: DEFECT_ANNOTATION_TYPE, description: `${id} candidate: ${measured}` }, + testDetails(id, extraTags = []) { + refuseBadId(id); + const defect = defectOf(id); + if (defect === undefined) { + return { tag: [TAGS.SECURITY, ...extraTags] }; + } + return { + tag: [TAGS.SECURITY, TAGS.QUARANTINE, ...extraTags], + annotation: { type: DEFECT_ANNOTATION_TYPE, description: defect }, + }; + }, + candidateDetails(id, measured, extraTags = []) { + refuseBadId(id); + if (defectOf(id) !== undefined) { + throw new Error(`${id} is in a quarantine map; use securityTestDetails`); + } + if (measured.trim() === "") { + throw new Error(`${id}: a candidate names what was measured`); + } + return { + tag: [TAGS.SECURITY, TAGS.QUARANTINE, ...extraTags], + annotation: { type: DEFECT_ANNOTATION_TYPE, description: `${id} candidate: ${measured}` }, + }; + }, }; } +const securityDetails = securityDetailsFor(); + +/** The details of a security test: `test(title, securityTestDetails("SEC-C01a"), body)`. */ +export const securityTestDetails = securityDetails.testDetails; + +/** The details of a security test that failed on the image for a behaviour no defect-list entry names yet (" candidate"). */ +export const securityCandidateDetails = securityDetails.candidateDetails; + /** The two detail functions of the lifecycle tests, bound to one scenario-id-to-defect lookup. */ export interface LifecycleDetails { testDetails(id: string, extraTags?: readonly string[]): SecurityTestDetails; diff --git a/e2e/tests/auth/signup-edge.spec.ts b/e2e/tests/auth/signup-edge.spec.ts index e8621339e4..43a05b271f 100644 --- a/e2e/tests/auth/signup-edge.spec.ts +++ b/e2e/tests/auth/signup-edge.spec.ts @@ -3,7 +3,9 @@ import { createInvitation, currentUser, currentUserId, + listOrgMembers, registerRaw, + removeOrgMember, signIn, signInRaw, } from "../../src/api/client"; @@ -11,6 +13,7 @@ import { API_ERRORS, API_OK, API_PATHS, createUserInOrgPath, PASSWORD_TOO_WEAK_M import { expect, test, uniqueEmail } from "../../src/fixtures"; import { AuthPage, PASSWORD_RULE_TEXT } from "../../src/pages/AuthPage"; import { expectAnswer } from "../../src/security/assertions"; +import { joinWorkspace } from "../../src/security/actors"; import { lifecycleTestDetails } from "../../src/security/quarantine"; /** @@ -161,8 +164,63 @@ test.describe("lifecycle: sign-up edge cases", () => { ).toEqual([{ orgId: inviter.orgId, role: "member" }]); }); + test("LC-AU18a a sign-up through an invitation answers success and joins only the invited workspace", lifecycleTestDetails("LC-AU18a"), async ({ actor, newUserSession }, testInfo) => { + const inviter = await actor("invsignup"); + const code = await createInvitation(inviter.request, inviter.orgId); + const control = await registerRaw((await newUserSession()).page.request, uniqueEmail("invcontrol", testInfo.workerIndex), TEST_PASSWORD, { invitationId: code }); + expectAnswer(control, ALLOWED, "control: a sign-up with the invitation alone (no workspace named)"); + const address = uniqueEmail("invsubject", testInfo.workerIndex); + + const answer = await registerRaw((await newUserSession()).page.request, address, TEST_PASSWORD, { invitationId: code, orgId: inviter.orgId }); + + expectAnswer(answer, ALLOWED, "the sign-up the invitation page sends (the invitation and the workspace it names)"); + const check = (await newUserSession()).page.request; + expectAnswer(await signInRaw(check, address), ALLOWED, "the new account signs in"); + expect( + (await currentUser(check)).orgAndRoles.map((entry) => ({ orgId: entry.org.id, role: entry.role })), + "it belongs to the inviting workspace only, as a member", + ).toEqual([{ orgId: inviter.orgId, role: "member" }]); + }); + + test("LC-AU18b a sign-in of an existing account through an invitation answers success and joins the invited workspace", lifecycleTestDetails("LC-AU18b"), async ({ actor, newUserSession }) => { + const inviter = await actor("invsignin"); + const guest = await actor("invguest"); + const code = await createInvitation(inviter.request, inviter.orgId); + const control = await signInRaw((await newUserSession()).page.request, guest.email, TEST_PASSWORD, { invitationId: code }); + expectAnswer(control, ALLOWED, "control: a sign-in with the invitation alone (no workspace named)"); + const second = await createInvitation(inviter.request, inviter.orgId); + const other = await actor("invguest2"); + + const answer = await signInRaw((await newUserSession()).page.request, other.email, TEST_PASSWORD, { invitationId: second, orgId: inviter.orgId }); + + expectAnswer(answer, ALLOWED, "the sign-in the invitation page sends (the invitation and the workspace it names)"); + const check = (await newUserSession()).page.request; + await signIn(check, other.email); + expect((await currentUser(check)).orgAndRoles.map((entry) => entry.org.id), "the account belongs to both workspaces").toEqual(expect.arrayContaining([other.orgId, inviter.orgId])); + }); + + test("LC-AU18c an invitation of a removed member does not let a visitor in through the sign-up", lifecycleTestDetails("LC-AU18c"), async ({ actor, newUserSession }, testInfo) => { + const inviter = await actor("invowner"); + const leaver = await actor("invleaver"); + await joinWorkspace(inviter, leaver); + const code = await createInvitation(leaver.request, inviter.orgId); + expectAnswer(await registerRaw((await newUserSession()).page.request, uniqueEmail("invbefore", testInfo.workerIndex), TEST_PASSWORD, { invitationId: code }), ALLOWED, "control: while its creator is a member, the invitation admits"); + await removeOrgMember(inviter.request, inviter.orgId, leaver.userId); + const membersBefore = (await listOrgMembers(inviter.request, inviter.orgId)).map((member) => member.userId); + expect(membersBefore, "setup: the invitation's creator is no longer a member").not.toContain(leaver.userId); + const address = uniqueEmail("invlate", testInfo.workerIndex); + + const answer = await registerRaw((await newUserSession()).page.request, address, TEST_PASSWORD, { invitationId: code, orgId: inviter.orgId }); + + expectAnswer(answer, API_ERRORS.INVALID_INVITATION_CODE, "the sign-up with the invitation of a removed member"); + // The refused visitor has an account but belongs to no workspace (its current user is empty), so membership is read from the inviter's side. + const membersAfter = (await listOrgMembers(inviter.request, inviter.orgId)).map((member) => member.userId); + expect(membersAfter.filter((id) => !membersBefore.includes(id)), "no one joined the workspace through the refused sign-up").toEqual([]); + }); + + // By design (owner decision, D-30): anyone who knows a workspace's id joins it by signing up on that workspace's own page. test( - "LC-AU15 a sign-up on another workspace's sign-up page does not make the visitor a member", + "LC-AU15 a sign-up on a workspace's sign-up page makes the visitor a plain member of that workspace only (pin)", lifecycleTestDetails("LC-AU15"), async ({ actor, newUserSession }, testInfo) => { const owner = await actor("orgowner"); @@ -170,15 +228,22 @@ test.describe("lifecycle: sign-up edge cases", () => { const auth = new AuthPage(session.page); await session.page.goto(ORG_REGISTER_PATH(owner.orgId)); await expect(auth.signUpButton, "the workspace's sign-up page renders").toBeVisible(); + const memberIdsBefore = (await listOrgMembers(owner.request, owner.orgId)).map((member) => member.userId); await auth.signUp(uniqueEmail("walkin", testInfo.workerIndex), TEST_PASSWORD); await expect(session.page, "the sign-up worked").toHaveURL(UI_PATHS.APP_LIST); + const visitorId = await currentUserId(session.page.request); + const memberIdsAfter = (await listOrgMembers(owner.request, owner.orgId)).map((member) => member.userId); + expect(memberIdsBefore, "before: the visitor is not a member of the workspace").not.toContain(visitorId); + // The member list may also hold the instance super admin, so the check is a difference, not an equality. + expect(memberIdsAfter.filter((id) => !memberIdsBefore.includes(id)), "the visitor is the one member added").toEqual([visitorId]); const me = await currentUser(session.page.request); expect( - me.orgAndRoles.map((entry) => entry.org.id).includes(owner.orgId), - "the visitor, who held no invitation, is not a member of the workspace", - ).toBe(false); + me.orgAndRoles.map((entry) => ({ orgId: entry.org.id, role: entry.role })), + "the visitor belongs to that workspace only, as a plain member", + ).toEqual([{ orgId: owner.orgId, role: "member" }]); + expect(me.currentOrgId, "and it is the visitor's current workspace").toBe(owner.orgId); }, ); diff --git a/e2e/tests/components/displays.spec.ts b/e2e/tests/components/displays.spec.ts index 51ba33ce63..4a96a9b76a 100644 --- a/e2e/tests/components/displays.spec.ts +++ b/e2e/tests/components/displays.spec.ts @@ -164,40 +164,28 @@ test.describe("S7 display components", () => { await expect(view.byTestId(testIdOf("icon1")).locator("svg"), "no icon svg is drawn for an image URL").toHaveCount(0); }); - test( - "icon: a value that changes from an icon name to an image URL draws the image", - { tag: [TAGS.QUARANTINE] }, - async ({ page, apiUser }, testInfo) => { - testInfo.annotations.push({ - type: "defect", - description: - "CD-9 candidate: after the value changes from an icon name to an image URL the icon " + - "keeps drawing the old icon (observed: the home icon stays). Cause, read from the source and not verified by a fix: " + - "IconControlView keeps the old icon for one render (useIcon sets its state in an effect), caches its view under the " + - "new value in IconDictionary, and the cached entry then passes the title check (undefined === undefined) in every " + - "later render (iconControl.tsx IconControlView, lowcoder-design useIcon). A page that starts with the image URL draws it.", - }); - const items = stackItems([ - button({ - id: "sw", - name: "bSwitch", - text: "Switch state", - testId: SWITCH_BUTTON_TEST_ID, - onEvent: [eventHandler("click", setTempState(STATE_NAME, PNG_RED))], - }), - component("icon", { id: "ic", testId: testIdOf("icon1"), w: 4, h: 6, comp: { icon: `{{${STATE_NAME}.value}}` } }), - ]); - const view = await openSeededView(page, apiUser.orgId, "e2e-s7-icon-switch", items, { - tempStates: [tempState({ id: "s1", name: STATE_NAME, value: JSON.stringify(RECORDED_ICON) })], - }); - await expect(view.byTestId(testIdOf("icon1")).locator("svg").first(), "the icon name is drawn as an svg").toBeVisible(); - - await view.buttonByTestId(SWITCH_BUTTON_TEST_ID).click(); - - await expect(view.byTestId(testIdOf("icon1")).locator("img"), "the image URL is drawn as an image").toHaveAttribute( - "src", - PNG_RED, - ); - }, - ); + // CD-9: a value that changed from an icon name to an image URL kept drawing the old icon (the control cached the previous icon under the new value). + test("icon: a value that changes from an icon name to an image URL draws the image", async ({ page, apiUser }) => { + const items = stackItems([ + button({ + id: "sw", + name: "bSwitch", + text: "Switch state", + testId: SWITCH_BUTTON_TEST_ID, + onEvent: [eventHandler("click", setTempState(STATE_NAME, PNG_RED))], + }), + component("icon", { id: "ic", testId: testIdOf("icon1"), w: 4, h: 6, comp: { icon: `{{${STATE_NAME}.value}}` } }), + ]); + const view = await openSeededView(page, apiUser.orgId, "e2e-s7-icon-switch", items, { + tempStates: [tempState({ id: "s1", name: STATE_NAME, value: JSON.stringify(RECORDED_ICON) })], + }); + await expect(view.byTestId(testIdOf("icon1")).locator("svg").first(), "the icon name is drawn as an svg").toBeVisible(); + + await view.buttonByTestId(SWITCH_BUTTON_TEST_ID).click(); + + await expect(view.byTestId(testIdOf("icon1")).locator("img"), "the image URL is drawn as an image").toHaveAttribute( + "src", + PNG_RED, + ); + }); }); diff --git a/e2e/tests/datasource/plugin-duckdb.spec.ts b/e2e/tests/datasource/plugin-duckdb.spec.ts index 38778b1259..c3563a3595 100644 --- a/e2e/tests/datasource/plugin-duckdb.spec.ts +++ b/e2e/tests/datasource/plugin-duckdb.spec.ts @@ -15,16 +15,12 @@ import { expect, test } from "../../src/fixtures"; * Limits of this file: no `INSTALL`/`LOAD` statement, no URL or file path in any SQL and no `read_*` table function. DuckDB can * autoload extensions from a download host, and a file path would write into the app container that every test shares. * - * Measured shape (images `3.0.0-e2e` and `3.0.1-e2e`): the plugin reads the rows with `getRows()`, which answers each row as an - * array, and `serializeBigInts` copies `Object.entries(row)`. A row therefore reaches the app keyed by the column POSITION - * (`{ "0": 42, "1": "e2e-..." }`), not by the column name. The tests below assert that measured shape, so they carry the - * `defect` annotation `COLUMN_KEY_DEFECT`; once rows are keyed by column name they fail and are rewritten to the names. + * Shape: the plugin answers each row keyed by its column NAME (`SELECT 42 AS answer` is read as `row.answer`), and `serializeBigInts` + * turns a `bigint` into a string. The images before the node-service upgrade keyed a row by the column POSITION (`{ "0": 42, ... }`, + * D-68 candidate); that changed on purpose and the tests below assert the names. */ -/** Candidate defect: rows are keyed by the column's position, so `SELECT 42 AS answer` cannot be read as `row.answer` in an app. */ -const COLUMN_KEY_DEFECT = { type: "defect", description: "D-68 candidate" } as const; const NODE_SERVICE_DETAILS = { tag: [TAGS.NODE_SERVICE] }; -const COLUMN_KEY_DETAILS = { annotation: COLUMN_KEY_DEFECT }; const HTTP_OK = 200; /** `QueryResultView.queryCode` of a failed query (`api/query/view/QueryResultView.java`); the field `code` is `1` whether or not the query succeeded. */ @@ -33,9 +29,11 @@ const QUERY_CODE_FAILED = "FAILED"; const QUERY_CODE_OK = "OK"; const MARKER_BYTES = 4; -/** The position keys of the first two columns of a row. */ -const FIRST_COLUMN = "0"; -const SECOND_COLUMN = "1"; +/** The names of the first two columns of the queries below. */ +const ANSWER_COLUMN = "answer"; +const LABEL_COLUMN = "label"; +const BIG_COLUMN = "big"; +const HUGE_COLUMN = "huge"; /** The largest HUGEINT (2^127 - 1), far beyond the BIGINT range; a JavaScript number could not hold it. */ const HUGEINT_VALUE = "170141183460469231731687303715884105727"; @@ -87,7 +85,7 @@ async function runDraft(page: Page, appId: string, queryId: string): Promise { - test("D4a: a DuckDB query answers rows", COLUMN_KEY_DETAILS, async ({ page, apiUser }) => { + test("D4a: a DuckDB query answers rows", async ({ page, apiUser }) => { const marker = uniqueMarker(); const { appId } = await duckdbApp(page, apiUser, { [QUERY_ID]: `SELECT 42 AS answer, 'e2e-' || '${marker}' AS label` }); @@ -96,15 +94,15 @@ test.describe("DuckDB data source", NODE_SERVICE_DETAILS, () => { expect({ status: answer.status, code: answer.code }, "the query ran").toEqual({ status: HTTP_OK, code: API_OK }); expect(envelopeOf(answer).success, "the query succeeded").toBe(true); expect(envelopeOf(answer).queryCode, "the query code").toBe(QUERY_CODE_OK); - // An INTEGER column reaches the app as a JSON number; the keys are the column positions (D-68 candidate, see the file comment). - expect(envelopeOf(answer).data, "the rows, keyed by column position").toEqual([{ [FIRST_COLUMN]: 42, [SECOND_COLUMN]: `e2e-${marker}` }]); + // An INTEGER column reaches the app as a JSON number; the keys are the column names. + expect(envelopeOf(answer).data, "the rows, keyed by column name").toEqual([{ [ANSWER_COLUMN]: 42, [LABEL_COLUMN]: `e2e-${marker}` }]); }); - test("D4b: the published view shows the DuckDB result after a click", COLUMN_KEY_DETAILS, async ({ page, apiUser }) => { + test("D4b: the published view shows the DuckDB result after a click", async ({ page, apiUser }) => { const marker = uniqueMarker(); const datasourceId = await duckdbDatasource(page, apiUser); - // The text reads the second column by its position key (D-68 candidate); before the first run `q.data` is not a list. - const expression = `{{${QUERY_NAME}.data ? ${QUERY_NAME}.data[0]["${SECOND_COLUMN}"] : ""}}`; + // The text reads the second column by its name; before the first run `q.data` is not a list. + const expression = `{{${QUERY_NAME}.data ? ${QUERY_NAME}.data[0]["${LABEL_COLUMN}"] : ""}}`; const view = await openSeededView( page, apiUser.orgId, @@ -131,7 +129,7 @@ test.describe("DuckDB data source", NODE_SERVICE_DETAILS, () => { await expect(view.byTestId(boundTextTestId(RESULT_NAME)), "after the click the text shows the DuckDB label").toHaveText(`e2e-${marker}`); }); - test("D4c: BIGINT and HUGEINT columns arrive as strings without precision loss", COLUMN_KEY_DETAILS, async ({ page, apiUser }) => { + test("D4c: BIGINT and HUGEINT columns arrive as strings without precision loss", async ({ page, apiUser }) => { const { appId } = await duckdbApp(page, apiUser, { [QUERY_ID]: BIGINT_SQL }); const answer = await runDraft(page, appId, QUERY_ID); @@ -139,8 +137,8 @@ test.describe("DuckDB data source", NODE_SERVICE_DETAILS, () => { expect({ status: answer.status, code: answer.code }, "the query ran").toEqual({ status: HTTP_OK, code: API_OK }); expect(envelopeOf(answer).success, "the query succeeded").toBe(true); expect(envelopeOf(answer).queryCode, "the query code").toBe(QUERY_CODE_OK); - // `serializeBigInts` turns a `bigint` into a string (designed behaviour), a HUGEINT included (measured); the keys are the column positions (D-68 candidate). - expect(envelopeOf(answer).data, "the BIGINT and the HUGEINT as exact strings").toEqual([{ [FIRST_COLUMN]: BIGINT_VALUE, [SECOND_COLUMN]: HUGEINT_VALUE }]); + // `serializeBigInts` turns a `bigint` into a string (designed behaviour), a HUGEINT included (measured); the keys are the column names. + expect(envelopeOf(answer).data, "the BIGINT and the HUGEINT as exact strings").toEqual([{ [BIG_COLUMN]: BIGINT_VALUE, [HUGE_COLUMN]: HUGEINT_VALUE }]); }); test("D4d: each run is a fresh in-memory database", async ({ page, apiUser }) => { diff --git a/e2e/tests/datasource/plugin-firebird.spec.ts b/e2e/tests/datasource/plugin-firebird.spec.ts index 2b630b3ce5..ad84fe9dba 100644 --- a/e2e/tests/datasource/plugin-firebird.spec.ts +++ b/e2e/tests/datasource/plugin-firebird.spec.ts @@ -35,12 +35,6 @@ import { expect, test } from "../../src/fixtures"; * once on the sidecar, not pursued), `blobAsText` and the connection pool; Firebird 4 and 5 (the sidecar is Firebird 3.0.12). */ -/** - * Candidate defect: a query that fails after the attach (a SQL error or an unknown named parameter) never detaches (`run.ts`: `detachAsync` - * comes after the awaited query and is skipped when it throws), so the attachment stays open on the server. A successful query does detach. - */ -const LEAKED_ATTACHMENT_DEFECT = { type: "defect", description: "D-78 candidate" } as const; - const HTTP_OK = 200; const CODE_CONNECT_FAILED = 500; const QUERY_CODE_OK = "OK"; @@ -80,9 +74,9 @@ const CLOSED_PORT = 3051; const CONNECT_TIMEOUT_MS = 5000; /** - * Leaked-attachment observation. A statement that sets a context variable of the attachment (`RDB$SET_CONTEXT`, `USER_SESSION`) tagged with - * a per-test marker and then fails by dividing by zero leaves the tag in `MON$CONTEXT_VARIABLES` for as long as its attachment lives, so a - * count of the tag counts this test's open attachments only (parallel tests use other tags). The marker is hex: it is placed in the SQL text, + * Open-attachment observation (D12j). A statement that sets a context variable of the attachment (`RDB$SET_CONTEXT`, `USER_SESSION`) tagged with + * a per-test marker and then fails by dividing by zero would leave the tag in `MON$CONTEXT_VARIABLES` for as long as its attachment lives (the + * images before the node-service upgrade never detached after a failure, D-78 candidate), so a count of the tag counts this test's open attachments only (parallel tests use other tags). The marker is hex: it is placed in the SQL text, * since a named parameter inside an EXECUTE BLOCK would be rewritten by the plugin too. */ const CONTEXT_VARIABLE = "E2E_TAG"; @@ -98,6 +92,11 @@ function succeedingTaggedSql(tag: string): string { return `EXECUTE BLOCK AS DECLARE V INTEGER; BEGIN V = 1; RDB$SET_CONTEXT('USER_SESSION', '${CONTEXT_VARIABLE}', '${tag}'); END`; } +/** The control of the observation: a block that tags its own attachment and counts the tag sees it, so a zero elsewhere is not a blind count. */ +function visibleTaggedSql(tag: string): string { + return `EXECUTE BLOCK RETURNS (N INTEGER) AS BEGIN RDB$SET_CONTEXT('USER_SESSION', '${CONTEXT_VARIABLE}', '${tag}'); SELECT COUNT(*) FROM MON$CONTEXT_VARIABLES WHERE MON$VARIABLE_NAME = '${CONTEXT_VARIABLE}' AND MON$VARIABLE_VALUE = '${tag}' INTO N; SUSPEND; END`; +} + const COUNT_TAGGED_SQL = `SELECT COUNT(*) AS N FROM MON$CONTEXT_VARIABLES WHERE MON$VARIABLE_NAME = '${CONTEXT_VARIABLE}' AND MON$VARIABLE_VALUE = :tag`; /** The envelope of `POST /api/query/execute` (`QueryResultView`), the fields these tests read. */ @@ -306,11 +305,12 @@ test.describe("Firebird data source against its sidecar", { tag: [TAGS.NODE_SERV expect(envelopeOf(upperAnswer).data, "lowercaseKeys false").toEqual([{ ID: alpha?.id, NAME: alpha?.name }]); }); - test("D12j: a failing query leaves its attachment open, a succeeding one does not", { annotation: LEAKED_ATTACHMENT_DEFECT }, async ({ page, apiUser }) => { + test("D12j: a failing query detaches its attachment, like a succeeding one", async ({ page, apiUser }) => { const tag = uniqueMarker(); const appId = await firebirdApp(page, apiUser, { failing: { sql: failingTaggedSql(tag) }, succeeding: { sql: succeedingTaggedSql(tag) }, + visible: { sql: visibleTaggedSql(tag) }, count: { sql: COUNT_TAGGED_SQL, params: { tag } }, }); const openAttachments = async (): Promise => { @@ -320,18 +320,21 @@ test.describe("Firebird data source against its sidecar", { tag: [TAGS.NODE_SERV }; expect(await openAttachments(), "before any run no attachment carries the tag").toEqual([{ n: 0 }]); + // control: the observation does see a tag a live attachment holds (the block counts its own) + const visible = await runDraft(page, appId, "visible"); + expectSucceeded(visible); + expect(envelopeOf(visible).data, "control: a live attachment's tag is counted").toEqual([{ n: 1 }]); for (let run = 0; run < LEAK_RUNS; run += 1) { const failing = await runDraft(page, appId, "failing"); expectRan(failing); expect({ success: envelopeOf(failing).success, queryCode: envelopeOf(failing).queryCode, data: envelopeOf(failing).data }, "the tagged block failed").toEqual({ success: false, queryCode: QUERY_CODE_FAILED, data: null }); expect(envelopeOf(failing).message, "the division by zero").toMatch(DIVIDE_BY_ZERO_MESSAGE); } - // the observation sees live attachments: one per failing run - await expect.poll(openAttachments, { message: "the failing runs' attachments are open" }).toEqual([{ n: LEAK_RUNS }]); + // the plugin detaches after a failed query, so none of the failing runs' attachments stays open + await expect.poll(openAttachments, { message: "no failing run's attachment is open" }).toEqual([{ n: 0 }]); expectSucceeded(await runDraft(page, appId, "succeeding")); - await page.waitForTimeout(NEGATIVE_EVENT_WINDOW_MS); - expect(await openAttachments(), "the succeeding run's attachment is not among the open ones (the count stays at the failing runs')").toEqual([{ n: LEAK_RUNS }]); + expect(await openAttachments(), "the succeeding run's attachment is closed too").toEqual([{ n: 0 }]); }); test("D12k: the runner reaches the sidecar over TCP, and a closed port of the same host is refused", async () => { diff --git a/e2e/tests/datasource/plugin-graphql.spec.ts b/e2e/tests/datasource/plugin-graphql.spec.ts index 65487b007d..862058c235 100644 --- a/e2e/tests/datasource/plugin-graphql.spec.ts +++ b/e2e/tests/datasource/plugin-graphql.spec.ts @@ -6,7 +6,7 @@ import { appDsl, button, nodePluginQuery, stackItems } from "../../src/dsl/build import { recordedPluginDatasource, recordedPluginQuery } from "../../src/dsl/recorded"; import { boundText, boundTextTestId, openSeededView } from "../../src/components/scenario"; import { expect, test } from "../../src/fixtures"; -import { recordsContain, type EchoRecord, type EchoTarget } from "../../src/security/echo"; +import type { EchoRecord, EchoTarget } from "../../src/security/echo"; /** * D6: the GitLab and Shopify plugins of node-service (`server/node-service/src/plugins/gitlab/index.ts`, `shopify/index.ts`), @@ -14,15 +14,11 @@ import { recordsContain, type EchoRecord, type EchoTarget } from "../../src/secu * endpoint. The endpoint is the test's own target on the echo sidecar, so the tests prove the request the plugin builds and the * path of the canned answer into the app. They are NOT a fidelity test of GitLab or Shopify. * - * Shopify: the plugin reads the query's headers and passes none on, and its data source has no token field, so it cannot send - * Shopify's access token (D6d, D-67 candidate). + * Shopify: the plugin forwards the query's headers to the endpoint, so a query can send Shopify's access token (D6d). The images + * before the node-service upgrade dropped every header of a Shopify query (D-67 candidate); that was fixed. */ const NODE_SERVICE_DETAILS = { tag: [TAGS.NODE_SERVICE] }; -/** Candidate defect: the Shopify plugin drops every header of the query and has no access token field. */ -const SHOPIFY_HEADERS_DEFECT = { type: "defect", description: "D-67 candidate" } as const; -const SHOPIFY_HEADERS_DETAILS = { annotation: SHOPIFY_HEADERS_DEFECT }; - /** The path below the target that the endpoint points at. */ const GRAPHQL_PATH = "/api/graphql"; const HTTP_OK = 200; @@ -204,7 +200,7 @@ test.describe("Shopify data source against the echo", NODE_SERVICE_DETAILS, () = expect(envelopeOf(answer).data, "the answer is the data member of the canned reply").toEqual(SHOPIFY_DATA); }); - test("D6d: a Shopify query header never reaches the endpoint", SHOPIFY_HEADERS_DETAILS, async ({ page, apiUser, echo }) => { + test("D6d: a Shopify query header reaches the endpoint", async ({ page, apiUser, echo }) => { const marker = `e2e-shopify-token-${uniqueMarker()}`; await echo.answer(GRAPHQL_PATH, cannedData(SHOPIFY_DATA)); const datasourceId = await graphqlDatasource(page, apiUser, echo, "shopify"); @@ -226,11 +222,10 @@ test.describe("Shopify data source against the echo", NODE_SERVICE_DETAILS, () = const shopifyRecords = await echo.received(); const record = onlyRecord(shopifyRecords); expect(JSON.parse(record.body), "the request body is the query").toEqual({ query: SHOPIFY_QUERY, variables: {} }); - // The plugin reads the query's headers and passes `{}` on (D-67 candidate, see SHOPIFY_HEADERS_DEFECT): neither the header name nor its value arrives. - expect(recordsContain(shopifyRecords, marker), "the header value reached the endpoint").toBe(false); - expect(Object.keys(record.headers).map((name) => name.toLowerCase()), "the header name reached the endpoint").not.toContain(SHOPIFY_TOKEN_HEADER.toLowerCase()); + // The plugin passes the query's headers on: the header arrives under its own name with its value. + expect(record.headers[SHOPIFY_TOKEN_HEADER.toLowerCase()], "the header value reached the endpoint").toBe(marker); - // control 3: the very same header, set on a GitLab query of the same app machinery, does reach the echo, so only the Shopify plugin drops it + // control 3: the very same header, set on a GitLab query of the same app machinery, arrives the same way const gitlabId = await graphqlDatasource(page, apiUser, echo, "gitlab", { token: "e2e-token" }); const gitlab = await graphqlApp(page, apiUser, "gitlab", gitlabId, { query: GITLAB_QUERY, headers: [{ key: SHOPIFY_TOKEN_HEADER, value: marker }] }); expectRan(await runDraft(page, gitlab.appId)); diff --git a/e2e/tests/datasource/plugin-openapi-wrappers-apps.spec.ts b/e2e/tests/datasource/plugin-openapi-wrappers-apps.spec.ts index d26f508df5..1e70992871 100644 --- a/e2e/tests/datasource/plugin-openapi-wrappers-apps.spec.ts +++ b/e2e/tests/datasource/plugin-openapi-wrappers-apps.spec.ts @@ -19,7 +19,7 @@ import type { EchoRecord, EchoTarget } from "../../src/security/echo"; * - OpenAI `listModels`: `GET /models` (`openAI_v2.3.0.json`; the data source's `specVersion` picks the document); * - APITemplate `list_templates`: `GET /v2/list-templates` (`apiTemplate.spec.json`); * - Carbone `get_status`: `GET /status` and `get_template__templateId_`: `GET /template/{templateId}` (`carboneIo.spec.json`); - * - UiPath `Folders_Get`: `GET /odata/Folders` (`uiPath.spec.json`); measured: this plugin cannot run any operation (D9j to D9l). + * - UiPath `Folders_Get`: `GET /odata/Folders` (`uiPath.spec.json`); D9j (a query) and D9k (the query configuration) run on the upgraded node-service; the images before it overflowed the stack on the document (D-71 candidate). * * The plugins keep their parsed document in a module-level object, and `runOpenApi` rewrites its server URL in place. D9m submits several * queries together and checks that each reaches its own server URL with its own data. The echo withholds every answer (a barrier) until all @@ -33,31 +33,13 @@ const NODE_SERVICE_DETAILS = { tag: [TAGS.NODE_SERVICE] }; const ERROR_STATUS_SUCCESS_DEFECT = { type: "defect", description: "D-69 candidate" } as const; const ERROR_STATUS_DETAILS = { annotation: ERROR_STATUS_SUCCESS_DEFECT }; -/** - * Candidate defect: the UiPath plugin cannot run: `getSchemaExample` (`plugins/openApi/util.ts`) recurses without end on a circular schema of - * the bundled document, so its query configuration (what the editor lists) and every query fail with `Maximum call stack size exceeded`. - */ -const UIPATH_DEFECT = { type: "defect", description: "D-71 candidate" } as const; -const UIPATH_DETAILS = { annotation: UIPATH_DEFECT }; -/** The desired behaviour of the UiPath plugin: it fails today, so it is quarantined (the enclosing describe adds `@node-service`). */ -const UIPATH_QUARANTINE_DETAILS = { tag: [TAGS.QUARANTINE], annotation: UIPATH_DEFECT }; - -/** - * Candidate defect: an OpenAI data source on the spec version `v1.0` (the default when none is chosen) sends no `Authorization` header: the - * plugin hands the key over as `ApiKeyAuth.value`, the scheme of the `v2.3` document, while the `v1.0` document names its scheme `ApiKey`. - */ -const OPENAI_V1_AUTH_DEFECT = { type: "defect", description: "D-72 candidate" } as const; -const OPENAI_V1_AUTH_DETAILS = { annotation: OPENAI_V1_AUTH_DEFECT }; - /** Observation: a Carbone data source sends its token only with the operations whose document entry lists the `bearerAuth` scheme; `get_status` does not. */ const CARBONE_STATUS_OBSERVATION = { type: "observation", description: "carboneIo get_status sends no Authorization header: the operation lists no security scheme" } as const; const CARBONE_STATUS_DETAILS = { annotation: CARBONE_STATUS_OBSERVATION }; const HTTP_OK = 200; const HTTP_NOT_FOUND = 404; -const HTTP_SERVER_ERROR = 500; const QUERY_CODE_OK = "OK"; -const QUERY_CODE_FAILED = "FAILED"; const JSON_CONTENT_TYPE = "application/json"; const MARKER_BYTES = 4; const QUERY_ID = "q1"; @@ -81,10 +63,8 @@ const CARBONE_VERSION = "4"; const CHAT_ACTION = "createChatCompletion"; const CHAT_BODY_KEY = "body_@_body"; -/** What UiPath's error answers: the node-service message of a failed query (`runPluginQuery`) and the answer of the form's dynamic config. */ -const UIPATH_FAILURE_MESSAGE = "Maximum call stack size exceeded"; -const DYNAMIC_CONFIG_ERROR_CODE = 5000; -const DYNAMIC_CONFIG_ERROR_MESSAGE = "get dynamic config error"; +/** The operation of the recorded UiPath query (`fixtures/dsl/plugins/uiPath/uiPathQuery.json`): `GET /odata/Folders`. */ +const UIPATH_FOLDERS_OPERATION = "Folders_Get"; /** The path of the plugin's query configuration in a dynamic config request (`pluginMetaOps`, `services/plugin.ts`). */ const QUERY_CONFIG_PATH = "$.queryConfig"; const FORM_DEFAULTS = { authConfigType: "NO_AUTH", sslCertVerificationType: "VERIFY_CA_CERT" } as const; @@ -341,7 +321,7 @@ test.describe("OpenAI", NODE_SERVICE_DETAILS, () => { expect(envelopeOf(answer).data, "the answer is the body of the echo's canned reply").toEqual(completion); }); - test("D9h OpenAI: on the spec version v1.0, chosen or by default, the key is sent nowhere; on v2.3 it is sent as a Bearer header", OPENAI_V1_AUTH_DETAILS, async ({ page, apiUser, echo }) => { + test("D9h OpenAI: on every spec version, chosen or by default, the key is sent as a Bearer header", async ({ page, apiUser, echo }) => { const marker = uniqueMarker(); const key = `e2e-openai-${marker}`; const sides = [ @@ -361,12 +341,10 @@ test.describe("OpenAI", NODE_SERVICE_DETAILS, () => { const records = await echo.received(); expect(records, "one request per data source").toHaveLength(sides.length); - // control: with the same key on the same server the v2.3 document sends it, so the missing header below is the plugin's, not the echo's - expectRequest(onlyRecord(recordsUnder(records, echo, "/v2"), "v2.3 sent one request"), echo, { path: `${echo.path}/v2/models`, headers: { authorization: `Bearer ${key}` } }, "v2.3"); - // Measured on the images `3.0.0-e2e` and `3.0.1-e2e`: the v1.0 document names its scheme `ApiKey`, the plugin hands the key over as `ApiKeyAuth.value`, so no header is sent (D-72 candidate, see OPENAI_V1_AUTH_DEFECT). - expectRequest(onlyRecord(recordsUnder(records, echo, "/default"), "the default version sent one request"), echo, { path: `${echo.path}/default/models` }, "default version"); - expectRequest(onlyRecord(recordsUnder(records, echo, "/v1"), "v1.0 sent one request"), echo, { path: `${echo.path}/v1/models` }, "v1.0"); - expect(JSON.stringify([records[0], records[1]]).includes(key), "the key is on no part of the v1.0 and default requests").toBe(false); + // the v1.0 document names its scheme `ApiKey` and the v2.3 one `ApiKeyAuth`; the plugin sends the key under both (the images before the node-service upgrade sent none on v1.0, D-72 candidate) + for (const side of ["default", "v1", "v2"]) { + expectRequest(onlyRecord(recordsUnder(records, echo, `/${side}`), `${side} sent one request`), echo, { path: `${echo.path}/${side}/models`, headers: { authorization: `Bearer ${key}` } }, side); + } }); }); @@ -393,75 +371,42 @@ test.describe("an error answer", NODE_SERVICE_DETAILS, () => { }); }); -/** The APITemplate request of the control in the UiPath tests: it reaches the same echo target, so a missing UiPath request is not an unreachable echo. */ -async function expectApiTemplateReachesEcho(page: Page, apiUser: RegisteredUser, echo: EchoTarget, marker: string): Promise { - const row = ROWS.find((candidate) => candidate.plugin === "apiTemplate") as WrapperRow; - const auth = row.auth(marker); - await echo.answer(answerPathOf(row, marker, ""), canned(row.data(marker))); - const datasourceId = await wrapperDatasource(page, apiUser, row.plugin, { serverURL: echo.url, ...auth.config }); - const answer = await runDraft(page, await wrapperApp(page, apiUser, row.plugin, datasourceId)); - expectSucceeded(answer); - expectRequest(onlyRecord(await echo.received(), "the control query's request reached the echo"), echo, { path: `${echo.path}${requestPathOf(row, marker, "")}`, headers: auth.headers }, "control (apiTemplate)"); -} - test.describe("UiPath", NODE_SERVICE_DETAILS, () => { - test("D9j uiPath: a query fails with a stack overflow of the plugin and sends no request", UIPATH_DETAILS, async ({ page, apiUser, echo }) => { + test("D9j uiPath: a folders query reaches the server URL with the token as a Bearer header and answers the canned data", async ({ page, apiUser, echo }) => { const marker = uniqueMarker(); - const datasourceId = await wrapperDatasource(page, apiUser, "uiPath", { serverURL: echo.url, "Authorization.value": `e2e-uipath-${marker}` }); + const token = `e2e-uipath-${marker}`; + const data = { "@odata.count": 1, value: [{ Id: 1, DisplayName: `E2E folder ${marker}` }] }; + await echo.answer("/odata/Folders", canned(data)); + const datasourceId = await wrapperDatasource(page, apiUser, "uiPath", { serverURL: echo.url, "Authorization.value": token }); const appId = await wrapperApp(page, apiUser, "uiPath", datasourceId); expect(await echo.received(), "before the run the echo holds nothing of this test").toEqual([]); const answer = await runDraft(page, appId); - expectRan(answer); - // Measured on the images `3.0.0-e2e` and `3.0.1-e2e` (D-71 candidate, see UIPATH_DEFECT). - expect(envelopeOf(answer).success, "the query failed").toBe(false); - expect(envelopeOf(answer).queryCode, "the query code").toBe(QUERY_CODE_FAILED); - expect(envelopeOf(answer).message, "node-service's message").toBe(UIPATH_FAILURE_MESSAGE); - expect(await echo.received(), "no request left the plugin").toEqual([]); - // positive control: another wrapper's query against the same echo target arrives (the empty list above is not an unreachable echo) - await expectApiTemplateReachesEcho(page, apiUser, echo, marker); + // `Bearer ` exactly, not doubled and not missing. + expectSucceeded(answer); + const record = onlyRecord(await echo.received(), "the echo received exactly one request"); + expectRequest(record, echo, { path: `${echo.path}/odata/Folders`, headers: { authorization: `Bearer ${token}` } }, "uiPath"); + expect(envelopeOf(answer).data, "the answer is the body of the echo's canned reply").toEqual(data); }); - test("D9k uiPath: the data source form's query configuration request fails with HTTP 500 / code 5000, while the same request for APITemplate succeeds and lists its operations", UIPATH_DETAILS, async ({ page, apiUser, echo }) => { + test("D9k uiPath: the data source form's query configuration request succeeds and lists the folder operations, like the one for APITemplate", async ({ page, apiUser, echo }) => { expect(apiUser.orgId, "the test is signed in (the route needs a session)").not.toBe(""); // the request body is the key of node-service's in-memory cache: the target's URL makes both bodies unique to this test const dataSourceConfig = { serverURL: echo.url, ...FORM_DEFAULTS }; const answer = await pluginDynamicConfigRaw(page.request, [{ pluginName: "uiPath", path: QUERY_CONFIG_PATH, dataSourceConfig }]); - // Measured on the images `3.0.0-e2e` and `3.0.1-e2e` (D-71 candidate, see UIPATH_DEFECT): the request for the UiPath document fails, so the editor - // cannot list a single operation. The test asserts the failure of this request and, below, that the same request shape succeeds for another - // plugin; the cause (a `RangeError: Maximum call stack size exceeded` in `getSchemaExample`) was seen in node-service's log while recording, the suite cannot read that log. - expect(answer.status, "the HTTP status").toBe(HTTP_SERVER_ERROR); - expect(answer.code, "the API code").toBe(DYNAMIC_CONFIG_ERROR_CODE); - expect((answer.json as { message?: string; success?: boolean }).message, "the message").toBe(DYNAMIC_CONFIG_ERROR_MESSAGE); - expect((answer.json as { success?: boolean }).success, "success").toBe(false); - // positive control: the identical request (same path and data source settings) for APITemplate succeeds and lists its operations, so the - // failure above is specific to the UiPath document and not to the route, the session or the request shape + expectRan(answer); + expect((answer.json as { success?: boolean }).success, "success").toBe(true); + const entry = (answer.json as { data?: { actions?: { actionName?: string }[] }[] }).data?.[0]; + expect(entry?.actions?.map((action) => action.actionName), "the operations UiPath's configuration lists").toContain(UIPATH_FOLDERS_OPERATION); + // control: the identical request for APITemplate answers the same way and lists its own operations const control = await pluginDynamicConfigRaw(page.request, [{ pluginName: "apiTemplate", path: QUERY_CONFIG_PATH, dataSourceConfig }]); expectRan(control); expect((control.json as { success?: boolean }).success, "the control request succeeded").toBe(true); - const entry = (control.json as { data?: { actions?: { actionName?: string }[] }[] }).data?.[0]; - expect(entry?.actions?.map((action) => action.actionName), "the operations APITemplate's configuration lists").toContain("list_templates"); - }); - - test("D9l uiPath: a folders query reaches the server URL with the token as a Bearer header and answers the canned data", UIPATH_QUARANTINE_DETAILS, async ({ page, apiUser, echo }) => { - const marker = uniqueMarker(); - const token = `e2e-uipath-${marker}`; - const data = { "@odata.count": 1, value: [{ Id: 1, DisplayName: `E2E folder ${marker}` }] }; - await echo.answer("/odata/Folders", canned(data)); - const datasourceId = await wrapperDatasource(page, apiUser, "uiPath", { serverURL: echo.url, "Authorization.value": token }); - const appId = await wrapperApp(page, apiUser, "uiPath", datasourceId); - expect(await echo.received(), "before the run the echo holds nothing of this test").toEqual([]); - - const answer = await runDraft(page, appId); - - // The desired behaviour, not a measured one: it fails today (D9j). `Bearer ` exactly, not doubled and not missing. - expectSucceeded(answer); - const record = onlyRecord(await echo.received(), "the echo received exactly one request"); - expectRequest(record, echo, { path: `${echo.path}/odata/Folders`, headers: { authorization: `Bearer ${token}` } }, "uiPath"); - expect(envelopeOf(answer).data, "the answer is the body of the echo's canned reply").toEqual(data); + const controlEntry = (control.json as { data?: { actions?: { actionName?: string }[] }[] }).data?.[0]; + expect(controlEntry?.actions?.map((action) => action.actionName), "the operations APITemplate's configuration lists").toContain("list_templates"); }); }); diff --git a/e2e/tests/datasource/plugin-supabase-storage.spec.ts b/e2e/tests/datasource/plugin-supabase-storage.spec.ts index ba0f735f09..0bac13f7b6 100644 --- a/e2e/tests/datasource/plugin-supabase-storage.spec.ts +++ b/e2e/tests/datasource/plugin-supabase-storage.spec.ts @@ -26,19 +26,6 @@ import { recordsContain, type EchoRecord, type EchoTarget } from "../../src/secu */ const NODE_SERVICE_DETAILS = { tag: [TAGS.NODE_SERVICE] }; -/** - * Candidate defect: a storage error answer (any status) fails the query with `{"size":0,"timeout":0}`, the JSON of node-fetch's own - * `Response`, not with the message of the answer: storage-js recognises an HTTP error only as an instance of the global `Response`, and - * the proxy fetch answers with node-fetch's class. - */ -const ERROR_TEXT_DEFECT = { type: "defect", description: "D-74 candidate" } as const; -/** - * Candidate defect: the signed-URL validity the plugin sends as `expiresIn` is `Date.now() + 5 minutes` in milliseconds (a 13-digit number - * of the order of 1.8e12), computed once when node-service loads the plugin, while the API takes seconds. - */ -const EXPIRY_DEFECT = { type: "defect", description: "D-75 candidate" } as const; -/** Candidate defect: the `search` field of listObjects is read by the query form and never sent. */ -const SEARCH_DEFECT = { type: "defect", description: "D-76 candidate" } as const; /** Candidate defect: only listObjects checks the bucket (`Bucket is required`); the other operations send a request for an empty bucket name. */ const EMPTY_BUCKET_DEFECT = { type: "defect", description: "D-77 candidate" } as const; /** Observation: an upload without a content type sends an empty `content-type` header (the editor's default is an empty text). */ @@ -78,28 +65,11 @@ const SHAPE_BAD = ""; const UPLOAD_CACHE_CONTROL = "max-age=3600"; const UPLOAD_UPSERT = "false"; -/** The message of every failed storage call today: the JSON of node-fetch's `Response` (D-74). */ -const LOST_ERROR_TEXT = '{"size":0,"timeout":0}'; const CANNED_ERROR_MESSAGE = "e2e-storage-error"; const BUCKET_REQUIRED = "Bucket is required"; -/** - * The validity of a signed URL the plugin intends (`expiresIn` is built from `1000 * 60 * 5`) and the smallest value that cannot be a - * number of seconds of any sensible validity: an epoch time in milliseconds after the year 2001 is larger than `1e12`. - */ -const INTENDED_EXPIRY_MS = 1000 * 60 * 5; -const EPOCH_MS_FLOOR = 1e12; -/** - * The app container's clock and the runner's clock are two clocks (two containers of one host here, but a remote Docker host would differ): - * the value is the container's time, the bound is the runner's. One hour is generous for any sane skew and still ten times smaller than the - * gap between milliseconds and seconds, so it cannot hide a plugin that sends seconds (the `EPOCH_MS_FLOOR` guard decides that). - */ -const CLOCK_SKEW_ALLOWANCE_MS = 60 * 60 * 1000; -/** - * The value is computed once, when node-service loads the plugin, so it is as old as the container (a run of this spec starts a fresh one): - * the lower bound allows a container that is up to six hours old, a bound no gate or full run of this suite comes near. - */ -const MAX_PLUGIN_AGE_MS = 6 * 60 * 60 * 1000; +/** The validity of a signed URL, in seconds: the API takes seconds and the plugin asks for five minutes. */ +const SIGNED_URL_SECONDS = 60 * 5; const BUCKET = "e2e"; const FILE = "a.txt"; @@ -205,15 +175,11 @@ function expectKeyOnlyInItsHeaders(records: EchoRecord[], key: string, answers: for (const answer of answers) expect(JSON.stringify(answer.json).includes(key), `${label}: the key is in no answer of the query`).toBe(false); } -/** Asserts a signed-URL body's `expiresIn` (D-75) and returns it; the rest of the body is asserted by the caller. */ +/** Asserts a signed-URL body's `expiresIn` is five minutes in seconds and returns it; the rest of the body is asserted by the caller. */ function expiresInOf(record: EchoRecord, label: string): number { const value = (JSON.parse(record.body) as { expiresIn?: unknown }).expiresIn; - expect(typeof value === "number" && Number.isInteger(value), `${label}: expiresIn is an integer number`).toBe(true); - const expiresIn = value as number; - expect(expiresIn, `${label}: expiresIn is an epoch time in milliseconds (13 digits), not a number of seconds`).toBeGreaterThan(EPOCH_MS_FLOOR); - expect(expiresIn, `${label}: it was computed before this request, as now plus five minutes at most (allowing for clock skew)`).toBeLessThanOrEqual(Date.now() + INTENDED_EXPIRY_MS + CLOCK_SKEW_ALLOWANCE_MS); - expect(expiresIn, `${label}: it is not older than the plugin's load time plus five minutes (allowing for clock skew)`).toBeGreaterThanOrEqual(Date.now() - MAX_PLUGIN_AGE_MS - CLOCK_SKEW_ALLOWANCE_MS); - return expiresIn; + expect(value, `${label}: expiresIn is the validity in seconds`).toBe(SIGNED_URL_SECONDS); + return SIGNED_URL_SECONDS; } /** A data source from the recording whose project URL is the echo target's `/sb` (`suffix` appended, e.g. a slash) and whose key is `key`. */ @@ -249,7 +215,7 @@ function expectSucceeded(answer: RawAnswer): void { function expectFailed(answer: RawAnswer, message: string): void { expectRan(answer); - expect({ success: envelopeOf(answer).success, queryCode: envelopeOf(answer).queryCode, message: envelopeOf(answer).message, data: envelopeOf(answer).data }, "the query failed with the measured message").toEqual({ + expect({ success: envelopeOf(answer).success, queryCode: envelopeOf(answer).queryCode, message: envelopeOf(answer).message, data: envelopeOf(answer).data }, "the query failed with the message of the answer").toEqual({ success: false, queryCode: QUERY_CODE_FAILED, message, @@ -335,7 +301,7 @@ test.describe("Supabase Storage data source against the echo", NODE_SERVICE_DETA expect(envelopeOf(answer).data, "an empty listing is an empty list").toEqual([]); }); - test("D11e: the search field of listObjects is not sent", { annotation: SEARCH_DEFECT }, async ({ page, apiUser, echo }) => { + test("D11e: the search field of listObjects is sent", async ({ page, apiUser, echo }) => { const key = keyOf(uniqueMarker()); await answerStorage(echo, `/object/list/${BUCKET}`, HTTP_OK, []); const searched = await supabaseApp(page, apiUser, echo, key, "ListObjects", { bucket: BUCKET, path: SEARCH_PREFIX, search: SEARCH_TEXT }); @@ -344,19 +310,18 @@ test.describe("Supabase Storage data source against the echo", NODE_SERVICE_DETA expectSucceeded(answer); const records = await echo.received(); - // D-76 candidate: the body is exactly the one of a query with no search, the other fields travel (positive control inside the same body) + // the search text travels in the body next to the prefix, paging and sorting expectStorageRequest( onlyRecord(records), echo, - { method: "POST", path: `/object/list/${BUCKET}`, key, json: { limit: 10, offset: 0, sortBy: { column: "name", order: "asc" }, prefix: SEARCH_PREFIX } }, + { method: "POST", path: `/object/list/${BUCKET}`, key, json: { limit: 10, offset: 0, sortBy: { column: "name", order: "asc" }, prefix: SEARCH_PREFIX, search: SEARCH_TEXT } }, "listObjects with a search text", ); - expect(recordsContain(records, SEARCH_TEXT), "the search text is in no header, path or body").toBe(false); - expect(recordsContain(records, SEARCH_PREFIX), "positive control: the prefix of the same query reaches the echo").toBe(true); + expect(recordsContain(records, SEARCH_TEXT), "the search text reaches the echo").toBe(true); expectKeyOnlyInItsHeaders(records, key, [answer], "listObjects with a search text"); }); - test("D11f: listObjects with returnSignedUrl signs every listed path in one more request", { annotation: EXPIRY_DEFECT }, async ({ page, apiUser, echo }) => { + test("D11f: listObjects with returnSignedUrl signs every listed path in one more request", async ({ page, apiUser, echo }) => { const key = keyOf(uniqueMarker()); const signedPath = `/object/sign/${BUCKET}/${PREFIX}/${FILE}?token=t1`; await answerStorage(echo, `/object/list/${BUCKET}`, HTTP_OK, LISTED_FILES); @@ -369,7 +334,6 @@ test.describe("Supabase Storage data source against the echo", NODE_SERVICE_DETA const records = await echo.received(); expect(records, "the echo holds the listing and the signing").toHaveLength(2); expectStorageRequest(records[0] as EchoRecord, echo, { method: "POST", path: `/object/list/${BUCKET}`, key, json: { limit: 10, offset: 0, sortBy: { column: "name", order: "asc" }, prefix: PREFIX } }, "the listing"); - // D-75 candidate: an epoch time in milliseconds where the API takes seconds const expiresIn = expiresInOf(records[1] as EchoRecord, "the signing"); expectStorageRequest(records[1] as EchoRecord, echo, { method: "POST", path: `/object/sign/${BUCKET}`, key, json: { expiresIn, paths: [`${PREFIX}/${FILE}`] } }, "the signing"); expectKeyOnlyInItsHeaders(records, key, [answer], "listObjects with signed URLs"); @@ -450,7 +414,7 @@ test.describe("Supabase Storage data source against the echo", NODE_SERVICE_DETA expect(envelopeOf(answer).data, "the stored path").toEqual({ path: "up.txt", id: UPLOAD_ANSWER.Id, fullPath: UPLOAD_ANSWER.Key }); }); - test("D11k: uploadData with returnSignedUrl uploads, then asks for a signed URL of the same name", { annotation: EXPIRY_DEFECT }, async ({ page, apiUser, echo }) => { + test("D11k: uploadData with returnSignedUrl uploads, then asks for a signed URL of the same name", async ({ page, apiUser, echo }) => { const key = keyOf(uniqueMarker()); const signedPath = `/object/sign/${BUCKET}/up.txt?token=t2`; await answerStorage(echo, `/object/${BUCKET}`, HTTP_OK, UPLOAD_ANSWER); @@ -493,7 +457,7 @@ test.describe("Supabase Storage data source against the echo", NODE_SERVICE_DETA expect(envelopeOf(answer).data, "the plugin's own answer, not the API's").toEqual({ success: true }); }); - test("D11m: createSignedUrl posts the validity and answers the signed URL below the project's storage URL", { annotation: EXPIRY_DEFECT }, async ({ page, apiUser, echo }) => { + test("D11m: createSignedUrl posts the validity and answers the signed URL below the project's storage URL", async ({ page, apiUser, echo }) => { const key = keyOf(uniqueMarker()); const signedPath = `/object/sign/${BUCKET}/${FILE}?token=t3`; await answerStorage(echo, `/object/sign/${BUCKET}`, HTTP_OK, { signedURL: signedPath }); @@ -504,13 +468,12 @@ test.describe("Supabase Storage data source against the echo", NODE_SERVICE_DETA expectSucceeded(answer); const records = await echo.received(); const firstRecord = onlyRecord(records); - // D-75 candidate: the value is an epoch time in milliseconds, not a number of seconds const expiresIn = expiresInOf(firstRecord, "the first signing"); expectStorageRequest(firstRecord, echo, { method: "POST", path: `/object/sign/${BUCKET}/${FILE}`, key, json: { expiresIn } }, "createSignedUrl"); expectKeyOnlyInItsHeaders(records, key, [answer], "createSignedUrl"); expect(envelopeOf(answer).data, "the signed URL").toEqual({ signedUrl: `${storageUrl(echo)}${signedPath}` }); - // the value is computed once per node-service process: a second query, later, sends the very same number + // a second query sends the very same validity const second = await supabaseApp(page, apiUser, echo, key, "CreateSignedUrl", { bucket: BUCKET, fileName: FILE }); const secondAnswer = await runDraft(page, second); expectSucceeded(secondAnswer); @@ -522,7 +485,7 @@ test.describe("Supabase Storage data source against the echo", NODE_SERVICE_DETA expectKeyOnlyInItsHeaders(afterSecond, key, [answer, secondAnswer], "both createSignedUrl queries"); }); - test.describe("a storage error answer fails the query with the text of node-fetch's response", () => { + test.describe("a storage error answer fails the query with the message of the answer", () => { const rows = [ { title: "listBuckets 400", @@ -556,15 +519,15 @@ test.describe("Supabase Storage data source against the echo", NODE_SERVICE_DETA }, ]; for (const row of rows) { - test(`D11n: ${row.title}`, { annotation: ERROR_TEXT_DEFECT }, async ({ page, apiUser, echo }) => { + test(`D11n: ${row.title}`, async ({ page, apiUser, echo }) => { const key = keyOf(uniqueMarker()); await answerStorage(echo, row.subPath, row.status, { statusCode: String(row.status), error: "e2e", message: CANNED_ERROR_MESSAGE }); const appId = await supabaseApp(page, apiUser, echo, key, row.variant, row.action); const failed = await runDraft(page, appId); - // D-74 candidate: the message of the answer is lost, node-fetch's Response is printed instead - expectFailed(failed, LOST_ERROR_TEXT); + // the message of the answer reaches the user + expectFailed(failed, CANNED_ERROR_MESSAGE); const afterFailure = await echo.received(); expectStorageRequest(onlyRecord(afterFailure), echo, { ...row.request, key }, `the failing ${row.title}`); @@ -581,7 +544,7 @@ test.describe("Supabase Storage data source against the echo", NODE_SERVICE_DETA }); } - test("D11o: createSignedUrl and listObjects fail the same way", { annotation: ERROR_TEXT_DEFECT }, async ({ page, apiUser, echo }) => { + test("D11o: createSignedUrl and listObjects fail the same way", async ({ page, apiUser, echo }) => { const key = keyOf(uniqueMarker()); await answerStorage(echo, "", HTTP_BAD_REQUEST, { statusCode: "400", error: "e2e", message: CANNED_ERROR_MESSAGE }); const signing = await supabaseApp(page, apiUser, echo, key, "CreateSignedUrl", { bucket: BUCKET, fileName: FILE }); @@ -590,8 +553,8 @@ test.describe("Supabase Storage data source against the echo", NODE_SERVICE_DETA const signingAnswer = await runDraft(page, signing); const listingAnswer = await runDraft(page, listing); - expectFailed(signingAnswer, LOST_ERROR_TEXT); - expectFailed(listingAnswer, LOST_ERROR_TEXT); + expectFailed(signingAnswer, CANNED_ERROR_MESSAGE); + expectFailed(listingAnswer, CANNED_ERROR_MESSAGE); const records = await echo.received(); expect(records, "the echo holds the signing and the listing").toHaveLength(2); expectStorageRequest(records[0] as EchoRecord, echo, { method: "POST", path: `/object/sign/${BUCKET}/${FILE}`, key, json: { expiresIn: expiresInOf(records[0] as EchoRecord, "the signing") } }, "the failing signing"); diff --git a/e2e/tests/editor/drop-size.spec.ts b/e2e/tests/editor/drop-size.spec.ts index ed2042fdf0..53c88710e2 100644 --- a/e2e/tests/editor/drop-size.spec.ts +++ b/e2e/tests/editor/drop-size.spec.ts @@ -1,5 +1,5 @@ import { createApp, getAppDsl } from "../../src/api/client"; -import { BUTTON_COMP_TYPE, BUTTON_SEARCH_TEXT, DROP_TARGET, SAVE_POLL_TIMEOUT_MS, TAGS } from "../../src/constants"; +import { BUTTON_COMP_TYPE, BUTTON_SEARCH_TEXT, DROP_TARGET, SAVE_POLL_TIMEOUT_MS } from "../../src/constants"; import { expect, test } from "../../src/fixtures"; import { EditorPage } from "../../src/pages/EditorPage"; @@ -8,11 +8,11 @@ interface SavedLayoutItem { } /** - * Exposes defect D-5: a component dropped right after the editor reports - * ready is saved with width 0. Quarantined because it fails on the 3.0.0 baseline; run it with - * E2E_INCLUDE_QUARANTINE=1. It passes when the editor is fixed. + * Regression test of defect D-5: on the 3.0.0 baseline a component dropped right after the editor reports ready was saved + * with width 0, because the root canvas's measured width is stored a moment after the editor is ready. The page is opened + * with `settleGrid: false`, which is what makes this a test of that race. */ -test("a component dropped right after the editor is ready has a usable width", { tag: TAGS.QUARANTINE }, async ({ +test("a component dropped right after the editor is ready has a usable width", async ({ page, apiUser, }) => { diff --git a/e2e/tests/foundation/lifecycle-helpers.spec.ts b/e2e/tests/foundation/lifecycle-helpers.spec.ts index 56c161b56f..8193a2671c 100644 --- a/e2e/tests/foundation/lifecycle-helpers.spec.ts +++ b/e2e/tests/foundation/lifecycle-helpers.spec.ts @@ -22,6 +22,29 @@ test.describe("lifecycle account helpers", () => { expect({ status: second.status, code: second.code }, "the same address again").toEqual(API_ERRORS.USER_LOGIN_ID_EXIST); }); + test("registerRaw with an invitation alone joins the inviter's workspace", async ({ actor, newUserSession }, testInfo) => { + const inviter = await actor("rawinviter"); + const code = await createInvitation(inviter.request, inviter.orgId); + const visitor = (await newUserSession()).page.request; + + const registered = await registerRaw(visitor, uniqueEmail("rawinvited", testInfo.workerIndex), TEST_PASSWORD, { invitationId: code }); + + expect({ status: registered.status, code: registered.code }, "an invitation-only sign-up").toEqual({ status: 200, code: API_OK }); + expect((await currentUser(visitor)).orgAndRoles.map((entry) => entry.org.id), "the visitor belongs to the inviter's workspace").toContain(inviter.orgId); + }); + + test("signInRaw with an invitation alone lets an existing user join the inviter's workspace", async ({ actor, newUserSession }) => { + const inviter = await actor("rawinviter2"); + const guest = await actor("rawguest2"); + const code = await createInvitation(inviter.request, inviter.orgId); + const visitor = (await newUserSession()).page.request; + + const answer = await signInRaw(visitor, guest.email, TEST_PASSWORD, { invitationId: code }); + + expect({ status: answer.status, code: answer.code }, "an invitation-only sign-in").toEqual({ status: 200, code: API_OK }); + expect((await currentUser(visitor)).orgAndRoles.map((entry) => entry.org.id), "the user now belongs to both workspaces").toEqual(expect.arrayContaining([guest.orgId, inviter.orgId])); + }); + test("signInRaw answers a sign-in with its cookie and a wrong password without a throw and without a cookie", async ({ actor, newUserSession }) => { const user = await actor("rawsign"); const request = (await newUserSession()).page.request; diff --git a/e2e/tests/foundation/node-plugins.spec.ts b/e2e/tests/foundation/node-plugins.spec.ts index b6b51dd061..4581683ecd 100644 --- a/e2e/tests/foundation/node-plugins.spec.ts +++ b/e2e/tests/foundation/node-plugins.spec.ts @@ -436,8 +436,8 @@ test.describe("node-service data source helpers", { tag: [TAGS.NODE_SERVICE] }, expect(nodePluginIdsOf([]), "an empty catalogue").toEqual([]); }); - test("NODE_PLUGIN_IDS lists 46 distinct ids, with the ids that differ from their folder names", () => { - expect(NODE_PLUGIN_IDS, "the registry size").toHaveLength(46); + test("NODE_PLUGIN_IDS lists 45 distinct ids, with the ids that differ from their folder names", () => { + expect(NODE_PLUGIN_IDS, "the registry size").toHaveLength(45); expect(new Set(NODE_PLUGIN_IDS).size, "distinct ids").toBe(NODE_PLUGIN_IDS.length); expect(NODE_PLUGIN_IDS, "ids that differ from their folder names").toEqual(expect.arrayContaining(["OpenAI", "oss", "firebird"])); expect(NODE_PLUGIN_IDS, "the Java-native graphql type is not a node plugin").not.toContain("graphql"); diff --git a/e2e/tests/foundation/security-helpers.spec.ts b/e2e/tests/foundation/security-helpers.spec.ts index 8426feae28..a3e139e86a 100644 --- a/e2e/tests/foundation/security-helpers.spec.ts +++ b/e2e/tests/foundation/security-helpers.spec.ts @@ -547,11 +547,8 @@ test.describe("security helpers: credentials and content", () => { expect((await apiRaw(outsider.request, "GET", bundleViewPath(bundleId))).code, "after public-to-all: an outsider views").toBe(API_OK); }); - // D-46 (SF-41): the 3.0.0 server recycles a bundle and then answers 500 / 5005. - test("a bundle recycle answers success (bundle recycle candidate)", { - tag: TAGS.QUARANTINE, - annotation: { type: "defect", description: "D-46" }, - }, async ({ actor }) => { + // D-46 (SF-41): the 3.0.0 server recycled a bundle and then answered 500 / 5005; this pins that a recycle answers success. + test("a bundle recycle answers success", async ({ actor }) => { const owner = await actor("owner"); const bundleId = await createBundle(owner.request, { orgId: owner.orgId, name: BUNDLE_NAME }); diff --git a/e2e/tests/foundation/security-quarantine.spec.ts b/e2e/tests/foundation/security-quarantine.spec.ts index 22d76f0e98..ee503f3815 100644 --- a/e2e/tests/foundation/security-quarantine.spec.ts +++ b/e2e/tests/foundation/security-quarantine.spec.ts @@ -13,11 +13,12 @@ import { lifecycleTestDetails, quarantinedDefect, securityCandidateDetails, + securityDetailsFor, securityTestDetails, } from "../../src/security/quarantine"; -/** Sizes of the two maps: no fixed-on-branch scenario (LC-AK04 left it: its UI test no longer reloads during the delete), and 4 open ones - * (3 security ids plus the lifecycle id LC-AU15). D-6, D-7, D-33 (CORS-credentials half), D-34, D-36, D-40, D-48, D-49, D-58 and D-62 left the map: their server fixes +/** Sizes of the two maps: no fixed-on-branch scenario (LC-AK04 left it: its UI test no longer reloads during the delete), and no open one + * (D-30 and D-13 left the maps by the owner's decisions: the join through a workspace's own page and the anonymous e-mail lookup are intended, so SEC-C17c, LC-AU15 and SEC-A10b pin them). D-6, D-7, D-33 (CORS-credentials half), D-34, D-36, D-40, D-48, D-49, D-58 and D-62 left the map: their server fixes * closed SEC-C09, SEC-C11, SEC-C19a, SEC-C19b, SEC-C22e, SEC-R15c, SEC-A04, SEC-A11, SEC-A12, SEC-E05, LC-PW08, LC-PW11, * LC-IP14, LC-PR13, LC-AU07 and LC-PR14. D-12 and D-39 also left the map: the fix closed SEC-A10a and SEC-A10c. D-35 also left the map: * the fix closed SEC-X01b and SEC-X01c. D-10 also left the map: the fix closed SEC-A09c. D-14 also left the map: the @@ -39,8 +40,8 @@ import { * LC-PW15 is no longer quarantined. D-63 also left the map: the profile now fetches the app list it counts, so * LC-OT02 is no longer quarantined. */ const FIXED_ON_BRANCH_COUNT = 0; -const OPEN_DEFECTS_COUNT = 4; -/** Lifecycle ids: LC-AU15 is in a map so far; the listed-id branches are also tested through an injected lookup. */ +const OPEN_DEFECTS_COUNT = 0; +/** Lifecycle ids: no lifecycle id is in a map any more; the listed-id branches are tested through an injected lookup. */ const LC_UNLISTED_ID = "LC-AU01"; const LC_INJECTED_ID = "LC-AK98"; const INJECTED_DEFECTS: Readonly> = { [LC_INJECTED_ID]: "D-45" }; @@ -52,8 +53,10 @@ const PASSING_ID = "SEC-C01a"; const LEFT_FIXED_LC_ID = "LC-AK04"; /** A scenario that left the quarantine on 3.0.1 (its test passes, so it is in neither map). */ const LEFT_QUARANTINE_ID = "SEC-C13"; -const OPEN_ID = "SEC-C17c"; -const OTHER_OPEN_ID = "SEC-R17f"; +/** An id listed by the injected lookup only: both maps are empty, so the listed-id branches are tested through it. */ +const SEC_INJECTED_ID = "SEC-A97a"; +const SEC_INJECTED_DEFECTS: Readonly> = { [SEC_INJECTED_ID]: "D-45" }; +const injectedSecurity = securityDetailsFor((id) => SEC_INJECTED_DEFECTS[id]); /** The title as Playwright matches `grep` / `grepInvert` against: the title followed by the tags of the test. */ function titleWithTags(id: string, tags: string[]): string { @@ -62,10 +65,11 @@ function titleWithTags(id: string, tags: string[]): string { test.describe("security quarantine list", () => { test("a listed id gets the security and quarantine tags and the defect annotation", () => { - expect(securityTestDetails(OPEN_ID), "an open-defect id").toEqual({ + expect(injectedSecurity.testDetails(SEC_INJECTED_ID), "an id the lookup lists").toEqual({ tag: [TAGS.SECURITY, TAGS.QUARANTINE], - annotation: { type: DEFECT_ANNOTATION_TYPE, description: OPEN_DEFECTS[OPEN_ID] }, + annotation: { type: DEFECT_ANNOTATION_TYPE, description: "D-45" }, }); + expect(securityTestDetails(SEC_INJECTED_ID), "the maps, not the injected lookup, decide in production").toEqual({ tag: [TAGS.SECURITY] }); }); test("an unlisted id gets @security only and no annotation", () => { @@ -78,7 +82,7 @@ test.describe("security quarantine list", () => { test("extra tags are appended after the quarantine tags; the P0 set passes TAGS.CORE", () => { expect(securityTestDetails(PASSING_ID, [TAGS.CORE]).tag).toEqual([TAGS.SECURITY, TAGS.CORE]); - expect(securityTestDetails(OPEN_ID, [TAGS.CORE]).tag).toEqual([TAGS.SECURITY, TAGS.QUARANTINE, TAGS.CORE]); + expect(injectedSecurity.testDetails(SEC_INJECTED_ID, [TAGS.CORE]).tag).toEqual([TAGS.SECURITY, TAGS.QUARANTINE, TAGS.CORE]); }); test("an id that is not a scenario id is refused, so a typo cannot leave a test unquarantined", () => { @@ -106,12 +110,12 @@ test.describe("security quarantine list", () => { test("quarantinedDefect names the defect of a listed id and nothing for an unlisted one", () => { expect(quarantinedDefect(LEFT_FIXED_LC_ID), "an id that left FIXED_ON_BRANCH").toBeUndefined(); - expect(quarantinedDefect(OPEN_ID)).toBe(OPEN_DEFECTS[OPEN_ID]); + expect(quarantinedDefect("SEC-A10b"), "an id that left OPEN_DEFECTS").toBeUndefined(); expect(quarantinedDefect(PASSING_ID)).toBeUndefined(); }); test("the default run leaves a quarantined security test out and E2E_INCLUDE_QUARANTINE brings it back", () => { - const quarantined = titleWithTags(OTHER_OPEN_ID, securityTestDetails(OTHER_OPEN_ID).tag); + const quarantined = titleWithTags(SEC_INJECTED_ID, injectedSecurity.testDetails(SEC_INJECTED_ID).tag); const passing = titleWithTags(PASSING_ID, securityTestDetails(PASSING_ID).tag); const defaultRun = grepInvertFor(runFlagsFromEnv({})); const withQuarantine = grepInvertFor(runFlagsFromEnv({ [RUN_FLAGS.INCLUDE_QUARANTINE]: "1" })); @@ -129,7 +133,7 @@ test.describe("security quarantine list", () => { expect(securityCandidateDetails("SEC-A98a", "x", [TAGS.CORE]).tag, "extra tags last").toEqual([TAGS.SECURITY, TAGS.QUARANTINE, TAGS.CORE]); expect(() => securityCandidateDetails("SEC-A02", "x"), "pattern needs two digits").not.toThrow(); expect(() => securityCandidateDetails("bad", "x")).toThrow(/is not a security scenario id/); - expect(() => securityCandidateDetails(OTHER_OPEN_ID, "x"), "an id of a map").toThrow(/quarantine map/); + expect(() => injectedSecurity.candidateDetails(SEC_INJECTED_ID, "x"), "a listed id").toThrow(/quarantine map/); expect(() => securityCandidateDetails("SEC-A98a", " "), "no measurement").toThrow(/names what was measured/); }); @@ -149,13 +153,9 @@ test.describe("security quarantine list", () => { expect(lifecycleTestDetails(LC_INJECTED_ID).tag, "the maps, not the injected lookup, decide in production").toEqual([TAGS.LIFECYCLE]); }); - test("a lifecycle id listed in a map gets its defect and the quarantine tag from the maps", () => { - expect(quarantinedDefect("LC-AU15")).toBe("D-30"); - expect(lifecycleTestDetails("LC-AU15")).toEqual({ - tag: [TAGS.LIFECYCLE, TAGS.QUARANTINE], - annotation: { type: DEFECT_ANNOTATION_TYPE, description: "D-30" }, - }); - expect(() => lifecycleCandidateDetails("LC-AU15", "x"), "a mapped id is no candidate").toThrow(/quarantine map/); + test("LC-AU15 left the maps: it carries the lifecycle tag only and no annotation", () => { + expect(quarantinedDefect("LC-AU15"), "no defect is listed for it").toBeUndefined(); + expect(lifecycleTestDetails("LC-AU15")).toEqual({ tag: [TAGS.LIFECYCLE] }); }); test("lifecycle extra tags are appended after the base and quarantine tags", () => { diff --git a/e2e/tests/security/bundles.spec.ts b/e2e/tests/security/bundles.spec.ts index e14efaa86a..8fe78d4d7b 100644 --- a/e2e/tests/security/bundles.spec.ts +++ b/e2e/tests/security/bundles.spec.ts @@ -25,6 +25,7 @@ import { bundlePermissionsPath, bundlePublishPath, bundleRecyclePath, + bundleRestorePath, bundleReorderPath, bundlePath, bundleViewPath, @@ -288,7 +289,7 @@ test.describe("security: bundles inside one workspace", () => { expectAnswer(recycled, API_ERRORS.NOT_AUTHORIZED, "the viewer's recycle"); expect(await inTrash(d.request, bundleId), "after: still not in the trash").toBe(false); expectAnswer(await apiRaw(d.request, "GET", bundleViewPath(bundleId)), OK, "and D still views it as a normal bundle"); - // The creator recycles (the 3.0.0 server answers 500 / 5005 after doing it: `recycleBundle` tolerates exactly that), so + // The creator recycles (`recycleBundle` also accepts the 500 / 5005 that the 3.0.0 server answers after doing it), so // the delete below passes the state check and the role decides. await recycleBundle(d.request, bundleId); expect(await inTrash(d.request, bundleId), "setup: the bundle is in the trash").toBe(true); @@ -305,11 +306,25 @@ test.describe("security: bundles inside one workspace", () => { const answer = await apiRaw(d.request, "PUT", bundleRecyclePath(bundleId)); - // Desired: success. The 3.0.0 server sets the status and then answers 500 / 5005 (SF-41); the read-back below holds on it too. + // Success. The 3.0.0 server set the status and then answered 500 / 5005 (SF-41, D-46); the recycle now answers success. expectAnswer(answer, OK, "the creator's recycle"); expect(await inTrash(d.request, bundleId), "after: the bundle is in the trash").toBe(true); }); + test("SEC-R17h a bundle's creator can restore it from the trash", securityTestDetails("SEC-R17h"), async ({ page, apiUser, actor }) => { + const { d, bundleId } = await developerBundle(page, apiUser, actor); + expectAnswer(await apiRaw(d.request, "PUT", bundleRecyclePath(bundleId)), OK, "setup: the creator recycles the bundle"); + expect(await inTrash(d.request, bundleId), "before: the bundle is in the trash").toBe(true); + + const answer = await apiRaw(d.request, "PUT", bundleRestorePath(bundleId)); + + // Success. The restore published its event through a lookup that treats the id as an application and answered + // 500 / 5005 after writing the status (the recycle's defect, D-46); it now answers success. + expectAnswer(answer, OK, "the creator's restore"); + expect(await inTrash(d.request, bundleId), "after: the bundle is out of the trash").toBe(false); + expectAnswer(await apiRaw(d.request, "GET", bundleViewPath(bundleId)), OK, "and the creator views it as a normal bundle again"); + }); + test("SEC-R17e a bundle editor cannot grant the owner role", securityTestDetails("SEC-R17e"), async ({ page, apiUser, actor }) => { const { a, d, bundleId } = await developerBundle(page, apiUser, actor); const e2 = await memberOf(a, actor, "editor2"); diff --git a/e2e/tests/security/cross-org.spec.ts b/e2e/tests/security/cross-org.spec.ts index 3abd7b8892..f0211c0b2d 100644 --- a/e2e/tests/security/cross-org.spec.ts +++ b/e2e/tests/security/cross-org.spec.ts @@ -96,7 +96,7 @@ import { type SeededApp, } from "../../src/security/actors"; import { expectAnswer, expectDeniedAs } from "../../src/security/assertions"; -import { permissionIdOf } from "../../src/security/scene"; +import { permissionIdOf, roleOf } from "../../src/security/scene"; import { securityTestDetails } from "../../src/security/quarantine"; /** @@ -601,22 +601,28 @@ test.describe("security: another workspace's resources (further rows)", () => { expectAnswer(await apiRaw(b.request, "GET", orgMembersPath(a.orgId)), API_ERRORS.NOT_AUTHORIZED, "B is not a member of OA"); }); - test("SEC-C17c signing in through another workspace's login does not make an outsider a member", securityTestDetails("SEC-C17c"), async ({ page, apiUser, actor }) => { + // By design (owner decision, D-30): anyone who knows a workspace's id joins it by signing in on that workspace's own page. + test("SEC-C17c signing in through another workspace's login makes the outsider a plain member and switches to that workspace (pin)", securityTestDetails("SEC-C17c"), async ({ page, apiUser, actor }) => { const { a, b } = await sceneOf(page, apiUser, actor); expectAnswer(await apiRaw(b.request, "GET", orgMembersPath(a.orgId)), API_ERRORS.NOT_AUTHORIZED, "before: B is no member of OA"); + expect(await roleOf(a, b.userId), "before: B holds no role in OA").toBeUndefined(); + expect((await currentUser(b.request)).currentOrgId, "before: B's current workspace is its own").toBe(b.orgId); const login = await apiRaw(b.request, "POST", API_PATHS.LOGIN, { params: { orgId: a.orgId }, data: { loginId: b.email, password: TEST_PASSWORD, register: false, source: AUTH_SOURCE_EMAIL, authId: AUTH_ID_EMAIL }, }); - // The sign-in itself must succeed (valid credentials), or the denial below would hold for an unrelated failure. - // Limit: whether B is thereby in OA is exactly what the last assertion decides, so it is not asserted before. + // The sign-in itself succeeds (valid credentials); the join below is the decided behaviour, not a side effect of a failure. expectAnswer(login, OK, "B's sign-in through the workspace login of OA"); - expectAnswer(await apiRaw(b.request, "GET", orgMembersPath(a.orgId)), API_ERRORS.NOT_AUTHORIZED, "after: B still reads no member list of OA"); + expect(await roleOf(a, b.userId), "after: B is a plain member of OA").toBe(ORG_ROLES.MEMBER); + expectAnswer(await apiRaw(b.request, "GET", orgMembersPath(a.orgId)), OK, "after: B reads the member list of OA"); + const me = await currentUser(b.request); + expect(me.currentOrgId, "after: OA is B's current workspace").toBe(a.orgId); + expect(me.orgAndRoles.map((entry) => entry.org.id), "after: B still belongs to its own workspace").toContain(b.orgId); }); - test("SEC-C17c UI variant: a signed-out outsider who signs in on another workspace's page is not shown that workspace", securityTestDetails("SEC-C17c"), async ({ page, apiUser, actor, newUserSession }) => { + test("SEC-C17c UI variant: an outsider who signs in on another workspace's page lands in that workspace (pin)", securityTestDetails("SEC-C17c"), async ({ page, apiUser, actor, newUserSession }) => { const { a, b, seeded } = await sceneOf(page, apiUser, actor); await createApp(b.request, { orgId: b.orgId, name: OUTSIDER_APP_NAME }); const outsiderList = new AppListPage(b.session.page); @@ -631,12 +637,17 @@ test.describe("security: another workspace's resources (further rows)", () => { await expect(visitor.page, "the sign-in on the workspace page succeeded").not.toHaveURL(UI_PATHS.LOGIN); await expect(visitor.page, "and left the workspace sign-in").not.toHaveURL(UI_PATHS.LOGIN_IN_ORG); + await expect + .poll(async () => (await currentUser(visitor.page.request)).currentOrgId, { message: "the sign-in switched B's current workspace to OA" }) + .toBe(a.orgId); const list = new AppListPage(visitor.page); await list.open(); - // The list is awaited through B's own OB app first, so the absence below is not read during page load. - await expect(list.appNamed(OUTSIDER_APP_NAME), "after: B's /apps still lists the app of OB").toBeVisible(); - await expect(list.appNamed(SEEDED_APP_NAME), "after: B's /apps does not list OA's app").toHaveCount(0); - expect(await listOrgMembers(a.request, a.orgId).then((members) => members.map((member) => member.userId)), "B is no member of OA").not.toContain(b.userId); + // The list is awaited through its title first, so the absence below is not read during page load. + await expect(list.title, "the app list of OA has loaded").toBeVisible(); + await expect(list.appNamed(OUTSIDER_APP_NAME), "after: B's /apps no longer lists the app of OB, OA is current").toHaveCount(0); + // OA's seeded app is private: a plain member does not see it, so it is not asserted as listed. + await expect(list.appNamed(SEEDED_APP_NAME), "after: B's /apps does not list OA's private app").toHaveCount(0); + expect(await roleOf(a, b.userId), "B is a plain member of OA").toBe(ORG_ROLES.MEMBER); }); test("SEC-C18a another workspace's group members cannot be listed", securityTestDetails("SEC-C18a"), async ({ page, apiUser, actor }) => { diff --git a/e2e/tests/security/membership-changes.spec.ts b/e2e/tests/security/membership-changes.spec.ts index 48198062fb..6a714a285a 100644 --- a/e2e/tests/security/membership-changes.spec.ts +++ b/e2e/tests/security/membership-changes.spec.ts @@ -82,7 +82,7 @@ test.describe("security: rights that change while a session is open", () => { await expect(view.buttonByTestId(SEEDED_BUTTON_TEST_ID), "and no app").toHaveCount(0); }); - test("SEC-R11b a developer removed from the workspace cannot open the editing view of the app it created", securityTestDetails("SEC-R11b"), async ({ page, apiUser, actor }, testInfo) => { + test("SEC-R11b a developer removed from the workspace cannot open the editing view of the app it created", securityTestDetails("SEC-R11b"), async ({ page, apiUser, actor }) => { const { a } = await sceneOf(page, apiUser); const d = await memberOf(a, actor, "developer"); await makeDeveloper(a, d); @@ -91,17 +91,11 @@ test.describe("security: rights that change while a session is open", () => { await removeOrgMember(a.request, a.orgId, d.userId); - // READ of the app stays allowed by the creator-shortcut (commit c377186ad), an unrevoked mechanism separate from - // the member-leave clean-up's stored-row deletion (README D-26 and D-60 residuals); the editing view - // is EDIT and must not be. LC-DL13 (quarantined candidate) asserts the denial this leaves open. + // READ of the app stays allowed through the creator's permanent `createdBy` right (owner decision 2026-11-26: it marks the + // ownership of the app and cannot be changed; LC-DL13 pins it after a rejoin too); the right is READ only, so the editing + // view is denied. const removedView = await apiRaw(d.request, "GET", appViewPath(appId)); - expectAnswer(removedView, ALLOWED, "the removed creator's published view (creator-shortcut VIEWER row)"); - if (removedView.status === ALLOWED.status && removedView.code === ALLOWED.code) { - testInfo.annotations.push({ - type: "defect", - description: "D-26 residual, LC-DL13 candidate: the removed creator's published view stays allowed through the creator-shortcut VIEWER row", - }); - } + expectAnswer(removedView, ALLOWED, "the removed creator's published view (the creator right)"); expectAnswer(await apiRaw(d.request, "GET", applicationPath(appId)), API_ERRORS.NO_PERMISSION_TO_REQUEST_APP, "the removed creator's editing view"); }); diff --git a/e2e/tests/security/public-leakage.spec.ts b/e2e/tests/security/public-leakage.spec.ts index 883d569f85..225ed5aa8a 100644 --- a/e2e/tests/security/public-leakage.spec.ts +++ b/e2e/tests/security/public-leakage.spec.ts @@ -1,4 +1,4 @@ -import { apiRaw, getApp, setPublicToAll, updateApp } from "../../src/api/client"; +import { apiRaw, currentUser, getApp, setPublicToAll, updateApp } from "../../src/api/client"; import { API_ERRORS, API_OK, @@ -8,6 +8,7 @@ import { PRODUCTS, appViewPath, orgCommonSettingsPath, + orgUpdatePath, orgsByUserPath, } from "../../src/constants"; import { SELECT_PRODUCTS_SQL, selectProductsQuery } from "../../src/datasource/notes-queries"; @@ -37,6 +38,10 @@ const DRAFT_QUERY_ID = "q2"; const DRAFT_QUERY_NAME = "draftOnly"; const DRAFT_QUERY_SQL = "SELECT 'e2e-sec-draft-only' AS marker"; /** The top-level keys of a published view answer's `data` (measured on 3.0.0). */ +/** The workspace name SEC-A10b sets, so the name does not hold the address of its creator (a default name does). */ +const NEUTRAL_WORKSPACE_NAME = "e2e-neutral-workspace"; +/** The shared paged envelope of the anonymous e-mail lookup, sorted: `total` counts the listed workspaces. */ +const LOOKUP_ENVELOPE_KEYS = ["code", "data", "message", "pageNum", "pageSize", "success", "total"]; const VIEW_DATA_KEYS = ["applicationDSL", "applicationInfoView", "moduleDSL", "orgCommonSettings", "templateId"]; /** A key of the public view that would reveal a person or a connection. */ const SENSITIVE_KEY = /mail|datasource|password|secret|token/i; @@ -161,16 +166,28 @@ test.describe("security: routes that need no session", () => { expect(answer.body, "no user name in the answer").not.toContain(a.email); }); - test("SEC-A10b an anonymous caller cannot learn which workspaces an e-mail address belongs to", securityTestDetails("SEC-A10b"), async ({ page, apiUser, newUserSession }) => { + test("SEC-A10b the anonymous e-mail lookup answers per workspace its id and name only, in the shared paged envelope (pin)", securityTestDetails("SEC-A10b"), async ({ page, apiUser, newUserSession }) => { const { a } = await sceneOf(page, apiUser); const anonymous = (await newUserSession()).page.request; + expectAnswer(await apiRaw(a.request, "PUT", orgUpdatePath(a.orgId), { data: { orgName: NEUTRAL_WORKSPACE_NAME } }), ALLOWED, "setup: A renames its workspace, so the name does not hold A's address"); + expect((await currentUser(a.request)).orgAndRoles.find((entry) => entry.org.id === a.orgId)?.org.name, "setup: the new name is stored").toBe(NEUTRAL_WORKSPACE_NAME); expect((await apiRaw(a.request, "GET", orgsByUserPath(a.email))).body, "before: the lookup works and names A's workspace for a signed-in caller").toContain(a.orgId); const answer = await apiRaw(anonymous, "GET", orgsByUserPath(a.email)); - // This row has no single desired answer, only "no org ids": it asserts the absence, after the signed-in - // control above proved the lookup itself works. - expect(answer.body, "no workspace id of A in the answer").not.toContain(a.orgId); + // The lookup stays open by the owner's decision (2026-11-26): the sign-in and sign-up pages need it to offer the login + // variants of a workspace. What is pinned is that each entry holds the id and the name the pages read, and nothing else. + expectAnswer(answer, ALLOWED, "the anonymous lookup"); + const body = answer.json as Record; + expect(Object.keys(body).sort(), "the shared paged envelope, nothing more").toEqual(LOOKUP_ENVELOPE_KEYS); + expect(body.data, "per workspace its id and name, exactly (no creation or update time)").toEqual([{ orgId: a.orgId, orgName: NEUTRAL_WORKSPACE_NAME }]); + expect(body.total, "the count of the listed workspaces").toBe(1); + expect(answer.body, "no address of A in the answer").not.toContain(a.email); + expect(answer.body, "no user id of A in the answer").not.toContain(a.userId); + + const unknown = await apiRaw(anonymous, "GET", orgsByUserPath(`e2e-nobody-${Date.now()}@example.test`)); + expectAnswer(unknown, ALLOWED, "the lookup of an address nobody signed up with"); + expect({ data: (unknown.json as { data: unknown }).data, total: (unknown.json as { total: unknown }).total }, "answers no workspace").toEqual({ data: [], total: 0 }); }); test("SEC-A10c the metrics endpoint is not open to an anonymous caller", securityTestDetails("SEC-A10c"), async ({ page, apiUser, newUserSession }) => { diff --git a/e2e/tests/workspace/leave-removal.spec.ts b/e2e/tests/workspace/leave-removal.spec.ts index fdccbddfdf..8e60633036 100644 --- a/e2e/tests/workspace/leave-removal.spec.ts +++ b/e2e/tests/workspace/leave-removal.spec.ts @@ -25,6 +25,7 @@ import { listFolderPermissions, listGroupMembers, listGroups, + listOrgMembers, removeOrgMember, signInRaw, switchOrganization, @@ -35,7 +36,10 @@ import { API_OK, API_PATHS, MEMBERSHIP_CLEANUP_TIMEOUT_MS, + ORG_ROLES, TEST_PASSWORD, + appPermissionsPath, + bundlePermissionsPath, groupMembersPath, UI_PATHS, } from "../../src/constants"; @@ -44,15 +48,17 @@ import { AuthPage } from "../../src/pages/AuthPage"; import { LoginPage } from "../../src/pages/LoginPage"; import { joinWorkspace, makeDeveloper, seedPrivateApp, type Actor } from "../../src/security/actors"; import { expectAnswer } from "../../src/security/assertions"; -import { lifecycleCandidateDetails, lifecycleTestDetails } from "../../src/security/quarantine"; +import { lifecycleTestDetails } from "../../src/security/quarantine"; /** * What a removal, a leave and a workspace deletion do to a user's data (LC-DL01 to LC-DL15). 3.0.0 has no account deletion * in SAAS mode, so there is none to test: a removal deletes the membership only. Every "row gone" check polls (the clean-up * is a listener on its own scheduler) and first asserts the row was there. Covered elsewhere: API keys of a removed member * (SEC-A02b), the removed member's open session (SEC-R11a), a removed creator's editing view (SEC-R11b), ENTERPRISE - * deactivation (SEC-E02 to E04). LC-DL13 to LC-DL15 are quarantined candidates for the creator (`createdBy`) shortcut - * that mechanism 1's cleanup does not revoke (README D-26 and D-60 residuals). + * deactivation (SEC-E02 to E04). The creator's (`createdBy`) right is permanent by design (owner decision 2026-11-26: it marks + * the ownership of an object and cannot be transferred or changed): the removal's clean-up deletes the creator's owner row but + * not that right, so a removed or rejoined creator still reads its app and bundle and manages its folder again; LC-DL13 to + * LC-DL15 pin it, with controls that rule out every other source of the access. */ const OK = { status: 200, code: API_OK } as const; @@ -77,6 +83,50 @@ async function isInAnyGroup(owner: Actor, userId: string): Promise { return false; } +const NO_PUBLIC_ACCESS = { publicToAll: false, publicToMarketplace: false, agencyProfile: false } as const; + +/** + * The public flags of an app's or bundle's permission answer, read from the raw body: the e2e `PermissionView` type declares only + * `publicToAll`. A missing key is `undefined`, which fails the comparison with `false` instead of passing as "no grant". + */ +async function publicFlags(owner: Actor, permissionsPath: string): Promise> { + const answer = await apiRaw(owner.request, "GET", permissionsPath); + expectAnswer(answer, OK, `the permission list at ${permissionsPath}`); + const data = (answer.json as { data: Record }).data; + return { publicToAll: data.publicToAll, publicToMarketplace: data.publicToMarketplace, agencyProfile: data.agencyProfile }; +} + +async function workspaceRoleOf(owner: Actor, userId: string): Promise { + return (await listOrgMembers(owner.request, owner.orgId)).find((member) => member.userId === userId)?.role; +} + +type CreatorResource = { permissionsPath: string; list: () => Promise<{ groupPermissions: { id: string }[] }>; hasUserRow: () => Promise }; + +/** + * Before the removal: the creator is in a group that holds a VIEWER grant on the resource (the control below must be able to see + * it), and the public flags are present as booleans. + */ +async function expectGroupGrantVisible(owner: Actor, resource: CreatorResource, groupId: string, userId: string): Promise { + expect((await resource.list()).groupPermissions.map((row) => row.id), "setup: the resource lists the group grant").toContain(groupId); + expect(await isInGroup(owner, groupId, userId), "setup: the creator is in the granted group").toBe(true); + expect(await publicFlags(owner, resource.permissionsPath), "setup: the public flags are present and off").toEqual(NO_PUBLIC_ACCESS); +} + +/** + * After the rejoin, nothing but the creator right is left to grant access: the creator is a plain member (not an admin), holds + * no user row, is in none of the groups the resource lists (the grant of the group stays listed), and no public flag is set. + */ +async function expectOnlyCreatorRight(owner: Actor, resource: CreatorResource, groupId: string, creator: Actor): Promise { + expect(await workspaceRoleOf(owner, creator.userId), "the rejoined creator is a plain member").toBe(ORG_ROLES.MEMBER); + await expect.poll(resource.hasUserRow, { message: "the rejoined creator holds no user row", ...POLL }).toBe(false); + const listed = (await resource.list()).groupPermissions.map((row) => row.id); + expect(listed, "the group grant is still listed").toContain(groupId); + for (const listedGroup of listed) { + expect(await isInGroup(owner, listedGroup, creator.userId), `the rejoined creator is not in the listed group ${listedGroup}`).toBe(false); + } + expect(await publicFlags(owner, resource.permissionsPath), "no public flag grants the access").toEqual(NO_PUBLIC_ACCESS); +} + /** * The user rejoins the owner's workspace with a new invitation and makes it its current one. It first waits until the removal's * clean-up has taken the user out of every group: an invitation accepted while the listener is still deleting rows answered @@ -317,33 +367,41 @@ test.describe("lifecycle: leaving, removal and deletion", () => { expect({ status: elements.status, code: elements.code }, "the rejoined member's bundle elements read").toEqual(API_ERRORS.NO_PERMISSION_TO_REQUEST_APP); }); - test("LC-DL13 an app created by a removed developer is not readable by it, neither while removed nor after a rejoin (creator-shortcut candidate)", lifecycleCandidateDetails( - "LC-DL13", - "the removed creator's published view answers 200 (SEC-R11b, membership-changes.spec.ts:95, the creator-shortcut VIEWER row)", - ), async ({ actor }) => { + test("LC-DL13 an app's creator keeps viewing it after its removal and after a rejoin, without its owner row (pin)", lifecycleTestDetails("LC-DL13"), async ({ actor }) => { const admin = await actor("dlowner"); const developer = await actor("dldeveloper"); await joinWorkspace(admin, developer); await makeDeveloper(admin, developer); - const name = `dl-dev-app-lc13-${Date.now()}`; - const { appId } = await createApp(developer.request, { orgId: admin.orgId, name }); - expect(await hasAppRow(admin, appId, developer.userId), "setup: the developer owns the app").toBe(true); + const { appId } = await createApp(developer.request, { orgId: admin.orgId, name: `dl-dev-app-lc13-${Date.now()}` }); + const resource: CreatorResource = { + permissionsPath: appPermissionsPath(appId), + list: () => listAppPermissions(admin.request, appId), + hasUserRow: () => hasAppRow(admin, appId, developer.userId), + }; + expect(await resource.hasUserRow(), "setup: the developer owns the app").toBe(true); expect(await viewAppRaw(developer.request, appId), "setup: the creator views the app").toEqual(OK); + const groupId = await createGroup(admin.request, "dl-app-lc13-group"); + await addGroupMember(admin.request, groupId, developer.userId, "member"); + await grantAppPermission(admin.request, appId, { role: "viewer", userIds: [], groupIds: [groupId] }); + await expectGroupGrantVisible(admin, resource, groupId, developer.userId); await removeOrgMember(admin.request, admin.orgId, developer.userId); - await expect.poll(() => hasAppRow(admin, appId, developer.userId), { message: "control: the creator's owner row is deleted", ...POLL }).toBe(false); + await expect.poll(resource.hasUserRow, { message: "control: the creator's owner row is deleted", ...POLL }).toBe(false); + await expect.poll(() => isInGroup(admin, groupId, developer.userId), { message: "control: the creator left the granted group", ...POLL }).toBe(false); const removedView = await viewAppRaw(developer.request, appId); - expect({ status: removedView.status, code: removedView.code }, "the removed creator's view (desired: denied like any other removed member, SEC-R11a)").toEqual(API_ERRORS.NO_PERMISSION_TO_REQUEST_APP); + expect({ status: removedView.status, code: removedView.code }, "the removed creator's view (allowed: the creator right)").toEqual(OK); + const removedEdit = await editAppRaw(developer.request, appId); + expect({ status: removedEdit.status, code: removedEdit.code }, "the removed creator's editing view (denied: the right is READ only)").toEqual(API_ERRORS.NO_PERMISSION_TO_REQUEST_APP); await rejoin(admin, developer); + await expectOnlyCreatorRight(admin, resource, groupId, developer); const rejoinedView = await viewAppRaw(developer.request, appId); - expect({ status: rejoinedView.status, code: rejoinedView.code }, "the rejoined creator's view (desired: denied like a rejoined member, LC-DL02)").toEqual(API_ERRORS.NO_PERMISSION_TO_REQUEST_APP); + expect({ status: rejoinedView.status, code: rejoinedView.code }, "the rejoined creator's view (allowed: the creator right)").toEqual(OK); + const rejoinedEdit = await editAppRaw(developer.request, appId); + expect({ status: rejoinedEdit.status, code: rejoinedEdit.code }, "the rejoined creator's editing view (denied)").toEqual(API_ERRORS.NO_PERMISSION_TO_REQUEST_APP); }); - test("LC-DL14 a folder created by a removed developer is not manageable by it after a rejoin (creator-shortcut candidate)", lifecycleCandidateDetails( - "LC-DL14", - "the rejoined creator's rename answers 200 again (checkManagePermissionInCurrentOrg matches createdBy against the current org member once more)", - ), async ({ actor }) => { + test("LC-DL14 a folder's creator manages it again after a rejoin (pin)", lifecycleTestDetails("LC-DL14"), async ({ actor }) => { const admin = await actor("dlowner"); const developer = await actor("dldeveloper"); await joinWorkspace(admin, developer); @@ -352,10 +410,15 @@ test.describe("lifecycle: leaving, removal and deletion", () => { const folderId = await createFolder(developer.request, originalName); const probeName = "dl-folder-lc14-probe-9f3c"; const renameAs = (actor: Actor, name: string) => apiRaw(actor.request, "PUT", API_PATHS.FOLDERS, { data: { id: folderId, name } }); - const rootListing = async (): Promise => (await apiRaw(admin.request, "GET", API_PATHS.FOLDER_ELEMENTS)).body; + // By exact name of the folder's own row: the probe name starts with the original one, so a substring check cannot tell them apart. + const nameInRoot = async (): Promise => { + const root = await apiRaw(admin.request, "GET", API_PATHS.FOLDER_ELEMENTS); + expectAnswer(root, OK, "the admin lists its root"); + return (root.json as { data: { folderId?: string; name?: string }[] }).data.find((row) => row.folderId === folderId)?.name; + }; expectAnswer(await renameAs(developer, probeName), OK, "setup: the creator renames its own folder"); expectAnswer(await renameAs(developer, originalName), OK, "setup: rename back to the original name, so the control below has something to detect"); - expect(await rootListing(), "setup: the root listing holds the original name").toContain(originalName); + expect(await nameInRoot(), "setup: the folder's row holds the original name").toBe(originalName); const groupId = await createGroup(admin.request, "dl-folder-lc14-group"); await addGroupMember(admin.request, groupId, developer.userId, "member"); @@ -363,34 +426,41 @@ test.describe("lifecycle: leaving, removal and deletion", () => { await expect.poll(() => isInGroup(admin, groupId, developer.userId), { message: "control: the clean-up ran (the creator left its group)", ...POLL }).toBe(false); await rejoin(admin, developer); + expect(await workspaceRoleOf(admin, developer.userId), "the rejoined creator is a plain member, not an admin").toBe(ORG_ROLES.MEMBER); + expect((await listFolderPermissions(admin.request, folderId)).userPermissions.some((row) => row.id === developer.userId), "and holds no user row on the folder").toBe(false); const rejoinedRename = await renameAs(developer, probeName); - expect({ status: rejoinedRename.status, code: rejoinedRename.code }, "the rejoined creator's rename (desired: refused, like any other non-creator developer, SEC-R15b)").toEqual(API_ERRORS.FOLDER_OPERATE_NO_PERMISSION); - const after = await rootListing(); - expect(after, "the admin's folder listing still shows the old name").toContain(originalName); - expect(after, "and not the rejoined creator's attempted rename").not.toContain(probeName); + expect({ status: rejoinedRename.status, code: rejoinedRename.code }, "the rejoined creator's rename (allowed: the creator right, in its current workspace)").toEqual(OK); + expect(await nameInRoot(), "the folder's row carries the rejoined creator's name").toBe(probeName); }); - test("LC-DL15 a bundle created by a removed developer is not readable by it, neither while removed nor after a rejoin (creator-shortcut candidate)", lifecycleCandidateDetails( - "LC-DL15", - "the removed/rejoined creator's bundleElementsRaw answers 200 through the creator-shortcut VIEWER row, same mechanism as LC-DL13's app case and SEC-R11b; expected to deny with NO_PERMISSION_TO_REQUEST_APP by the same code path LC-DL12 measures for a non-creator bundle grant (SEC-C23a, tests/security/bundles.spec.ts:86), not yet run against the fixed image, deferred to the combined final run", - ), async ({ actor }) => { + test("LC-DL15 a bundle's creator keeps reading its elements after its removal and after a rejoin, without its owner row (pin)", lifecycleTestDetails("LC-DL15"), async ({ actor }) => { const admin = await actor("dlowner"); const developer = await actor("dldeveloper"); await joinWorkspace(admin, developer); await makeDeveloper(admin, developer); const bundleId = await createBundle(developer.request, { orgId: admin.orgId, name: `dl-dev-bundle-lc15-${Date.now()}` }); - const hasRow = async (): Promise => (await listBundlePermissions(admin.request, bundleId)).userPermissions.some((row) => row.id === developer.userId); - expect(await hasRow(), "setup: the developer owns the bundle").toBe(true); + const resource: CreatorResource = { + permissionsPath: bundlePermissionsPath(bundleId), + list: () => listBundlePermissions(admin.request, bundleId), + hasUserRow: async () => (await listBundlePermissions(admin.request, bundleId)).userPermissions.some((row) => row.id === developer.userId), + }; + expect(await resource.hasUserRow(), "setup: the developer owns the bundle").toBe(true); expect((await bundleElementsRaw(developer.request, bundleId)).status, "setup: the creator reads the bundle's elements").toBe(200); + const groupId = await createGroup(admin.request, "dl-bundle-lc15-group"); + await addGroupMember(admin.request, groupId, developer.userId, "member"); + await grantBundlePermission(admin.request, bundleId, { role: "viewer", groupIds: [groupId] }); + await expectGroupGrantVisible(admin, resource, groupId, developer.userId); await removeOrgMember(admin.request, admin.orgId, developer.userId); - await expect.poll(hasRow, { message: "control: the creator's owner row is deleted", ...POLL }).toBe(false); + await expect.poll(resource.hasUserRow, { message: "control: the creator's owner row is deleted", ...POLL }).toBe(false); + await expect.poll(() => isInGroup(admin, groupId, developer.userId), { message: "control: the creator left the granted group", ...POLL }).toBe(false); const removedElements = await bundleElementsRaw(developer.request, bundleId); - expect({ status: removedElements.status, code: removedElements.code }, "the removed creator's bundle elements (desired: denied)").toEqual(API_ERRORS.NO_PERMISSION_TO_REQUEST_APP); + expect({ status: removedElements.status, code: removedElements.code }, "the removed creator's bundle elements (allowed: the creator right)").toEqual(OK); await rejoin(admin, developer); + await expectOnlyCreatorRight(admin, resource, groupId, developer); const rejoinedElements = await bundleElementsRaw(developer.request, bundleId); - expect({ status: rejoinedElements.status, code: rejoinedElements.code }, "the rejoined creator's bundle elements (desired: denied)").toEqual(API_ERRORS.NO_PERMISSION_TO_REQUEST_APP); + expect({ status: rejoinedElements.status, code: rejoinedElements.code }, "the rejoined creator's bundle elements (allowed: the creator right)").toEqual(OK); }); }); diff --git a/release/3.0.0/release-notes.md b/release/3.0.0/release-notes.md index 2fc0209ad5..2ab9d5a1f7 100644 --- a/release/3.0.0/release-notes.md +++ b/release/3.0.0/release-notes.md @@ -152,6 +152,8 @@ The community work spans **data access, prepared queries, forms, dates, tables, - Correct datasource access-control behavior. [#2133](https://github.com/lowcoder-org/lowcoder/issues/2133) - Fix execution of JavaScript Prepared Data Queries. [#2177](https://github.com/lowcoder-org/lowcoder/issues/2177) +- Remove the 25 AWS AppConfig query actions that never did anything. A saved query that still uses one now fails with "invalid query dsl, the action name `` not defined in plugin" instead of succeeding with empty data. +- Return DuckDB query rows as objects keyed by column name. Positional keys such as "0" and "1" are gone, so bindings like {{query.data[0]["0"]}} must use the column name. ### Forms and dates diff --git a/server/api-service/lowcoder-coverage-report/coverage-gate.xml b/server/api-service/lowcoder-coverage-report/coverage-gate.xml index 2e114a352e..fb792eff4f 100644 --- a/server/api-service/lowcoder-coverage-report/coverage-gate.xml +++ b/server/api-service/lowcoder-coverage-report/coverage-gate.xml @@ -9,7 +9,8 @@ - Executed, not asserted: it counts what the tests ran, not what they asserted. - Credit across modules: a module is credited with the tests of any module (the aggregate's data). - Timing: coverage that depends on wall-clock time can make a figure move between builds. - - Local builds only: it runs only where `mvn verify` runs; no CI job runs it (owner decision D-7, 2026-10-04). + - It runs wherever `mvn verify` runs: locally and in the SonarCloud Build workflow, which also feeds the aggregate + report to Sonar. The CodeQL workflow builds with -DskipTests and never reaches it. - Clean builds only: JaCoCo appends to an existing jacoco.exec and the gate reads whatever is in target/, so its figures are meaningful only for `mvn -B clean verify`. The data files it read are listed, with their times on Linux only (GNU ls); elsewhere only their names are listed. diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/ClientBasedConnectionPool.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/ClientBasedConnectionPool.java index 6cd3a96c57..ba11863653 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/ClientBasedConnectionPool.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/ClientBasedConnectionPool.java @@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Strings; import org.lowcoder.domain.datasource.model.ClientBasedDatasourceConnectionHolder; import org.lowcoder.domain.datasource.model.Datasource; import org.lowcoder.domain.datasource.model.DatasourceConnectionHolder; @@ -86,7 +87,7 @@ public void init() { perfHelper.gaugeSafely(perfEvent, Tags.of("datasourceType", datasourceType), HIKARI_PERF_WRAPPER_MAP, perfWrapperMap -> perfWrapperMap.entrySet() .stream() - .filter(entry -> StringUtils.equals(entry.getKey().datasource().getType(), datasourceType)) + .filter(entry -> Strings.CS.equals(entry.getKey().datasource().getType(), datasourceType)) .map(Entry::getValue) .mapToInt(hikariPerfWrapper -> switch (perfEvent) { case HIKARI_POOL_ACTIVE_CONNECTIONS -> hikariPerfWrapper.getActiveConnections(); @@ -161,7 +162,7 @@ private void forgetFailedCreation(ClientBasedDatasourceCacheKey key, Mono StringUtils.equals(datasource.getId(), cacheKey.datasource().getId())) + .filter(cacheKey -> Strings.CS.equals(datasource.getId(), cacheKey.datasource().getId())) .forEach(cache::invalidate); } diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/DatasourceServiceImpl.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/DatasourceServiceImpl.java index 5e2c17b654..0b7b2e3342 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/DatasourceServiceImpl.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/DatasourceServiceImpl.java @@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Strings; import org.lowcoder.domain.application.model.ApplicationStatus; import org.lowcoder.domain.application.repository.ApplicationRepository; import org.lowcoder.domain.datasource.model.Datasource; @@ -86,15 +87,15 @@ public Mono update(String datasourceId, Datasource updatedDatasource @Override public Mono getById(String id) { - if (StringUtils.equals(id, Datasource.QUICK_REST_API_ID)) { + if (Strings.CS.equals(id, Datasource.QUICK_REST_API_ID)) { return Mono.just(Datasource.QUICK_REST_API); } - if (StringUtils.equals(id, Datasource.QUICK_GRAPHQL_ID)) { + if (Strings.CS.equals(id, Datasource.QUICK_GRAPHQL_ID)) { return Mono.just(Datasource.QUICK_GRAPHQL_API); } - if (StringUtils.equals(id, Datasource.JS_CODE_ID)) { + if (Strings.CS.equals(id, Datasource.JS_CODE_ID)) { return Mono.just(Datasource.JS_CODE); } @@ -109,19 +110,19 @@ public Mono getById(String id) { public Flux getByIds(Collection ids) { Flux builtDatasourceFlux = Flux.fromStream(ids.stream() .filter(id -> - StringUtils.equals(id, Datasource.QUICK_REST_API_ID) || - StringUtils.equals(id, Datasource.QUICK_GRAPHQL_ID) || - StringUtils.equals(id, Datasource.JS_CODE_ID) + Strings.CS.equals(id, Datasource.QUICK_REST_API_ID) || + Strings.CS.equals(id, Datasource.QUICK_GRAPHQL_ID) || + Strings.CS.equals(id, Datasource.JS_CODE_ID) // || StringUtils.equals(id, Datasource.LOWCODER_API_ID) ) .map(id -> { - if (StringUtils.equals(id, Datasource.QUICK_REST_API_ID)) { + if (Strings.CS.equals(id, Datasource.QUICK_REST_API_ID)) { return Datasource.QUICK_REST_API; } - if (StringUtils.equals(id, Datasource.QUICK_GRAPHQL_ID)) { + if (Strings.CS.equals(id, Datasource.QUICK_GRAPHQL_ID)) { return Datasource.QUICK_GRAPHQL_API; } - if (StringUtils.equals(id, Datasource.JS_CODE_ID)) { + if (Strings.CS.equals(id, Datasource.JS_CODE_ID)) { return Datasource.JS_CODE; } return null; // fallback @@ -132,9 +133,9 @@ public Flux getByIds(Collection ids) { return Flux.concat( builtDatasourceFlux, repository.findByIds(ids.stream().filter(id -> - !(StringUtils.equals(id, Datasource.QUICK_REST_API_ID) || - StringUtils.equals(id, Datasource.QUICK_GRAPHQL_ID) || - StringUtils.equals(id, Datasource.JS_CODE_ID) + !(Strings.CS.equals(id, Datasource.QUICK_REST_API_ID) || + Strings.CS.equals(id, Datasource.QUICK_GRAPHQL_ID) || + Strings.CS.equals(id, Datasource.JS_CODE_ID) // || StringUtils.equals(id, Datasource.LOWCODER_API_ID) ) ).toList()) diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/DatasourceStructureServiceImpl.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/DatasourceStructureServiceImpl.java index 1ba4998417..13ba6d2470 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/DatasourceStructureServiceImpl.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/datasource/service/impl/DatasourceStructureServiceImpl.java @@ -46,6 +46,7 @@ public class DatasourceStructureServiceImpl implements DatasourceStructureServic @Autowired private MongoUpsertHelper mongoUpsertHelper; + @Override public Mono getStructure(String datasourceId, boolean ignoreCache) { return getStructure0(datasourceId, ignoreCache) .defaultIfEmpty(new DatasourceStructure()) diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/group/service/GroupMemberServiceImpl.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/group/service/GroupMemberServiceImpl.java index 42d12eb8d4..28726ebdf9 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/group/service/GroupMemberServiceImpl.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/group/service/GroupMemberServiceImpl.java @@ -5,7 +5,7 @@ import java.util.List; import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Strings; import org.lowcoder.domain.group.model.Group; import org.lowcoder.domain.group.model.GroupMember; import org.lowcoder.domain.organization.model.MemberRole; @@ -62,7 +62,7 @@ public Mono> getUserGroupIdsInOrg(String orgId, String userId) { public Mono> getUserGroupMembersInOrg(String orgId, String userId) { return biRelationService.getByTargetId(GROUP_MEMBER, userId) .map(GroupMember::from) - .filter(it -> StringUtils.equals(it.getOrgId(), orgId)) + .filter(it -> Strings.CS.equals(it.getOrgId(), orgId)) .collectList(); } @@ -94,7 +94,7 @@ public Mono isMember(Group group, String userId) { public Mono> getNonDynamicUserGroupIdsInOrg(String orgId, String userId) { return biRelationService.getByTargetId(GROUP_MEMBER, userId) .map(GroupMember::from) - .filter(it -> StringUtils.equals(it.getOrgId(), orgId)) + .filter(it -> Strings.CS.equals(it.getOrgId(), orgId)) .map(GroupMember::getGroupId) .collectList(); } diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/permission/model/ResourceHolder.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/permission/model/ResourceHolder.java index 6ac1b94694..3bc1c9d309 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/permission/model/ResourceHolder.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/permission/model/ResourceHolder.java @@ -1,7 +1,7 @@ package org.lowcoder.domain.permission.model; import jakarta.annotation.Nullable; -import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Strings; import java.util.Arrays; @@ -25,7 +25,7 @@ public String join(String id) { @Nullable public static ResourceHolder from(String abbr) { return Arrays.stream(values()) - .filter(it -> StringUtils.equalsIgnoreCase(it.abbr, abbr)) + .filter(it -> Strings.CI.equals(it.abbr, abbr)) .findFirst() .orElse(null); } diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/permission/model/ResourcePermission.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/permission/model/ResourcePermission.java index 2db5579276..4118219655 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/permission/model/ResourcePermission.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/permission/model/ResourcePermission.java @@ -8,6 +8,7 @@ import lombok.experimental.SuperBuilder; import lombok.extern.jackson.Jacksonized; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Strings; import org.lowcoder.infra.birelation.BiRelation; import org.lowcoder.infra.birelation.BiRelationBizType; import org.lowcoder.sdk.models.HasIdAndAuditing; @@ -30,7 +31,7 @@ public class ResourcePermission extends HasIdAndAuditing { public boolean matchUser(String userId, ResourceAction resourceAction) { return resourceHolder == ResourceHolder.USER - && StringUtils.equals(userId, resourceHolderId) + && Strings.CS.equals(userId, resourceHolderId) && resourceRole.canDo(resourceAction); } diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/plugin/client/DatasourcePluginClient.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/plugin/client/DatasourcePluginClient.java index c482d58f84..bbcf8ebe10 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/plugin/client/DatasourcePluginClient.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/plugin/client/DatasourcePluginClient.java @@ -10,6 +10,7 @@ import org.lowcoder.domain.plugin.client.dto.GetPluginDynamicConfigRequestDTO; import org.lowcoder.infra.js.NodeServerClient; import org.lowcoder.infra.js.NodeServerHelper; +import org.lowcoder.infra.util.LogUtils; import org.lowcoder.sdk.config.CommonConfig; import org.lowcoder.sdk.config.CommonConfigHelper; import org.lowcoder.sdk.exception.ServerException; @@ -30,6 +31,7 @@ import java.util.List; import java.util.Map; import java.util.function.Function; +import java.util.stream.Collectors; import static org.lowcoder.sdk.constants.GlobalContext.REQUEST; @@ -88,13 +90,25 @@ public Mono> getPluginDynamicConfig(List() { }); } - log.error("request /getPluginDynamicConfig error.{},{}", getPluginDynamicConfigRequestDTOS, response.statusCode().value()); + log.error("request /getPluginDynamicConfig error.{},{}", describeRequests(getPluginDynamicConfigRequestDTOS), response.statusCode().value()); return Mono.error(new ServerException("get dynamic config error")); }) .timeout(Duration.ofSeconds(10)) ); } + /** + * What identifies each request in a log line: data source id, plugin name and path, each on one line. Never the + * data source configuration, which holds the credentials the user typed. + */ + private static String describeRequests(List requests) { + return requests.stream() + .map(request -> "[dataSourceId=" + LogUtils.neutralize(request.getDataSourceId()) + + ", pluginName=" + LogUtils.neutralize(request.getPluginName()) + + ", path=" + LogUtils.neutralize(request.getPath()) + "]") + .collect(Collectors.joining(", ")); + } + public Mono getDatasourcePluginDefinition(String type) { return getDatasourcePluginDefinitions() .filter(datasourcePluginDefinition -> datasourcePluginDefinition.getId().equals(type)) diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/query/service/LibraryQueryServiceImpl.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/query/service/LibraryQueryServiceImpl.java index 26f05ddfae..569af4515b 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/query/service/LibraryQueryServiceImpl.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/query/service/LibraryQueryServiceImpl.java @@ -59,7 +59,7 @@ public Flux getByOrganizationId(String organizationId) { @Override public Mono insert(LibraryQuery libraryQuery) { - if(StringUtils.isEmpty(libraryQuery.getGid())) libraryQuery.setGid(UuidCreator.getTimeOrderedEpoch().toString()); + if(!StringUtils.hasLength(libraryQuery.getGid())) libraryQuery.setGid(UuidCreator.getTimeOrderedEpoch().toString()); return libraryQueryRepository.save(libraryQuery); } diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/serversetting/service/ServerSettingServiceImpl.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/serversetting/service/ServerSettingServiceImpl.java index a627b78ac2..613042d94f 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/serversetting/service/ServerSettingServiceImpl.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/serversetting/service/ServerSettingServiceImpl.java @@ -3,6 +3,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Strings; import org.lowcoder.domain.serversetting.model.ServerSetting; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.*; @@ -52,7 +53,7 @@ public void saveEnvironmentVariables() { Map defaults = getEnvironmentVariablesDefaults(); Map envVariables = new TreeMap<>(System.getenv().entrySet().stream() - .filter(entry -> StringUtils.startsWith(entry.getKey(), "LOWCODER_")) + .filter(entry -> Strings.CS.startsWith(entry.getKey(), "LOWCODER_")) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); Map merged = new TreeMap<>(defaults); @@ -87,7 +88,7 @@ private Map getEnvironmentVariablesDefaults() { if (names.length > 0) { Arrays.stream(names).forEach(name -> { String rawValue = Objects.toString(propertySource.getProperty(name), ""); - if (rawValue != null && StringUtils.contains(rawValue, "${LOWCODER_")) { + if (rawValue != null && Strings.CS.contains(rawValue, "${LOWCODER_")) { String defaultValue = StringUtils.substringBetween(rawValue, "${", "}"); String[] keyValue = StringUtils.split(defaultValue, ":"); if (keyValue.length == 2 && !defaults.containsKey(keyValue[0])) { diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/template/repository/TemplateRepository.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/template/repository/TemplateRepository.java index 8ddb5416b2..fd96a633fc 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/template/repository/TemplateRepository.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/template/repository/TemplateRepository.java @@ -13,6 +13,7 @@ public interface TemplateRepository extends ReactiveMongoRepository { @Nonnull + @Override Mono