Skip to content

v7.4.0

Latest

Choose a tag to compare

@github-actions github-actions released this 14 Nov 19:53
a8b6753

What's New

feat(connection-axios-http): AxiosHttp refuses internal addresses by default

Packages: @lowdefy/docs, @lowdefy/connection-axios-http

Breaking: an AxiosHttp request to an address that is not public now fails: localhost, private networks (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), link-local addresses such as the cloud metadata endpoint 169.254.169.254, and the like. A hostname is checked by the address it resolves to, and every redirect is checked too. An app that calls a service on the same machine or network, such as a localhost API, a Docker service name or a private network API, sets allowInternalAddresses: true on the connection:

connections:
  - id: internal_api
    type: AxiosHttp
    properties:
      baseURL: http://orders-service:8080
      allowInternalAddresses: true

Request properties can be filled from the client payload, so a request with url: { _payload: url } could make the server call any address it can reach. The check stops that reaching internal services.

Also:

  • allowedHosts on the connection lists the hostnames requests may connect to. A request to any other host, or a redirect to one, is refused. It applies alongside the address check.
  • allowInternalAddresses, allowedHosts, allowAbsoluteUrls, proxy, socketPath, httpVersion, httpAgentOptions and httpsAgentOptions can only be set on the connection. A request that sets one fails schema validation.
  • Without allowInternalAddresses, the server connects directly: HTTP_PROXY and HTTPS_PROXY are ignored, and proxy, socketPath and httpVersion: 2 fail, since the address check cannot see where they connect.
  • adapter, transport, lookup, beforeRedirect, httpAgent and httpsAgent are not supported on a connection or request.

