Skip to content

Node service upgrades - #2213

Merged
ludomikula merged 80 commits into
devfrom
node-service-upgrades
Nov 27, 2026
Merged

ludomikula merged 80 commits into
devfrom
node-service-upgrades

Conversation

@ludomikula

Copy link
Copy Markdown
Collaborator

Proposed changes

nodejs based services upgrades, new e2e tests and fixes.

Types of changes

What types of changes does your code introduce to Lowcoder?
Put an x in the boxes that apply.

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help!
This is simply a reminder of what we are going to look for before merging your code.
Put an x in the boxes that apply.

  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Further comments

n/a

getMediaType was never exported or called, so it could not be tested and only added uncovered code.
…npm registry, server and routes

Tests assert observable behaviour at process boundaries (local http servers, nock, temp directories). Known defects are recorded as expected-failure tests that assert the correct behaviour, so they start failing once the defect is fixed.
…rapper plugins

The wrapper suite derives each expected request from the plugin's bundled spec instead of copying the plugin's own values. The skipped live-service OpenAPI suite is replaced by nock-based tests.
Replaces the four skipped live-service suites (s3, dynamodb, firebase, openApi) with tests against SDK client fakes, nock and local servers. Config contract tests drive each configured action through run and check its declared params reach the boundary.
jest.config.js collects coverage from every src file (excluding declaration files and data-only i18n tables) and enforces an 85% global threshold. yarn test now runs jest with coverage so the existing build gate enforces it. Adds a test:coverage script.
…s expected-failure tests

Both defects are not fixed yet. Each test asserts the correct behaviour and is marked as an expected failure, so it flips once the defect is fixed: user code in /runJs must not reach the host process, and a run without a server URL must not go to the URL an earlier run wrote into a shared spec object.
… object

runOpenApi wrote the data source's server URL into the spec object it was given, and the wrapper plugins pass one module-level spec to every run. A run without a URL therefore went to the URL an earlier data source had set, carrying its own credentials. replaceServersUrl now returns a copy and the Swagger 2 branch copies the document too. The two expected-failure tests become normal tests, with tests for the unchanged input, the shared untouched parts and two concurrent hosts.
… and races

- registry lookup: a non-array npmRegistries answers 400 on both routes
  instead of crashing the package route (B1)
- reject "..", empty, "." and separator-bearing workspace ids, package
  paths and registry "latest" versions so nothing resolves outside the
  cache directory (B2)
- resolving "latest" no longer shadows the package info, so the registry
  is queried once (B3)
- the package handler's promise settles only after the response is sent (B4)
- an upstream 4xx/5xx tarball answer is passed through and nothing is
  written; other non-2xx answers give 500 and leave no .tgz behind (B5)
- concurrent requests for one package share a single download, keyed by
  the package directory (B24)

The six expected-failure tests are now plain tests; 31 tests are added.
…d answer client errors with 4xx

- the response cache stores only 2xx bodies, so a refusal or a failure is
  no longer replayed as a 200 (B7)
- the cache key includes the parsed Accept-Language list, so each language
  gets its own localized answer; the number of cache entries now grows with
  the number of distinct language lists, and the cache is still unbounded (B8)
- the global error handler passes through exposed 4xx statuses from the
  body parsers: malformed JSON 400, oversized body 413, unsupported content
  encoding 415; errors that merely carry a status stay 500 (B25)

The three expected-failure tests are now plain tests; 10 tests are added.
- toNumber returns 0 for Infinity and -Infinity, as it already did for the
  strings "Infinity" and "-Infinity" (B27)
- kvToRecord drops only undefined, null and the empty string, so GraphQL
  variables and headers whose value is 0 or false are now sent; its type is
  generic so the declared value type matches what callers pass (B41)

The two expected-failure tests are now plain tests (the B41 test moved to
the gitlab describe); 5 tests are added.
getSchemaExample tracks the schemas on the current recursion path and
contributes no example for one that closes a cycle, so a recursive schema
(for example the uiPath spec) no longer overflows the stack. The guard is
path-based, so a shared non-recursive schema is still expanded at every use.

The rule that a falsy default, example or body example (0, false, "") falls
through to the next candidate is now documented in comments and pinned by
plain regression tests, replacing the expected-failure tests that asserted
the opposite. The uiPath wrapper test row is now a normal row.
…ggingFaceEndpoint URLs

- uiPath sends its Personal Access Token as an Authorization bearer header;
  an empty token sends no header (B30)
- openAi sends the API key under the scheme name of both bundled spec
  versions, so the default version authenticates too; an empty key sends no
  header, and the "Spec Version" placeholder shows v1.0, the version an
  unset value really uses (B31)
- boomi calls the configured API URL and huggingFaceEndpoint calls its
  endpoint URL; an empty, blank or missing URL is rejected with 400 before
  any request (B33, B34)
- the unregistered hubspot and salesForce plugins are deleted with their
  specs and icons; their tests are removed, so B32 and B35 end without a
  passing test (there is no behaviour left to assert)
- the expected-failure mechanism of the wrapper tests is removed together
  with its last user
…ext values

- decryptString accepts only an even-length string of hex digit pairs, as
  Spring's Hex.decode does, so a valid ciphertext followed by trailing
  characters is rejected with the existing 400 instead of being decrypted
  from a truncated buffer; a ciphertext produced by spring-security-crypto
  6.2.3 is pinned as a vector (B42)
- runPluginQuery copies a forwarded context value into dynamicParamsConfig
  only when it has the cookie shape ([{ name, value }, ...]); any other
  value for a matching key is ignored instead of failing the whole query
  with a TypeError (B22)

The two expected-failure tests are now plain tests; 14 tests are added.
… signed URLs after 5 minutes, send the search filter

- non-2xx responses are copied into a global Response before storage-js
  sees them, so every error carries the server's message and status instead
  of {"size":0,"timeout":0}; readFile reads its own error body because
  storage-js does not for downloads (B36)
- signed URLs are requested for 300 seconds; the lifetime was computed as
  an epoch timestamp once at module load, so every URL lasted decades (B10)
- the List Files "search" setting is sent to the storage API (B38)
- the unwired supabase validateDataSourceConfig, whose result was inverted,
  is deleted together with its tests; B9 ends without a passing test

The expected-failure tests for B36, B10 and B38 are now plain tests and the
storage contract suite no longer exempts listObjects.search.
…oint, validate for real, map GCS errors to 400

- STS credentials are cached per data source (keyed by a hash of the access
  key, secret, role and endpoint) instead of in one process-wide slot, so a
  second data source no longer acts with the first one's role; every login
  drops the expired entries (B11)
- the configured STS endpoint is used, with https:// added when the value
  has no scheme so the signed request and the temporary credentials are not
  sent over plain HTTP; an empty value keeps the default endpoint (B37)
- "Test connection" awaits the STS login and reports its failure instead of
  always answering success (B12)
- Google Cloud Storage ApiError is answered as 400 like the s3 plugin maps
  its service errors, instead of falling through to 500 (B17)

The four expected-failure tests are now plain tests and the storage contract
suite checks the endpointUrl setting; 19 tests are added.
…er worked

- Athena returns [] for an empty result instead of crashing, answers 504
  when the query has not succeeded within the timeout instead of fetching
  results of a running query, and waits between polls for an unknown or
  missing state instead of polling in a tight loop (B14)
- Lambda sends its payload as UTF-8 bytes; characters outside ASCII were
  corrupted by a per-code-unit byte conversion (B15)
- the 25 AppConfig actions that only logged and returned nothing are removed
  from the plugin and from the query editor; an unhandled action name is
  rejected with 400 instead of a silent empty success, so a saved query that
  still uses one now fails with the query DSL check's message (B16)
- an empty DynamoDB endpoint URL is treated as unset instead of making every
  request throw Invalid URL (B39)

The six expected-failure tests are now plain tests; 14 tests are added and
the release notes name the removed AppConfig actions.
…properly, key duckdb rows by column