Fixes & Improvements

  • fix(api): Dynamic blocks policies check object keys and slot names the same way as values (@lowdefy/api, @lowdefy/docs)

    A block can draw an object key as well as a value: the keys of a Descriptions items object are its labels, and Tabs and Collapse draw slot names as titles. A dynamic blocks policy now applies the html rule and its URL checks to every object key and every slot or area name in the content, as it does to a string no block schema marks. Keys in data, such as a SetState value under the policy's state path, are not checked, since data is never drawn.

  • fix(api): A failing websocket source keeps restarting and tells pages when it is back (@lowdefy/api, @lowdefy/connection-mongodb)

    When a websocket source kept failing, for example during a database outage of more than about 30 s, the server restarted it 5 times, then dropped the channel without telling its subscribers. Pages still showed the subscription as connected but heard nothing more until they reloaded or reconnected. Every failed restart was also logged as an error and sent to Sentry.

    The server now restarts a failed source for as long as its channel has subscribers, 1 s after the failure and doubling up to once a minute. The first failure of an outage is logged as an error and sent to Sentry. Each further failed restart is a warning. Subscribers still get an error for each failed start.

    When the source is listening again, each subscriber gets its subscription acknowledged again, so the page's onSubscribe fires and _websocket: <id>.error returns to null. The source missed every change during the outage, so a page that refetches in onSubscribe catches up. A websocket source receives a new ready function and calls it once it is listening; a source that publishes counts as listening too. MongoDBChangeStream calls it when the database first answers the stream.

  • feat(build): Warn when an agent on Vercel has no time limit (@lowdefy/build)

    On Vercel, an agent chat turn is not covered by config.requestTimeout and keeps running after the browser goes away. An agent with no timeout of its own, on a connection with none, was stopped only when Vercel ended the function at config.vercel.maxDuration. The reply then stopped mid-stream with no error, and the agent's onFinish hooks, which save the conversation, never ran. A production app had test turns cut off this way. The build now warns for each such agent, and for an agent whose timeout is not shorter than maxDuration, when the app targets Vercel. With its own timeout, a turn that runs too long is cancelled, the user sees an error and the onFinish hooks still run. Timeouts set with an operator are not checked.

  • fix(server-dev): MCP instructions follow the test level rules (lowdefy, @lowdefy/server-dev)

    The dev MCP server's instructions told agents to verify every change with a journey, and lowdefy_run_tests told them to widen to the edge tier before calling a change done, after the rules lowdefy agent-setup writes had stopped saying both. Called with no arguments, lowdefy_run_tests runs the full suite, so agents that followed it ran every journey for one change, and several agents building one change each did so on the same machine. The instructions now send logic to lowdefy_run_endpoint and keep lowdefy_run_journey for what only a browser shows, once the change is done. lowdefy_run_tests asks for the journeys of the pages a change touches and keeps the full suite for when a person asks. When several agents share a change, the agent that merges their work runs the journeys and lowdefy_check once, after the last merge.

  • fix(cli): lowdefy_run_tests answers with a summary an agent can always read (lowdefy)

    The lowdefy_run_tests agent tool answered with every journey's measured path (the pages, requests, events and blocks it touched), up to thousands of entries a journey. A suite of 40 journeys gave an answer of about 500 KB, which agents' clients refuse, so the agent waited for the whole run and then saw nothing. On one machine over a month, 37 of 104 runs ended that way.

    The tool now answers with summary, failed (each failing or flaky journey with its report and failing step), passed and skipped (one line per journey) and resultFile. The answer stays under 25,000 characters for any suite: when not everything fits, failures are named before passing lines, and omitted counts what was left out. Every journey of the run is written to .lowdefy/test/results.json, which resultFile names. The measured path is no longer in the answer; .lowdefy/test/exercised.json holds it as before.

    An answer that used results should read failed and passed, or the result file.

    The tool also sends an MCP progress notification as each journey finishes when the client passes a progress token, so a long run is not silent. lowdefy test in a terminal is unchanged.

  • fix(server): Websockets on Vercel reconnect at once when the function's time limit ends them (lowdefy, @lowdefy/server)

    On Vercel every websocket ends when the function reaches config.vercel.maxDuration. Vercel stops the function without closing the connection, so the browser only noticed about 10 to 12 seconds later, and pages heard no live updates in that gap: about 9% of the time with a 120-second limit. Changes made in the gap never reached the page. The server now closes each websocket 5 seconds before the limit (at half the limit when it is under 10 seconds), and the client reconnects and resubscribes straight away. The Node server is unchanged.

  • feat(ai-utils): Agent titles come from the first exchange and use the agent's gateway options (@lowdefy/docs-content, @lowdefy/ai-utils)

    An agent with generateTitle: true made its title call without the agent's providerOptions. An agent set to zero data retention and pinned to one provider through the AI Gateway still sent the user's first message to the gateway on default routing and retention for the title. The title call now carries the agent's providerOptions, so AI Gateway routing and retention (zero data retention, only, order), OpenAI's store and Gemini's safetySettings apply to it. Thinking and reasoning settings are taken off and the call asks for no reasoning (reasoning: 'none'), with a 1,024-token cap for models that can't turn reasoning off. The title call also takes the agent's timeout, keeping its total and step limits, since a non-streaming call can't use a chunk limit.

    The title is also generated from the first exchange, the user's first message and the first 1,200 characters of the assistant's first reply, instead of the first message alone. When a chat offers suggested prompts, many conversations open with the same question and all got the same title; the reply is where the subject is. The title is generated once the first reply is complete, alongside any onFinish hooks and before the response stream closes, so the data-chat-title part, and the AgentChat block's onTitleGenerated event, now arrive after the reply instead of alongside it. A first reply that waits on a tool approval or a client tool is titled when it completes, and a failed turn is no longer titled; its retry is.

  • fix(server-dev): Only the dev server's own headless browser can choose the user it acts as (@lowdefy/server-dev)

    The dev server's headless browser (used by the screenshot, journey and other page tools) tells the dev server which user to act as through a cookie. The dev server now signs that cookie with a secret it creates each time it starts, the same way it already signs the journey cookies, and ignores the cookie when the signature is missing or wrong. Before, any request that reached the dev server could send that cookie and act as any user with any roles. The production server never read this cookie and is not affected.

  • fix(deps): Update glob to 14 so agent file tools refuse patterns that exhaust the server (@lowdefy/ai-utils)

    An agent with fileSystem access passes the model's glob pattern to glob. glob 13 used
    minimatch 10, where a pattern of about 200 characters such as x/**/../a/**/../a/…/b takes
    minutes and gigabytes of memory to expand (GHSA-g3hv-75wg-m249) and can crash the server. glob 14
    uses minimatch 11, which refuses such a pattern straight away, so the tool call fails instead.

  • fix(node-utils): Refuse internal addresses carried in IPv4-translated and Teredo IPv6 addresses (@lowdefy/node-utils)

    The check that keeps server-side link fetches (the AwsS3PutObject url copy and agent file downloads) off internal addresses now classifies an IPv4-translated address (::ffff:0:0:0/96) by the IPv4 address it carries, the way it already did for NAT64 and 6to4, so ::ffff:0:a9fe:a9fe (169.254.169.254) is refused while ::ffff:0:808:808 stays allowed. The Teredo prefix (2001::/32) and the Azure platform endpoint (168.63.129.16) are refused, as is the deprecated 6to4 relay anycast range (192.88.99.0/24).