- duckdb closes its connection and its instance after every run, including
  a failing query, a non-Query action and a failing connect (B21)
- duckdb returns rows as objects keyed by column name instead of by
  position, so bindings by column name work; positional keys such as "0"
  are gone and the release notes say so (B26)
- firebird detaches after every attach and awaits it, also when the query
  fails or the parameter object cannot be prepared; a detach failure is
  logged and does not replace the query result or error (B20)
- firebird recognises :name parameters only outside string literals, quoted
  identifiers and comments, so a literal such as '10:30' is sent unchanged,
  and a missing parameter is reported before any connection is made (B20)

The seven expected-failure tests are now plain tests; 24 tests are added.
…64 filters, delete the fauna plugin

- shopify forwards the query headers and has an optional accessToken data
  source field sent as X-Shopify-Access-Token; a configured token replaces
  a query-level header of the same name in any letter case. The header name
  comes from Shopify's public API documentation and was not verified
  against a Shopify endpoint (B18)
- firestore IS_NAN and IS_NOT_NAN filter on NaN instead of null, and
  integerValue strings (the REST/JSON int64 encoding) become numbers, exact
  bigints above 2^53, or a 400 when malformed, in filters and cursors; an
  empty QueryFireStore result stays [] (B13)
- the fauna plugin is deleted with its icon and tests: the Fauna service has
  shut down and its EU region never resolved an endpoint; fauna is no longer
  listed and a query naming it gets 400 plugin not found. B40 ends without a
  passing test. Saved fauna data sources lose their plugin definition; the
  api-service and client behaviour for those is read from the code, not
  covered by a test

The expected-failure tests for B13 and B18 are now plain tests; 15 tests are
added and 12 fauna tests are removed.
… the api-service

The node service no longer lists the fauna plugin, so the plugin client finds no
definition for a saved fauna datasource. The new test runs the real plugin client
against a local stand-in for GET /plugins and the real JsDatasourceHelper, and
pins that loading and the two dynamic-config steps complete without an error,
leave the definition and type empty, keep the stored apiKey and region and send
no dynamic-config request. A control with a listed type shows the wiring fills a
definition.
…ode-snapshot

isolated-vm is pinned exactly. Its prebuilt binaries cover Node 22 and 24 on
linux-x64 (glibc and musl), so no compile step is needed. The start script,
the test scripts and the nodemon exec map pass --no-node-snapshot.
…oses B6 and B23)

Each evaluation gets its own isolate and context with a 128 MB memory limit and
a 30 s deadline. The sandbox has no WebAssembly, SharedArrayBuffer or Atomics,
and only strings and one allowlisted host bridge cross the boundary; the result
comes back as a JSON envelope the host validates. At most 8 evaluations run at
once, 32 more may wait up to 10 s, and the rest are rejected. A fatal isolate
error is logged and aborts the process.

/runJs and /batchRunJs get a 5 MB body limit (413 above it), mounted before the
global parsers. A batch runs its entries one after another.
build/ is produced by yarn build (tsc + scripts/build-bridge.mjs). Both
Dockerfiles build from src/ and .dockerignore already excludes it, so nothing
reads the tracked copy. Ignore it from now on.
… and website routes

Adds 45 tests on top of the 12 existing ones: token signing and scope checks,
URL validators, the session endpoints of all three routes, bridge serving,
405/401 handling, the typeform relay against a local upstream (header, Location
and JSON body rewriting), and the rate limit. The server-spawning helper moves
to test/helpers/proxyProcess.js and now carries the child's output into
assertion messages. PROXY_TEST_URL runs the route tests against a running
server, skipping those that need control of its environment.
…esses as website targets

URL.hostname keeps the brackets of an IPv6 literal, so isIP() never matched and
http://[::1]/, [fd00::1] and [::ffff:127.0.0.1] passed the SSRF allowlist.
Strip the brackets before the check and decode the hex form WHATWG URL gives
IPv4-mapped addresses (::ffff:7f00:1). The new test fails without the change.
15 tests spawn server.js per environment and decode the tokens with agora-token's
AccessToken2: structure, expiry, signature, roles, RTM user, CORS, health and
404s. Known defects are pinned as 'as today' tests; the invalid Host header
crash is a todo. package-lock.json fixes agora-token at 2.0.7 so the tests can
use npm ci. AGORA_TEST_URL runs them against a running service.
…layout

Runs client/packages/lowcoder/hocuspocus-server.js next to @hocuspocus/server
4.3.0 (the version both Dockerfiles install) and checks health and root
answers, Yjs sync between providers via the helm runtime client, token
rejection, document isolation and the exit of a second server on the same
port. Known defects (HOST ignored, missing failed-to-start line) are pinned as
a todo and a comment. versions.test.mjs ties the server and provider versions
to the Dockerfile ARGs, the lockfiles and runtime-test.sh. HOCUSPOCUS_TEST_URL
runs the tests against a running server.
…he committed lockfile

Node 26 images ship no Yarn, so install yarn@1.22.22 explicitly. Install with
--frozen-lockfile instead of the 'yarn install || npm install' fallback, which
would silently resolve different versions, and prune dev dependencies after the
build as the all-in-one stage does. yarn.lock is no longer dockerignored.
…and install from the lockfile

npm ci --omit=dev installs exactly the agora-token 2.0.7 the tests ran against
instead of whatever ^2.0.4 resolves on build day.
The floating node:26-alpine tag would pick up a new Node minor with the next
build; the server version was already exact (4.3.0).
…n pull requests

Three workflows run the suites on Node 22, 24 and 26 and check the TAP summary
(counts, known todo tests, required titles). The two image workflows ignore the
test directories so a test change does not republish the image; proxy-service's
tests are copied into its image, so its paths stay.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Deploying lowcoder-cloud with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2d8b71f
Status: ✅  Deploy successful!
Preview URL: https://0ef2f66b.lowcoder-cloud.pages.dev
Branch Preview URL: https://node-service-upgrades.lowcoder-cloud.pages.dev

View logs

Comment thread deploy/docker/Dockerfile Fixed
Comment thread server/proxy-service/Dockerfile Fixed
Comment thread server/proxy-service/Dockerfile Fixed
Comment thread server/proxy-service/Dockerfile Fixed
Comment thread server/proxy-service/Dockerfile Fixed
Comment thread server/proxy-service/Dockerfile Fixed
…untime test, pin that other rooms are refused

The server admits only signal_<appId> rooms (checked against the api-service) and the typeform_, googleform_ and website_ bridge rooms; the tests and the helm runtime test named rooms the server now refuses, and the health answer names the room rule.
…vice and serve upstream error text as plain text

The .tgz was named after the last segment of the registry's tarball URL, which is upstream data, and an upstream error body was sent as HTML.
The e2e suite's coverage exclusion and its S5332 ignore rules are covered by the exclusion of e2e/.
…g them right after the client sees the refusal

The server logs a rejection after the client has seen it, so the count taken
right away could be one short. Also drop a plan name from a Dockerfile comment.
…d run the image as the node user

The image content is identical (same hash over node_modules and build); the
service user can read but not modify its own code.
…d stages without dependency lifecycle scripts

The files copied into the final stage are byte-identical to before.
…g datasource configuration

A carriage return or line feed in a value taken from a request (the deprecated
source of the form login, ids and names in the audit event errors) started a
new, forged-looking log line. LogUtils.neutralize replaces both characters for
the values inside one line. Only CR and LF are replaced; other log calls still
print their arguments raw.

When the node service answers a dynamic-config request with an error, the log
line carried the whole request list, including the datasource configuration
with the credentials the user typed. It now names the data source, plugin and
path of each request and the status. The error line of an application event
names the application id instead of an object identity.
…or and keep publishing after a stored tag with an over-long number

GET /api/groups/{id}/potential-members and GET /api/users/myorg passed the page
number unchecked to PageRequest.of, which threw a raw 500 (code 5000) for 0 or
less. They now refuse it with the page-number error every other paged route gives
(INVALID_PARAMETER, code 5002, same HTTP status). A page size of 0 or less is not
covered and still fails as before.

A version tag is stored as the publisher sent it. A tag such as 1.0.99999999999
made every later publish of that application fail with a NumberFormatException
(HTTP 500). A tag of three numbers of at most nine digits is counted on as
before; any other tag starts again at 1.0.0.

Pagination.pageOf now subtracts in long, as its documentation says; the answers
do not change.
… a log argument, add missing @OverRide

No behaviour change: two comment and log-format fixes, three unused local
variables removed (the lookups that produced them stay), and @OverRide added to
13 methods so a drifting signature fails to compile. The JSON boundary
attestations of the three touched files are renewed.
… their successors

commons-lang3 StringUtils equals/contains/startsWith/... become Strings.CS and
Strings.CI, ObjectUtils.defaultIfNull becomes getIfNull, Range.between becomes
Range.of, new Locale becomes Locale.of, the Redis pool eviction setters take a
Duration, a Spring StringUtils.isEmpty becomes !hasLength, and ensureIndex
becomes createIndex (in the pinned Spring Data MongoDB, ensureIndex only calls
createIndex). Left as they are: Encryptors.text (changing it changes the format
of every stored secret), the pf4j plugin constructors, the random-string
helpers, Schedulers.enableMetrics and the project's own deprecations.
…nts on from its latest version

Versions are stored under the object id, but the publish route looked up the
latest one by the key of the path. For a gid or slug that found nothing, so a
publish without a body always stored 1.0.0, and a publish with a body missed
the version-change event for the real next version. The lookup now uses the
resolved id.
…rkspace only

GET /api/bundles/list and /api/bundles/recycle/list took every bundle the visitor
created, in every workspace, and computed the current workspace without using
it. They now list the bundles the visitor created in the current workspace and
may read. A bundle stored without an organization, or a blank workspace id,
matches nothing. The two route descriptions say so.
… keeps the stored one

Without LOWCODER_SUPERUSER_PASSWORD every start generated a new password, wrote it
over the stored one (also over one the super admin had changed) and printed it.
Now a generated password is written only to an account that has none, and
printed (same line as before) only by the start that stored it; later starts keep
the stored password and log a line without it that says how to replace it. A
configured password still replaces the stored one at every start.

An existing deployment keeps the password its last start printed. The variable's
description in the docker, helm and self-hosting docs, default.env and app.json
says so.
…lt, drop an assertion that cannot fail, close the files the JSON test reader opens
… a literal

The message-key bundle test reads the keys of the exceptions as literals and checks
them against the bundles; a constant at that place made the key unreadable for it.
A test pins that the constant used by the super-admin job is the same text.
…d never forward the registry's error text

The cache directory comes from the workspace id of the request. Every path the
unpack step creates, writes or removes now passes a check that it is the cache
directory or lies inside it, so a name that spelled a way out of the cache could
not reach it even if the earlier validation let it through.

When the registry answers a tarball request with an error, the client gets that
status with a fixed plain-text message. The registry's own text is only logged.
…report to Sonar

The build job runs verify instead of package -DskipTests: the unit and integration tests run under JaCoCo and the coverage gate of lowcoder-coverage-report applies. The aggregate jacoco.xml goes into the uploaded artifact and the scan passes it to Sonar, so new code is no longer measured as 0% covered. The trusted workflow takes effect once it is on the default branch.
…t, not a parser crash

An argument consisting of a single quote both starts and ends with one, so the quote stripping called substring(1, 0) and failed with StringIndexOutOfBoundsException. The stripping now needs at least two characters. Tests also cover an unclosed quote, a host that cannot form a URI outside URI mode and a missing datasource request, which lifts the branch coverage of the plugin above its gate floor.
@ludomikula
ludomikula force-pushed the node-service-upgrades branch 2 times, most recently from f78ebcd to 2d8b71f Compare November 27, 2026 19:09
@ludomikula
ludomikula merged commit 0277ebe into dev Nov 27, 2026
13 checks passed
@ludomikula
ludomikula deleted the node-service-upgrades branch November 27, 2026 19:25
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants