mirror of
https://github.com/HeyPuter/puter.git
synced 2026-11-26 15:48:41 +00:00
8f136a4e211503fffd16c9ccc77bd1ff461377f9
180
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8969c8b3b4 |
refactor(backend): layer pass for duplicated logic, dead code and round trips, with the bugs it turned up (#4754)
* refactor(util): shared helpers for hosts, timeouts, chunking, paging, shutdown flush and codes Adds normalizeHost/getPuterHostedDomains, withTimeout, chunk, nowSeconds, isMissingTable, clampLimit/parsePageQuery/pageEnvelope, finalFlush, parseRetryAfterMs/doublingBackoffMs, randomCode, sweepInBatches, hashPassword/generateEmailConfirmCode, requestIp and isTemporaryAccount, and removes util exports nothing called. * refactor(clients,core): drop unread alarm state and dead shutdown paths, share host helpers DynamoDB batches still throttled after the retries answer 503 db_unavailable. * refactor(stores): one cache read per miss, tombstones on every write, batch methods for callers above The multi-check permission cache is read with pipelined GETs. claimOwnership, replaceDataUrlIcon and setLabel tombstone their keys. updateMetadata merges in one statement. App stats reject an unknown period and cap grouped answers. * refactor(services): fewer serial round trips in permission, share, metering and events paths checkMany no longer caches a check that threw. Account deletion revokes its sessions first. OIDC email_verified strings are read as booleans. Events limits, FS service types and the events worker deployer live under services. * refactor(drivers): one teardown path for workers, shared credit hold and provider helpers A URL input and a generated-media download have a deadline and a size cap. Azure chat clients take the shared client options. xAI and Mistral chat send tools through toolsToWire and honor apiBaseUrl. * refactor(controllers): shared download, paging and second-factor helpers, store methods for raw SQL /batch answers a non-HTTP op error generically and logs it. /fs/search returns the client entry shape. The unused /puterai/video/proxy route is removed. * refactor: thumbnails accept raster types only, boot failure exits, docs for new limits * fix: sessions stay listed after a rename, token grants follow the whole revoke cascade, app delete in one transaction - listSessions asks the primary about rows marked as changed, so a renamed session stays on the list under its new label. - The revoke cascade reports the access tokens it revoked, and their grants are dropped at any depth. The read before each revoke is gone. - App delete records the deletion, clears filetype associations and deletes the row in one transaction. - A local worker deploy waits for the runtime to start, so a script it cannot load fails the deploy. - Speechify plain text: an & that starts no XML entity and a < that starts no complete tag are escaped. - The events forward queue's byte bound counts UTF-8 bytes. - Without a dedicated store, thumbnails stay in the default bucket. - AppStore.invalidateWrittenByUid for writers that hold the uid. - subdomainFromHost takes the configured domain list; the sorting wrapper only tests called is removed. - Changelog and alarm docs match the code. * fix: cache pipelines fall back to single commands across shards, TURN records metered one by one, allowance baseline kept - execTogether runs single-key cache commands in one round trip and, on a cluster that cannot route them in one pipeline, sends each on its own. The row cache, tombstone reads and writes, the FS entry backfill, the permission check cache and the revoked-session cache write use it. - TURN usage ingestion makes one metering call per user with each record as its own usage, so one malformed record does not affect the others. - The allowance settlement keeps the baseline fold for month records without allowanceUsed. - Speechify plain text keeps a self-closing tag without attributes. * fix(localworker): a deploy waits for the runtime to start and a failed cold start answers 502 A script the runtime cannot load fails the deploy. What was serving before goes back in place, and a first request for such a worker answers 502. * fix(subdomains): the sites rooted under a folder are read in name order, a page at a time subdomainsRootedUnder takes the name to start past, so a caller pages through every match instead of stopping at one query's limit. |
||
|
|
522c5af1a7 |
fix(puter-js): clear launch params from app tabs; private app sign-in keeps the tab's launch (#4743)
* fix(puter-js): clear launch params from an app tab's address bar An app the desktop opens in its own browser tab removes the puter.* params it was launched with from its URL after load. The app's own params, utm_* and the hash stay; framed apps are unchanged. The SDK reads launch items from the query it booted with, so onLaunchedWithItems() and wasLaunchedWithItems() still see the opened item after the URL changes. * fix(puter-js): keep a tab's app id across a reload after the launch params are cleared A godmode token doesn't name the app, so once the desktop answers a tab's launch, the app id from the launch URL is stored the way a token's own app id is. * fix(hosting): a private app's sign-in page continues with the desktop's token and keeps the opened item In a tab the desktop opened, the sign-in page waits for the desktop's handoff, sends the handed token to its own URL in X-Puter-Auth-Token so the host sets its cookie, then loads the URL the tab was opened at. The token goes in the URL only after a redirect, a failed request, or on a click after a header try didn't load the app. Before leaving, the page keeps the opened item in sessionStorage, bound to the launch and a fingerprint of the handed token, for 5 minutes. The app's page takes it when it boots on that token in the same tab. Reading sessionStorage for it can't stop the SDK from booting where storage is blocked. --------- Co-authored-by: Salazareo <25314977+Salazareo@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> |
||
|
|
4a13169815 |
fix(s3): close pooled connections before S3 drops them; name the host and site owner on error alarms (#4749)
* fix(s3): close pooled connections before S3 drops them S3 hangs up on a keep-alive connection that has been idle for about 6 s and sends no keep-alive hint, while the client's pool kept idle sockets indefinitely. A request written to a socket as S3 closed it failed with `socket hang up`, and the SDK's retries could draw more sockets of the same age from the pool and fail the same way. The pool now closes a socket after 4 s idle. Requests in flight keep the handler's own socket timeout. Plain-HTTP endpoints get the same pool settings as HTTPS ones. * feat(alarms): name the host and a hosted site's owner on HTTP error alarms A hosted site's visitor is usually anonymous, so an error alarm for a site request named nobody, and its path alone did not say which site failed. The site middleware now records the owner as the actor to report a failure against, used when the request has no actor of its own, and every HTTP error alarm carries the request host. |
||
|
|
78a7400c98 |
feat(auth): an extension can switch the SMS-to-card fallback on or off over config (#4747)
Adds the puter.card-fallback.policy event, asked before phone_verification_card_fallback.enabled is read. A listener that sets enabled decides in place of config; with none, config decides as before. |
||
|
|
6b8af52077 |
feat(auth): sign-in pipeline, per-account wrong-password budget and idle session expiry (#4692)
Sign-in - One sign-in path (SignInService) for password, 2FA, recovery code, signup and OIDC. It emits puter.signin.attempt (before the account lookup on POST /login), puter.signin.validate (before the session is created) and puter.signin. Listeners can refuse or require phone or card verification; a listener that throws is ignored. - POST /login keeps a wrong-password budget per account across all networks, 20 an hour and 50 a day. A browser that has signed in to the account before is not refused, and the budget belongs to the current password. - An account unused for dormantSignInDays (default 180) confirms an unconfirmed email at sign-in, where the deployment can send mail. - New account emails: sign-in from a new browser, sign-in attempts blocked, password reset completed. - pwnedPasswords (off by default): a k-anonymity range lookup after a successful password sign-in, with a notice to the owner. - requestSignalHeaders and requestSignalValue turn configured request headers into req.requestSignals and a puter.request.flagged event. Sessions - web and app sessions end after 180 days without activity; accounts with no password and no email keep 365 days. A missing expiry on web, app and asset rows no longer means no expiry, and ended rows are purged. - The cookie a private hosted site sets from ?auth_token= is tied to the token's session row and carries a 7-day expiry. Email confirmation codes - A 6-digit code is valid for 60 minutes and has a wrong-code budget. Mailbox ingress - email.ingress.validate runs before a message is stored; a listener can refuse it or record a sender check. X-Puter-Sender-Auth is written by the server only. Header blocks over 256 KiB are refused. GUI - Login sends the device fingerprint, can show the captcha widget (gui_params.turnstileLogin), offers a password reset when sign-in is locked, and runs pending verification windows after a popup sign-in or signup. |
||
|
|
6478f18feb |
perf: whoami row reuse, thumbnail URL cache, KV refusals, dashboard KV boot batch, profile revalidation (#4687)
* perf(whoami): answer from the user row token auth already loaded Token auth builds the actor from the user's row with the password hash left out. It now records `hasPassword` in its place, so /whoami builds the details (`oidc_only`, `is_temp`) from the actor and skips reading the same row again by id. An actor built any other way still reads the row. * perf(thumbnails): reuse a read URL signed this hour A thumbnail's read URL is the same for the whole signing hour, so listings re-signed it for nothing. Signed URLs are kept per signing client, keyed by the signing key, bucket, object key and hour (5,000 entries, one hour). A new signing key signs afresh. * perf(kv): a refused conditional write ends at the refusal when it can `set` with `onlyIfAbsent` on a live key, and a write or delete into a foreign namespace refused by a private entry, made four store calls: the refused write, a refused expired-row delete, a consistent read and a second refused write. The conditional write now asks for the refusing item. When its `ttl` is absent, null or a number, the condition already judged it the way reads do and the refusal stands after one call. A text or boolean `ttl`, or a refusal without the item, still settles and retries as before. * perf(gui): the dashboard reads its saved settings in the boot batch The GUI's boot KV batch fetched the desktop's keys on every boot, while the dashboard read its seven (Files view and sort, Apps order, groups and uninstalled list) one request each. The batch now carries the keys of the interface that booted. The uninstalled-apps read-modify-write skips the batch, which may predate another window's write. * perf(profile): answer a revalidated GET /profile without reading it A profile write records a hash of the stored JSON in the file's metadata. GET /profile sends it as the ETag with `Cache-Control: private, no-cache` and answers a matching If-None-Match with 304 before reading the stored profile. Visibility is checked first, so a hidden profile still 404s. A profile stored before this has no tag until its next write. * fix(thumbnails): a listing's concurrent signings share one URL cache The per-client cache was registered after the first signing returned, so a cold client's first listing kept only one of the URLs it signed. * fix(kv): recheck a refusing row's expiry and its private flag A numeric `ttl` that passes while the refusal is on its way now settles and retries, as before, instead of answering false. A share holder's refused `onlyIfAbsent` takes the private flag from the refusing item rather than an eventually consistent read after it. DDBClient tests cover the request and the undecoded item on the wire. * fix(gui): Apps refreshes read the saved layout from the store Only the open's first load takes it from the boot batch. A refresh exists to pick up another tab's changes, which a batch fetched a few seconds earlier can predate. * fix(profile): tag a profile response by the bytes it carries The file is written before its entry and the entry can be read from a cache that is behind, so a 200 now carries the tag of what was read. Tags are weak (the compressed and plain bodies share one) and the early 304 sends `Vary: Accept-Encoding` like the 200. A profile stored without a tag still answers 304 to its content tag, after reading the file. * fix(kv): the GUI boot batch only answers for the token it was fetched with A sign-in from another tab swaps the token while the batch is still live, so reads under the new account fall through to the store. |
||
|
|
bc73cde987 |
feat(alarms): channel keys, and calls an uptime monitor can poll (#4672)
* feat(alarms): channel keys, warning in chat, and calls an uptime monitor can poll
- `create(..., { channel })` names the area that owns an alarm; config maps
keys to Slack channels (`pager.slack.channels`), unmapped keys post to the
default channel. `HttpError` takes `alarmChannel`, and the upstream_* codes
the error gate forces go to `ai_providers`.
- Slack can post with a bot token (`chat.postMessage`), which reaches any
channel and links a call to its message; the webhook stays as a fallback.
- Defaults: PagerDuty takes `error` and up, Slack takes up to `warning`.
- `pager.calls.rules` maps alarm ids or prefixes to call groups. A matching
alarm is recorded in system KV until it has been quiet for `ttlMs`;
`GET /alarms/calls?group=` (internal-auth secret) answers 503 while one is
active, with a short plain-text body linking each call's chat message.
- Core alarms retiered: non-urgent `warning`s become `info` with a channel;
critical and error alarms are unchanged.
* fix(alarms): keep warning on the pager; calls link to where the alarm landed
- PagerDuty takes `warning` and up again, and Slack stays at `info` when a
pager exists: `warning` is the low-urgency pager queue, `info` is chat.
- An alarm that calls is no longer also posted to Slack. Its link comes from
the transport that took it: the Slack message, or the PagerDuty incident,
looked up with the new `pagerduty.apiToken` (REST, read-only is enough).
- The PagerDuty transport moves to its own module.
|
||
|
|
b85c04d49a |
fix(redis): a command that gets no answer rejects after a timeout, and commands fail fast while Redis is stalled (#4656)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Benchmarks / changes (push) Canceled after 0s
Benchmarks / bench shard 1/3 (push) Canceled after 0s
Benchmarks / bench shard 2/3 (push) Canceled after 0s
Benchmarks / bench shard 3/3 (push) Canceled after 0s
Benchmarks / benchmarks (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
* fix(redis): a command that gets no answer rejects after the configured timeout redis.commandTimeoutMs (default 2000) arms a per-command timer on the cluster client, so a command sent to a node that never replies, or queued while the cluster is not ready, rejects and the caller takes its error path. Blocking commands and duplicate() clients are left without it. * fix(broadcast): a failed pubsub publish or subscribe is logged, not left unhandled With command timeouts, a stalled publish now rejects; the fan-out is fire-and-forget, so the rejection is caught and logged. The sign-in relay test pins that /login/set still reaches a subscribed /login/wait when Redis never answers. * fix(permissions): a scan cache read that Redis fails to serve counts as a miss The scan then computes from the store, as the generation and per-check cache reads already do, instead of failing the permission check. * refactor(redis): isCommandTimeout names the rejection of a timed-out command Callers that issue a write can recognise the timeout and queue its undo on the same key. Also notes that a timed-out command is not withdrawn, restores the console spies in the timeout tests, and drops formatting churn in types.ts. * fix(metering): an increment whose buffering timed out is counted once On a timeout the write-through runs and the buffered copy is negated on the same keys, so if the timed-out increment lands later the next flush nets it out. incr and incrAux both do this. * fix(rate-limit): a concurrency slot whose acquire timed out is removed The ZREM goes to the same key behind the timed-out MULTI, so a slot that lands late does not stay held until the orphan window. * fix(uploads): leases whose take timed out are released The release goes to the same keys behind the timed-out take, so leases that land late do not count against the owner until their deadline. * fix(redis-lock): a claim that timed out is released if it lands The token-checked delete goes to the same key behind the timed-out SET NX, so a late claim does not hold the lock for its full TTL. * fix(broadcast): a rejected pubsub subscribe is retried with backoff Retries start at 1s and cap at 30s, and stop once the service shuts down. * refactor(redis): isCommandTimeout lives in its own module Stores, the rate limiter and the lock helper recognise a timed-out command without importing the client. * fix(credit-holds): a hold whose take or reserve timed out is released The release goes to the same key behind the timed-out script, so a hold that lands late does not shrink the spendable budget for its TTL. * fix(metering): a write-through answers without waiting on its undo The undo's place in the queue is fixed when it is sent, so the request no longer waits on it. When the undo itself times out, the warning says the increment may be counted once more or not at all. * fix(broadcast): a pubsub subscribe retry checks the client is still current A retry that fires after shutdown no longer subscribes the closed client. * feat(redis): after a timeout, commands fail fast until a probe gets a reply For redis.failFastMs (default 5000) after a command times out, other commands reject unsent with 'Redis unavailable', so a stall costs a request one timeout instead of one per call. After each interval one probe is sent; a reply, or the cluster becoming ready, ends it. Commands sent through sendAsUndo, blocking commands, CLUSTER commands and duplicate() clients are not held back. A pipeline is admitted or rejected as a whole. * fix(redis): undos of a timed-out command are sent while failing fast The metering negation, slot ZREM, upload and credit-hold releases and the lock's token-checked delete go through sendAsUndo, so they still queue behind the original that may land. A command rejected unsent is not a timeout, so it triggers no undo. * test(auth): the sign-in relay completes within one command timeout under a stall /login/set and /login/wait against a cluster whose node never answers now finish in about one timeout, since calls after the first fail fast. * style(redis): one-line comments, and types.ts keeps its existing formatting * fix(redis): releases are sent while failing fast and not waited on The lock release, concurrency-slot release, credit-hold release and upload-lease release and settle go through sendAsUndo, so resources taken before the breaker opened are freed rather than held for their TTL. They are sent without awaiting; later commands on the same key queue behind them. The KV and memory slot backends are still awaited. * fix(redis): a retried pipeline is timed again, and only replies end failing fast Pipeline commands whose error reply cleared their timer are re-armed when the pipeline resends them after MOVED, ASK or a closed connection, and the ASKING command it adds is always admitted. Only a reply, including an error reply, counts as an answer: a closed connection or an ended cluster no longer ends failing fast. * fix(rate-limit): window take-backs are sent while failing fast, and a release never rejects The ZREM or DECRBY that takes back a denied window charge goes through sendAsUndo without being awaited, and the request is still denied. A slot release that throws synchronously is logged, not rejected, and the release() doc says when it settles. * fix(broadcast): a publish failing fast warns once per stretch, not once per event Warnings for publishes rejected with 'Redis unavailable' are skipped until a publish succeeds again; other failures still warn every time. * test(redis): timing bounds name their command timeout and leave CI headroom The relay test sets a 1000 ms timeout and checks it finishes within one timeout rather than two; the release timing bound is 250 ms. * style(broadcast): shorter comment on the publish warning * fix(metering): the cached base is dropped while failing fast, without waiting forgetBase sends its DEL through sendAsUndo, so after a write-through it still queues behind the timed-out increment and its undo instead of being rejected unsent. incr no longer awaits it on the request path; the MeteringService callers still do. * fix(redis): a command rejected while failing fast is handled, so one nobody awaits can't end the process * style(types): unrelated interfaces keep the formatting lint expects * fix(cache): invalidations are sent while failing fast, so a write during a stall doesn't leave the old entry cached --------- Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
9ca1acf634 |
Benchmarks that gate PRs on I/O regressions, wider test baseline, and npm run check (#4644)
* feat(bench): backend benchmarks that fail a PR for waterfalled or uncached I/O A scenario runs a request against the in-memory backend and records every SQL, key-value, Redis and object-storage round trip on a modeled clock, then reports round trips per destination, serial stages and modeled latency. tools/bench.mjs runs the scenarios on a base commit and on the head and fails on a regression the pull request description does not accept; benchmarks.yaml runs that on every pull request. Also adds npm run check (lint, type check, related tests and the benchmark comparison for the files a branch changed) and describes the distributed deployment in AGENTS.md. * test(bench): scenarios for fs, kv, auth, apps, permissions, sharing and hosted sites * test(puter-js): count the SDK unit tests in the coverage report Only the bundle the API runners load was instrumented, so the unit tests next to the SDK source never counted. In coverage mode the vitest config now instruments SDK source for them and writes one shard per test file. * test(puter-js): unit tests for ui messaging, dialogs, components, uploads, peer and smaller modules * test(backend): cover fs, permission, app, worker, sharing, broadcast and user edge cases * fix(backend): fs write flags are stored as booleans, app stats weeks are ISO weeks - A write's boolean flags reach the store only once read as booleans; any positive number reads as true. - App open stats grouped by week use ISO 8601 weeks for both the buckets and their labels on every database engine, so the two agree across a year boundary. * fix(puter-js): dialog token source, legacy upload cancel, submenu state, typed-array views - The sign-in dialog takes the token only from the popup it opened, and stops listening when it leaves the page. - Cancelling a legacy upload rejects with `upload_aborted` and no longer runs the `error` callback. - A context menu's submenu stays in step with its parent when the parent item is pressed or the submenu closes itself. - The FileReader polyfill reads a typed-array view through its own offset and length. * ci(bench): benchmark a pull request as merged into its base The comparison ran the branch's own head against the tip of the base branch, so a branch behind its base was charged for (or credited with) what the base gained since. The head side is now the merge commit and the base side its first parent. Shards also get a 15 minute timeout. * test(broadcast): shutdown drain tests send boot's own events first Boot queues cache updates that flush 10 ms later. A test body that started after that flush counted it as its own request, which failed 'bounds a hung flush in onServerShutdown' on a slow runner. |
||
|
|
bc456982e9 |
feat(metering): events for an actor's balance and for a refusal a listener can make good (#4643)
* feat(metering): report an actor's balance each time it is worked out `metering.balance` carries what an actor on a metered plan has left to spend and the plan it was worked out under. It is emitted when usage settles and when a credit gate re-reads the balance, so an extension can act on a low balance without reading it itself. The balance a settling batch reports now counts the purchased credit that batch drew, so the credit gate and the exhausted notice follow the batch that spends the last of it instead of the one after. A batch that settles right after a credits change still reports the credit as read, since that read may predate the change. `MeteringService.isUnmetered` is public, for callers that need to tell a plan with nothing to run out of from one that has run out. * feat(metering): let a listener top an actor up at the moment of refusal `metering.out-of-credits` is emitted, and waited on, when an actor is about to be refused for lack of credit. A listener that adds credit sets `refilled`, and the refused work is tried once more instead of failing. It is asked from the three places a refusal is decided: the credit gate on routes, the shared credit reservation the AI drivers use, and the chat driver's own gate. Each tries again once, after the listener answers, and refuses as before when nothing was added. * fix(metering): count a flush's write once in a read with no cached base An increment for a counter with no cached base read the store after its buffer snapshot with nothing ordering the two, so a flush landing in between was counted from both, and that store read was then kept as the base. It now reads the store the way other reads do, starting from the increment's own snapshot. A write that has reached the store but is not yet applied to the buffer looks the same from the buffer as one still on its way. `kv.get` can now answer with the last fence token a writer applied to a key, and a read counts such a write's amounts from one side only. A read that sees a write sent between its snapshots is retried. A base is laid from a store read only if no write was out when it was read and none has been sent since. |
||
|
|
e17783931f |
fix(ai): follow-ups to the AI driver stack: optional image type hint, stable fuzz cases, provider-only integration workflow (#4638)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
* fix(ai): the image type hint only has to be a string when a request carries an input image * fix(ai): OpenAI speech to text answers 400 to a prompt that is a list or an object * test(ai): a fuzz case keeps its input and route when the catalog changes, and a suite that reaches no provider fails * fix(ai): a model id with a colon after its vendor keeps its name when it is qualified * fix(ai): the native Gemini request type accepts the xhigh effort Hydrogen takes * style: restore the repo formatting in files the AI stack reflowed * docs(ai): the image reference and quotas page cover Replicate's safety reruns * ci: the AI provider workflow runs only the provider tests and passes every provider's key |
||
|
|
f6139147fd |
Hold the AI concurrency slot until a detached chat completion settles (#4615)
A chat completion keeps running for up to 10 minutes after the caller hangs up, so the upstream can report usage. It now counts against the caller's concurrency cap for as long as the upstream runs, instead of until the response closes. - The chat driver registers its upstream run with the request's concurrency slot, so `/drivers/call` keeps the slot until the upstream is done. The cleanup after it does not hold the slot. - The route concurrency gate now uses the same CallSlot as `/drivers/call`: the slot is held until the response is done and the work the handler registered has settled. The OpenAI- and Anthropic-compatible chat routes register the completion, so a non-streaming call counts until the upstream answers too. - CallSlot moves to core/http, since the route gate below the controllers uses it. The context key is renamed keepConcurrencySlot. - rate-limits-and-quotas.md says a completion counts until the model finishes it, even after a disconnect. Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
b2eb8ed895 |
feat(auth): a first-party page served on its own origin signs in with a session of its own (#4635)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
A deployment can list origins of its own pages in `first_party_session_origins`. When such a page asks the GUI to sign it in, the sign-in hands it a GUI token on a `web` session of its own, parented to the user's sign-in, instead of an app token. The session is minted by POST /auth/first-party-session, which only the GUI's own page script may call, and only as the user's sign-in itself: app tokens, access tokens and a session minted this way are refused. It never gets a session cookie, ends with the sign-in it was handed out under (revoking either takes the tokens minted under the page along), is not counted as a sign-in, and stays up with its sign-in when all other sessions are revoked. The sessions list shows it under its sign-in, titled with the page's host and badged as a site session. |
||
|
|
c253b7e05e |
feat(auth): signups record the request's TLS fingerprint when a fronting proxy supplies one (#4622)
`tlsFingerprintHeader` names a request header that a TLS-terminating proxy sets to the client's TLS fingerprint. When set, the value is exposed as `req.tlsFingerprint`, stored on the new `user.signup_tls_fingerprint` column, passed to `puter.signup.validate`, and forwarded to the phone verification provider when it is a JA4. |
||
|
|
647995133e |
fix(http): responses stay under Node's close-listener limit, starting with WebDAV GET (#4621)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
* fix(webdav): GET pipes the file without stacking close listeners on the response stream.pipeline put seven close listeners on the response. With metering, compression, the concurrency gate and request tracing on top, every WebDAV download crossed Node's ten-listener warning. GET now uses pipeToResponse, like the other file download routes. * fix(drivers): a streamed result stops its source on unpipe instead of its own close listener pipe already unpipes when the response finishes, closes or fails, so the extra close listener only spent part of the response's listener budget. The routes that hold a response open now have a test that keeps each within that budget. * refactor(http): everything that waits on a response's close shares one listener Egress metering, the concurrency gate, the large-body budget, route lifecycle events, driver call slots, disconnect aborts and SSE writers each put their own close listener on the response. They now register callbacks with onResponseClose, which keeps one listener per response and runs them in the order added, so a streamed response holds three close listeners instead of five or six and request tracing has room for its own. * test(webdav): handle streamed response errors in test sink Co-authored-by: Salazareo <25314977+Salazareo@users.noreply.github.com> * test(webdav): a storage failure mid-download is covered against a real response --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Salazareo <25314977+Salazareo@users.noreply.github.com> |
||
|
|
dd32c7f9b2 |
fix(auth): a token whose lookup fails gets the outage error, not token_auth_failed (#4586)
The auth probe used to mark a token as failed whenever authenticate threw, so a database error while checking a valid token came back as 401 token_auth_failed, which clients read as "discard this token". The probe now records the thrown error on the request instead. Routes that require auth hand it to the error handler (503 db_unavailable with Retry-After for a database outage, a generic 500 otherwise); routes that don't require auth serve the request anonymously, as before. Only a token that authenticate reports invalid still gets 401 token_auth_failed. The periodic socket re-check likewise keeps a connection up when its lookup fails, instead of disconnecting it. |
||
|
|
8b68c103c5 |
fix(auth): mint under a full-access token without re-reading its session row, and look token rows up by uid through their indexes (#4588)
* fix(auth): mint under a full-access token from the row auth loaded, and look up token rows by uid with one index per column A token minted by a full-access token now parents to the session row that authentication already loaded and checked for the minting token, instead of reading it again by token uid. The same applies to the session a relay token is bound to. Tokens whose claims name no row of their own still look it up. findActiveByAccessTokenUid now queries access_token_uid first and the legacy uid only on a miss, each through its own index, instead of one OR across both columns. * fix(auth): send both access-token row lookups together, so a miss on the first costs no second round trip |
||
|
|
454f94fc54 |
fix(hosting): serve a launched public app's assets from its billing cookie without re-minting it (#4585)
Same-origin assets of a launched public app carry the launch token in the Referer. When that token's signature verifies and it names the same user and session as a valid public billing cookie (and, for an app token, the same app), the cookie identity is used directly: no re-authentication, no new cookie, no Set-Cookie. Any other combination resolves exactly as before. Responses that do set the public cookie now carry `Cache-Control: private`. |
||
|
|
234994d3af |
Remove the desktop toolbar and nine desktop features, and use puter.js's color picker on the desktop (#4602)
* Remove the desktop's QR login button The desktop toolbar no longer shows a QR code that signs another device into the current session. This removes the toolbar button, its click handler, the UIWindowQR window (its only caller), the qr.svg icon, the window's CSS, and the four i18n keys only that window used. UIQRCode and the qrcode library stay, since 2FA setup still uses them. The ?auth_token= handler in initgui also stays, because the Playwright e2e harness signs in through it. * Remove the desktop's My Websites window The user menu no longer has a My Websites item. This removes the UIWindowMyWebsites window, its menu item, its CSS, the plug.svg icon only it used, and the i18n keys only it used. When publishing a website or worker hits the subdomain limit, the error now shows only the server's message, without the "Manage your subdomains" link that opened the window. The trash handlers keep fading the website badge on a trashed folder and no longer touch the window's rows. * Remove the desktop's Task Manager window The user menu no longer has a Task Manager item. This removes the UIWindowTaskManager window, its menu item, its CSS, the cog.svg icon only it used, and the i18n keys only it used, including the process_type_* and process_status_* keys it built at runtime. The process model in definitions.js, including END_SOFT and END_HARD, stays: windows still register processes, and a process still forwards an end signal to its children. * Remove the desktop's Change Desktop Background window The desktop's context menu no longer has a "Change Desktop Background…" item, or the separator above it. This removes the UIWindowDesktopBGSettings window, its CSS, the palette.svg icon only it used, and the i18n keys only it used. Desktop backgrounds still work: the saved background loads at boot, and an image's "Set as Desktop Background" item still applies and saves it through /set-desktop-bg. * Remove the desktop's Start menu The taskbar no longer has a Start button, so it begins at Explorer. This removes the Start item and its app popover (recent and recommended apps, search, tile context menu, and drag-to-taskbar), along with: - The taskbar's startup /get-launch-apps request and the desktop's app.opened socket handler, which only kept the menu's lists current - The Start popover's search, click and keyboard handlers in UIDesktop.js, keyboard.js, initgui.js and UITaskbarItem.js - The taskbar's handling of items dropped from outside it, and the UITaskbarItem append_to_taskbar option only that path used - The Start CSS, the start.svg icon, and the i18n keys only the menu used The dashboard's recently used apps still load, since the dashboard fetches its own list and launchApp.js still records launches. UITaskbar.test.js now covers the taskbar's item order and that it doesn't fetch launch apps. * Remove the desktop's Search window The desktop toolbar no longer has a Search button, and Ctrl/Cmd+F on the desktop no longer opens the Search window, so it falls through to the browser's find as it already did on the dashboard. This removes UIWindowSearch, the toolbar button and its handler, the window's keyboard handling (arrow keys, Enter, Escape) and click-outside close, its CSS, the search.svg and magnifier-outline.svg icons only it used, and the i18n keys only it used. The backend /search endpoint is unchanged. * Remove the desktop toolbar The desktop no longer has the toolbar at the top of the screen, so its Puter logo, guest Save Account button, and account menu are gone from the desktop. Log out, account switching, language, settings, and contact all remain on the dashboard. Removed: - The toolbar markup, its auto-hide logic and mouse tracking, its right-click menu, and the account menu with its click handlers - The modify-user-options-menu GUI extension, which only added a Developer item to that menu - UIWindowFeedback, the desktop's Contact Us window, which only the menu opened; the dashboard keeps its own contact dialog - Toolbar hooks elsewhere: the hide_toolbar() call on window maximize, pointer-events toggles during window and item drags, the click guard in initgui, the account-button toggle in helpers.js, and the avatar sync for the toolbar's profile image in TabAccount - The toolbar and feedback CSS, the toolbar's two KV keys from the puter.js GUI read cache, and the i18n keys only these used window.toolbar_height stays: it was already 0, so window and desktop layout are unchanged. The welcome window keeps its backdrop stacking. * Remove the desktop's Share window The right-click menu on desktop and Explorer items, and on items in open and save file dialogs, no longer has a Share item. This removes UIWindowShare, that menu item, the share-outline.svg icon only it used, its CSS, and the share_with and share_row_team i18n keys only it used. The Dashboard keeps sharing through UIShareModal. generateFileContextMenu no longer falls back to the removed window, so it offers Share only when the caller passes onShare, which the Dashboard's Files tab does. The share dialog layout classes the Blocked Senders window uses, and the recipient suggestion styles the share modal uses, stay. * Remove the desktop's Welcome window New desktop users no longer see the Welcome window on their first visit. This removes UIWindowWelcome, the first-visit check in UIDesktop that opened it, its CSS, the welcome_* i18n keys only it used, and the UIWindow backdrop_covers_toolbar option only it passed. has_seen_welcome_window is also dropped from the puter.js GUI boot read cache. Values already saved under that key stay in KV, unread. * Replace the desktop's color picker with puter.js's picker puter.ui.showColorPicker() inside Puter now opens puter.js's own <puter-color-picker>, the one it already shows on websites outside Puter, instead of the desktop's iro-based window. Apps get the same answer everywhere: a lowercase 6-digit hex string, or null when the user cancels. Inside Puter it used to resolve to an 8-digit hex with alpha, or undefined. This removes UIWindowColorPicker, UIColorPickerWidget, iro.min.js and its lib-list entries, and the select_color i18n key only that window used. The GUI loads puter.js from js.puter.com, so the IPC handler doesn't rely on this branch's component: it drops the alpha from an 8-digit default, leaves out a default that isn't a 3- or 6-digit hex, and removes the picker once it answers. <puter-color-picker> drops the alpha from an 8-digit default instead of failing to open, opens on its own color when the default isn't valid, and removes itself when Escape closes it. showColorPicker()'s type and docs now give the 6-digit return value and null on cancel. * Remove the desktop's Publish Worker window The right-click menu on .js files on the desktop and in Explorer, and in open and save file dialogs, no longer has a Publish as Worker item. This removes UIWindowPublishWorker, that menu item, its CSS, and the pick_name_for_worker i18n key only it used. The Dashboard keeps publishing workers through its own dialog. generateFileContextMenu no longer falls back to the removed window, so it offers Publish as Worker only when the caller passes onPublishWorker, which the Dashboard's Files tab does. * Add a Language setting to the dashboard's Account tab The desktop toolbar's account menu was the only place to change Puter's language, so removing the toolbar left no way to change it. The Account tab now has a Language card that shows the current language and opens a dialog listing every supported language by its own name. Saving a new one stores it on the account and reloads the page in it. changeLanguage() now returns false when the language can't be saved, so the dialog can show an error instead of doing nothing. The change_language key comes back in every locale, and language_save_failed is new. |
||
|
|
d8c3e01dd9 |
fix(http): parse large JSON bodies in slices; store WebDAV uploads labeled as JSON (#4563)
Maintain Release Merge PR / update-release-pr (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
release-please / release-please (push) Canceled after 0s
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
JSON request bodies over 32 KiB are parsed in slices, with the event loop running between them, instead of in one JSON.parse call. Reading, limits, decompression, req.rawBody and the errors stay as express.json has them. Large bodies parse one at a time. Gemini TTS and video replies use the same parser, and their base64 is checked and decoded 1 MiB at a time. A profile picture is sized before its pattern runs, so one of several megabytes gets a 413. Body parsers skip the dav subdomain: a PUT labeled as JSON or form data was read by them and stored empty, or refused. puter.js sends auth_token as the first field of a driver call. A chat body over 50 MiB that opens with a valid token is accepted up to 128 MiB, as one with a header credential is. JSON in a charset other than UTF-8 is now limited to 1 MiB, and a body over 32 KiB nested deeper than 10,000 levels is refused. |
||
|
|
af35783df4 |
Test native app hosts with apps still served natively (#4535)
editor, markus and pdf moved to standard host routing, but the host redirect and embed framing tests still used editor as their native app, so they failed. They now use about, and a test checks that editor, markus and pdf are passed through even with a folder under the native apps root. |
||
|
|
3ff70ef97f |
Remove web apps from native host redirects
Allow the `editor`, `markus`, and `pdf` subdomains to use standard host routing. |
||
|
|
7f0cd1689b |
fix(embed): only sibling subdomains not served by core can frame the app browser (#4515)
/embed/apps now names the referring origin in frame-ancestors only when it is exactly one label under the domain and that label is not one the server answers itself (api, dav, js, www, native-app hosts) or the host of api_base_url. Nested subdomains are refused too. The query-string redirect now checks the raw URL instead of the parsed query, so every request carrying a query string is redirected. |
||
|
|
d3869b7846 |
feat(notifications): dismissal across devices, high priority, buttons, schedule updates, docs fixes (#4501)
- Docs: status(), browser limits, events worker fetch/ack, update() across
pages, stored-notification retries, device removal, push delivery, queue
coalescing, existing service workers and missing error codes match the code.
- puter.notifications.markShown(uid) / dismiss(uid).
- Dismissals reach the app's live feed (on('dismiss')); pages close the
notification on screen, and a later page load closes ones already dismissed.
The desktop closes its own copies on notif.ack.
- Live notification postings are forwarded to sessions in other regions.
- notify({ priority: 'high' }).
- onPush() results accept requireInteraction and actions; clicks carry action.
- replaced reaches service-worker onPush() handlers.
- puter.events.updateSchedule(scheduleId, changes), with the invoker
re-checking a schedule run's guard right before it is sent.
|
||
|
|
23782dec12 |
feat(events): inline handlers in the user's own scope for onSchedule and onPersistent (#4487)
release-please / release-please (push) Canceled after 0s
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Maintain Release Merge PR / update-release-pr (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
* feat(events): schema for user-scope handlers Add event_user_handlers and event_subscriptions.handler_scope in all three dialects. event_handlers is unchanged. * feat(events): scope the handler and durable subscription stores Handler store methods take a scope (app, or a user's scope of an app) and read the matching table. App-scope behavior, SQL and cache keys are unchanged; user scopes get their own cache keys, a 20-handler cap, and the inline @<sha256> name. Adds user-scope listing, counting, deletion and unbound-handler reads. Durable subscriptions store and return handlerScope, and listByHandler filters by scope and holder. * fix(events): hold the user-scope handler cap under concurrency and drop all scope caches on app delete A create that lands past the cap removes itself and is refused. deleteForApp drops each holder's cached set in batches, here and on peers. Batch scans over user scopes and unbound handlers take limit and cursor. * feat(events): set a CPU limit on events worker deploys * test(events): cover redeploy and resend of an evicted events script * test(events): name the deploy-on-miss test for what it checks * fix(events): keep a deploy-on-miss call inside the delivery lease * feat(workers): cap rented units per plan and refuse only new ones * feat(events): publish handlers into a user scope, with inline create * test(events): cover user-scope publish, inline create and listing * test(workers): name the credentials gate without a vendor * feat(events): run user-scope handlers as the holder A user scope deploys one script per handler under the holder's own identity, throttled per scope, with an eager deploy after publish that skips an upload another holder already made. Delivery and schedule runs address the holder's handler, carry the holder on the invoke headers, batch calls, the miss handler and the rehydrate route, and stay owed while the flag is off. Suspensions of a user scope notify the holder, teardown (app delete, consent revoke, account delete) drops the scope, and a job deletes unbound handlers after a day. * test(events): cover user-scope deploy, address, notices, teardown and the sweep Runs an inline user-scope handler through the local worker runtime as its holder, and covers the holder on the wire, the flag-off path, revoke and account-delete teardown, and the unbound-handler sweep. * test(events): a lagging replica read does not suspend a user-scope schedule run * feat(puter-js): inline user-scope handlers and scope option for handlers and workers * docs(events): document inline and user-scope handlers, with playground examples Cover inline handlers on onSchedule and onPersistent, handlerScope, the scope option on handlers and workers, the user-scope limits and rented units, and the new error codes. Add six playground examples and pin the new limit constants in limits.test.ts. * feat(schedules): carry the handler scope on the schedule view * docs(events): describe user-handler cleanup, schedule handlerScope and suspension notices * fix(events): gate the rented-unit cap on user handlers and let an account session destroy its own user scope * fix(events): keep user-scope rows off app handlers across mixed versions and bound their deploys and reads Cached durable rows carry an explicit scope marker; an unmarked entry with a handler is resolved from the table and rewritten. User-scope rows are parked before credit checks, billing, client delivery and suspension while the flag is off. Delivery-time handler checks and addressing share the replica cache entry. Concurrent eager deploys of one user-scope script upload once. * fix(events): keep a user scope's age across handler churn for rent event_user_handlers.scope_since records when the scope first held a handler. A new row takes the scope's existing minimum, so replacing code does not make the scope look newer to the monthly sweep. The count uses it instead of the oldest remaining handler's created_at. * fix(events): drop cached entries no row backs; document account-session scope destroy * test(jobs): list the user-handler sweep among the system jobs * fix(events): let the user-handlers migration apply on its own * fix(events): fail a cached-row read whose scope lookup fails instead of returning app-scope rows * fix(events): touch a reused user-scope handler before binding so the sweep cannot take it * fix(events): bound the deploy-on-miss wait by the call's deadline |
||
|
|
d934a47c5e |
feat: jobs and schedules (#4467)
* feat(db): add nowMsExpr, the database clock in epoch milliseconds, and share the retry backoff
* feat(config): type the jobs config as an augmentable IJobsConfig and resolve its namespace in one place
* feat(jobs): add JobScheduler for fleet- and region-wide system jobs
* refactor(jobs): run core's periodic sweeps as system jobs, and publish the generation bumps of reaped subscriptions
* feat(events): seams for schedules run by an extension, with events_disabled where none is installed
* feat(notifications): add notification.send_key, the deferred mailbox write and notify({ sendAt }) through the schedules contract
* feat(puter.js): schedules, notify({ sendAt }) and notifications.cancel(), and treat a 503 events_disabled as final
* docs(events): document schedules, sendAt and cancel(), with recipes
* fix(events): stop resuming a holder's later pages once the credit sweep's signal aborts, and keep its checkpoint
* fix(events): pre-release fixes for jobs, schedule seams and delayed sends
- The delayed-send write is a field on the notifications driver, not a
method, so /drivers/call can't reach it.
- A delayed send checks for its own earlier write by uid, so it takes no
gap lock that every other notification insert waits on.
- The notification send_key index builds in place without locking writes.
- Reaps re-check expiry and suspension on the primary, so a row resumed
since the replica read is kept.
- Revocation settles skip schedule rows they can't settle.
- An empty handler set read from a replica is re-read on the primary.
- One ended notice per settle, not one per page.
- Sweeps that run once per fleet take more batches per run.
- The global usage rate check keeps its 14-minute minimum window.
- shutdown() waits for prepare hooks a drain already started.
* fix(puter.js): quota refusals are final, and schedule error codes match the server
Schedule, subscription and handler quota 429s no longer go through the
generic retry. ScheduleErrorCode lists what the schedule methods throw,
and the notify({ sendAt }) overload has type tests.
* docs(events): schedule and delayed-send accuracy and style pass
Spread and send-time wording match the runner, the per-user runs-at-once
and rate-limited stored notification limits are published, and the new
pages follow the docs writing rules.
* docs(events): add the Change Data at a Set Time recipe
A one-time schedule that changes data when it runs, cancelling and moving
it, and a repeat-a-few-times variant with maxRuns.
* fix(events): delayed sends recheck the app's access when they fire, and a handler set missing the run's handler is re-read on the primary
Also stops job polling at drain start and marks replayable notification sends.
* feat(events): batch handler invocations to the events dispatcher
Invocations that come due within a few milliseconds go out as one
/invoke-batch request (up to events.invokeBatchSize, default 60). The
dispatcher runs a few at a time and streams a started line and an answer line
per call, so a slow handler delays no other call's answer. A call's timeout
runs from its started line, so time queued behind other calls is never the
handler's; queue time comes out of the connection-wait share instead, and a
call still queued past it is never started and fails as Puter's.
A lone call still uses /invoke, and a dispatcher without the batch route gets
single calls for five minutes before the batch route is tried again.
|
||
|
|
58456ae87c |
fix: signup gate order (#4474)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Maintain Release Merge PR / update-release-pr (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
release-please / release-please (push) Canceled after 0s
|
||
|
|
18fd655645 | fix: sec improvements (#4469) | ||
|
|
dd144b6b64 |
feat(notifications): notify through KV shares, group replacement, fewer push prompts, and events/worker fixes (#4432)
* feat(perms): add a pushNotifications resource to puter.perms.request
notifications:push gets a resource like backgroundEvents, so it can be
batched with other access behind one prompt. requestPermission() and
hasPermission() ask through it.
* fix(puter-js): read puter.gui_features once at load
The desktop's feature list was read from location.search on each call, so
an app whose router rewrote the URL lost it and enablePush() and the other
desktop dialogs answered as if the desktop lacked them.
* feat(gui): ask for notifications:push when an app calls enablePush without it
enable() and enablePush() inside the desktop answered unavailable for an
app without the push permission. They now show the permission dialog,
whose Allow also starts the browser registration, and answer with the
browser's push state once it settles, or off when denied. A browser that
blocks notifications or has no push service still answers without a
dialog.
* fix(kv-share): charge mint and grant budgets only for share calls that change something
A share call now spends the per-call mint budget and the per-recipient grant
windows after it has looked up which recipients already hold the share. A call
whose recipients all hold the share at the requested level and label spends
neither. Recipients without the share, including unknown usernames and refused
recipients, still spend a grant unit each. Every named recipient spends from a
new 1,200/min lookup window before any lookup runs.
* perf(events): skip the subject split for rows not made through a share handle
kvHandleFromSubject checks the stored subject's kv:kvh- prefix before
splitting it, so own-namespace and fs rows return null without parsing.
* feat(notifications): resolve enable() on a website before the confirmation push
enable() waited up to 30 seconds for the confirmation push, so a prompt
the same click started next had lost its activation. On a website it now
resolves once the browser answered and the server has the subscription,
records the opt-in, and finishes the confirmation in the background. A
failed confirmation goes to onPush's onError and the next load's resync
tries again. disable() and sign-out stop a confirmation still waiting.
The GUI keeps waiting, since it reads the registered device right after.
* fix(notifications): show a page's own notifications only while push is on
A hidden page with an onPush handler kept showing notifications after
disable(), and its receipts kept claiming showsOwn, which held pushes back
from the user's other devices. Both now need the user's opt-in, cached in
the page, refreshed on enable, disable, sign-out and each sync, and re-read
when another tab of the site changes it.
* fix(events): leave subscriptions suspended for good out of the durable quota
countForHolder no longer counts rows suspended with a reason that never
resumes (permission_revoked), in both the pre-insert check and the recount
after insert. Rows suspended for a resumable reason still count. The store now
owns the list of terminal reasons, and isResumable reads it.
listActiveForHolder with includeSuspended returns only rows suspended for a
resumable reason, so its quota-sized read still covers every row a revocation
has to settle. Each holder keeps at most 500 terminal rows; a subscribe past
that deletes the oldest ones.
* feat(notifications): add status() to read whether pushes reach this browser
status() resolves 'on', 'off', 'blocked' or 'unavailable' without asking
anything. On a website it reads the notification permission, this
browser's subscription and the user's opt-in. Inside the desktop a new
pushStatus IPC, advertised as push-status, answers the browser's push
state, 'on' only while the app holds notifications:push.
* feat(notifications): disable() inside the desktop revokes the app's push permission
disable() did nothing inside the desktop. A new disablePush IPC,
advertised as disable-push, revokes the calling app's notifications:push
grant through the same route Settings uses, so its notifications stop
going out as pushes and a later enable() shows the permission dialog
again.
* feat(notifications): allow @ in a notification group, up to 128 characters
A group is an opaque display tag, hashed for the Web Push topic and used
as the notification tag, so it can carry identifiers such as an email
address.
* docs(notifications): say when a page with an older Puter.js holds a push back
* fix(notifications): let disable() win over an enable() still in flight
An enable() whose subscription reached the server after a disable() went
on to record the opt-in, so the next page load turned pushes back on. It
now rejects with push_verification_canceled and records nothing.
* docs(notifications): list push_verification_canceled and reword sentences that led with code
* fix(events): carry KV values through a share handle only at read or write
The delivery re-check now reads the share's level off the live handle along
with whether it still holds. A row on a watch share loses its includeValue for
that delivery, so its events name the key without the value; the owner's own
rows on the handle keep theirs. Decided per delivery, so raising or lowering a
share applies to subscriptions already made, and subscribing with includeValue
at watch is still accepted.
The live-updates recipe now shares at read, which its events need to carry
the score.
* fix(events): retry worker runs Puter could not complete without counting them
Invocations that never reached the handler (transport and dispatcher errors,
unmarked answers, failed or throttled deploys, no configured runtime, a bad
invoke key or missing token) now report an 'unavailable' outcome. So does a
handler that throws after one of its own puter.js calls got a 5xx, 429 or
network error from Puter's API, which the events runtime reports as
'platform-error'. Those runs back off like retriable ones, honor the answer's
retry-after up to the backoff ceiling, and no longer count toward the
consecutive-failure suspension. A run past the invoke timeout still counts.
* test(notifications): cover the pushNotifications resource and status() in the API suites
* test(gui): Allow on a batch that includes notifications:push turns push on
* fix(events): hold a share-handle row's backlog when its share can't be checked
The share-handle delivery check now tells a share that is gone (handle not
live, not the row's holder, identity gone, grant withdrawn) from one it can't
check right now (a lookup that throws, an owner who is suspended). Only the
first settles a queued row as permission_revoked and purges its backlog. The
second delivers nothing, leaves the row in service with its backlog, and sends
it to the back of the sweeper's line, so delivery resumes once the lookup
recovers or the owner is unsuspended. A revocation settle skips such a row and
leaves it to the delivery check. kvSharedRegionAuthorized returns null when
the permission check throws, and that answer is not cached.
* feat(events): update a persistent subscription's context in place
POST /events/subscriptions/update replaces a durable row's context, with the
same validation and 4 KB cap as subscribe, keeping its subId and backlog. The
row's owner region cache is rebuilt from the table and the generation bumped so
every region delivers the new value. It spends the subscribe call budget.
puter.events.update(subId, { context }) wraps it; null clears the context, and
a function handler this client registered for the subscription gets the new
ctx.
* fix(events): serve a fan-out's holders in turns and cap values per delivery
#route now orders an event's candidate rows before any cap applies: the
keyspace owner's rows first, then the other holders taking turns, one row per
holder per round, starting from a random holder each event. The filter
evaluation cap, the delivery cap and the gap markers all count in that order.
Values no longer drop for every delivery once more than 128 rows match or the
filter evaluation stops early. The first 128 deliveries that asked for the
value carry it, in serving order, and later ones carry the key alone.
EVENTS_KV_VALUE_OMIT_MATCHED_SUBSCRIPTIONS becomes
EVENTS_KV_VALUE_DELIVERIES_PER_EVENT. The caps themselves are unchanged.
* fix(email): file inbox mail as a delivery, not the request actor's write
storeInboxMessage and copyIntoInbox now run their filesystem writes with a
platformWrite context flag, and fs event dispatch leaves actingUserId unset
under it. Mail filed into an account's inbox from inside that account's own
request (an app mailing the signed-in user) is delivered with self: false, the
same as external ingress. Handler depth and viaWorker are still carried from the
actor.
* feat(notifications): raise the default daily app message limit to 1000
The per-day default for `app.message` goes from 300 to 1000 per user and
app, matching the daily push cap. The per-minute default stays at 30, and
`notificationAppMessageLimits` still overrides both.
* feat(notifications): look up an unseen notification by group
`notification` gets a nullable `group_key` column, a sha256 hex digest of
the group a row was written with, indexed on (user_id, app_uid, group_key).
`NotificationStore.create` takes a `group`, and `getUnseenByGroup` returns
the newest row an app wrote for a user under that group that is neither
shown nor acknowledged. Rows written before the column exist never match.
`updateValue` takes `onlyUnseen`, which also skips a shown row, and
`refreshCreatedAt`, which dates the row to now.
Migrations: sqlite 0098, mysql_mig_52, postgres_mig_41.
* feat(notifications): replace an app's unseen message in the same group
An `app.message` with a `group` now replaces the app's earlier notification
to the same user with that group while it is neither shown nor
acknowledged. The row keeps its uid and takes the new value and time. With
no group, or once the earlier one was shown or dismissed, it is a new
notification as before.
A replacement spends a per-minute slot but no per-day slot. If the earlier
row is marked between the lookup and the rewrite, the message is written as
a new notification and spends a day slot then.
`app.message` is groupable, so the replacement goes through
`notifyUpdate`. For types kept off the desktop, `notifyUpdate` skips the
desktop wire and dispatches the rewrite again under the same uid, so app
subscribers and receipts see it, and `notif.written` carries `updated`.
The driver's write path takes the recipient id rather than the actor, so
rate limits key on the recipient.
* feat(workers): report the app a worker runs as
workers.create now returns app_uid and app_name for the app its token is bound
to (null for a user-scoped worker), and list/get items carry app_name beside
app_uid from the app rows they already load. The dev center workers table shows
an App column, and the SDK typedefs and docs describe the fields and that a
sandboxed worker's notifications and pushes come from its sandbox app.
* feat(events): refuse handlers with free variables on REST publish
POST /events/handlers/publish and /publishAll now run the SDK's own
scanHandlerSource on each source before publishing and answer 400
events_handler_free_variable, naming the identifier. The backend imports the
module from src/puter-js; the build marks dist/src/puter-js as an ES module
package so the compiled backend can require it. Sources over the per-handler cap
are left to the store's size refusal rather than tokenized.
* docs(events): say Puter-side retries never suspend and stay within backlog caps
* fix(events): redeploy an events worker that answers bad-key
A script deployed before the internal secret rotated keeps the old invoke key,
so every invocation answered bad-key and nothing redeployed it. A bad-key answer
now goes through the same miss handler as a dispatcher miss (the deployer, with
its hourly throttle) and is retried once with the deployed header. A throttled
or failed redeploy stays 'unavailable' and backs off without counting.
* perf(events): check the deploy throttle before reading handler sources
EventsWorkerDeployer now reads the app's handler names and hashes first,
answers no-handlers or stale from those, and checks the hourly deploy throttle
before loading the sources and generating the worker. A throttled retry costs a
hash read and a counter bump instead of a full source read and build, and a
stale request still does not spend the throttle. The generated set is checked
against the script again in case it moved between the two reads.
* fix(workers): move a redeployed worker's row to the app it now runs as
Redeploying an existing worker under a different app minted the new app's
token but left subdomains.app_owner on the old one, so list/get and hot-reload
kept naming and minting for the old app. The redeploy now sets app_owner to the
binding #resolveWorkerAppBinding authorized (null for a user-scoped worker)
through a new SubdomainStore.setAppOwner, since app_owner stays read-only to
update patches.
* fix(workers): revoke the old binding's worker session on a rebind
A redeploy that binds a worker to a different app (or to none) now deletes the
owner's worker sessions under that name other than the one for the new binding,
through the same deleteWorkerSessionsByName path worker deletion uses (which
also announces the revocation and drops access-token grants). SessionStore's
deleteWorkerSessions takes an exceptAppUid filter for it, null meaning the
user-scoped session. The app_owner move and the revocation now both run only
after the new script deployed successfully, so a failed redeploy leaves the
live script, its token and the row on the old binding.
* feat(kv-share): store a notify flag on share handles
kv_share_handles gains a notify column, off by default, so every existing
share reads as not allowing notifications (sqlite 0099, mysql_mig_53,
postgres_mig_42). The store reads it on every row, including the live
handle cache and the holder listing, writes it on mint, and changes it
through update().
* feat(kv-share): let the owner turn notifications on for a share
POST /kv/shares and puter.kv.share() take notify, off by default. Leaving it
out of a re-share keeps the stored value, and turning it on or off counts as a
change, so it spends the mint budget. Turning it on for a holder who now
refuses the owner's shares is refused, like a raise or a new label.
The kv.share.received notice is sent only when a share starts carrying
notify: a new share made with it, or an existing one switched on. Its hourly
bound and the app-less namespace exclusion are unchanged.
The share response, the owner's listing and the holder's listing report
notify.
* feat(kv-share): resolve the other party of a share for a notification
KvShareService.resolveNotifyRecipient(actor, handle) returns the recipient
user id, app uid and handle for a notification one party of a share sends
the other through its handle. The handle must be live with an unsuspended
owner, the caller must be its owner or holder acting from the app whose data
it is, the share must have notify on, the holder's grant must still stand,
and the recipient must not refuse shares from the sender.
An unknown, retired or foreign handle, a caller who is not a party, and a
caller in another app all get subject_does_not_exist. The account itself gets
forbidden, a share without notify kv_share_notify_not_enabled, and a lookup
that fails service_unavailable. Once every check passes it spends one unit
from KV_SHARE_NOTIFY_LIMITS (30/min, 500/day per sender, recipient and app),
peeking both windows first so a refusal spends nothing.
* feat(notifications): hand a replaced notification to listeners again
A replacement now records `replaced_at` (epoch ms) on its row, added to the
same unreleased migrations as `group_key` (the sqlite file is renamed to
0098_notification-groups.sql). Its live event and its fetched copy both
carry `replaced: true` and use that time as `ts`, so the pair versions the
uid identically on both paths.
`onNotification()` dedupes on uid plus that version: an original counts as
version 0 and a replacement as its `ts`. A newer replacement is handed over
again with `replaced: true`, while a copy already handed over, a replay, or
an older state is dropped. Listeners started with `catchUp: false` still
get replacements of what was already there.
* fix(notifications): replace only the newest notification in a group
The group lookup takes the newest row an app wrote under the group and
returns nothing when that row was shown or dismissed, instead of falling
back to an older row that is still unseen.
The docs state the rule as it is: a grouped notification replaces the
newest one in its group unless that was shown or dismissed. Puter.js
marks neither, and the only thing that does is a tap on the push inside
the Puter desktop, which dismisses it.
* feat(notifications): notify the other party of a KV share through its handle
`app.message` takes `to: { handle }`. The driver validates the message,
then `to` must be an object with only a non-empty string `handle`, else
400. `KvShareService.resolveNotifyRecipient` checks the share and spends
the pair limit, and the message is written for the share's other party in
the share's app. The recipient's per-app limits and group replacement
apply to their own rows, and the push is billed to them through
`notif.written`.
A call with `to` answers with `{ uid }` only, so nothing about the
recipient's row reaches the sender. puter.js gets the
`NotificationRecipient` type for `to`.
* docs(notifications): document notifying the other side of a KV share
notify.md covers `to: { handle }`: who can be reached, the errors, the
recipient's limits plus the per-pair share limit, the uid-only return and
that the recipient pays for pushes. push.md and rate-limits-and-quotas.md
point at the share path. The chat notification recipe sends through each
share's handle and keeps the per-member handler only for members who need
to reach each other; the alert recipe says when its handler is the right
fit.
* fix(notifications): reveal nothing to the sender of a notification through a share
A call with `to: { handle }` answers with an empty object, and puter.js
resolves it with no value: a uid would show whether the recipient's last
notification in a group was replaced. `notify()` gets one overload per
form, and `ShareNotificationInput` is exported.
Over the per-pair share limit or the recipient's own limits, such a call
gets the same 429 `too_many_requests` with the same generic message, so the
sender can't tell which limit it hit.
* fix(notifications): serialize grouped app messages per group
Grouped app.message sends take a Redis lock on (recipient, app, group) around the lookup and the replace-or-insert, so concurrent sends to an empty group write one row and spend one day slot. A lock still busy after the wait, or an unreachable Redis, sends unlocked as before. Sends without a group take no lock.
* fix(events): attribute Puter API failures to the invocation that saw them
The events worker runtime counted Puter API failures on the cached per-token client, so a concurrent invocation on the same token could answer platform-error for its own unrelated throw. A cached client now serves one invocation at a time and records failures and retry-after on that invocation; an invocation overlapping another on the same token gets its own client, and idle clients stay cached per token.
* fix(events): drop KV values from a queued backlog once its share is at watch
A queue delivery is stored with its value. Every hand-out of a stored
entry (backlog drain to a socket or another region, the worker, and a
declined delivery passed to the worker) now re-reads the share's level
and removes the value at watch. A share that can't be checked still
holds the backlog.
* fix(events): return notifications replaced behind the fetch cursor
The notification fetch cursor now holds the last row id and the last
(replaced_at, id) it returned. A read from it merges two indexed reads:
rows inserted after the id, and rows up to the id replaced after that
mark. A replacement made while a client was away therefore comes back
on its next catch-up. Adds idx_notification_replaced on (user_id,
audience, app_uid, replaced_at).
|
||
|
|
faa8cd99dd |
fix(kv): per-holder share of the KV handle budget (#4433)
* fix(permissions): chunk the exact-match subtree delete The holder-scoped subtree delete names every matched grant, so a large subtree could exceed an engine's limit on bound parameters. It now deletes 500 grants per statement. * fix(kv): give each holder a share of a namespace's handle budget One holder could spend a namespace's whole handle budget and starve the others. Each holder now gets at most 3,750 of the namespace's 15,000 units per 10 seconds, and the owner's own calls through a handle spend none. The holder's budget is checked before the grant lookups, so throttled retries cost none; the namespace's is only told to callers the grant admits. Multi-unit charges use a new counted claim that keeps two counters per key instead of a sorted-set member per unit. |
||
|
|
a1fe14cbd5 |
fix(ai): bound large AI request bodies per user and to chat (#4420)
Follow-up to #4408. The 503 returned when a process holds too many large bodies is load shedding, so it records an info alarm instead of a critical one. One user can hold at most 128 MiB of large bodies at once; past that the request gets 429 with Retry-After, so a single account can't take a process's whole budget, e.g. with slow uploads. Through /drivers/call only puter-chat-completion takes a body over 50 MiB; other drivers keep the default limit and get 413. The check reads the parsed body's interface, since route matching ignores case and trailing slashes. |
||
|
|
a195605003 |
fix(ai): accept 128 MiB Anthropic message requests (#4408)
* fix(ai): accept larger Anthropic message requests * fix(ai): accept 128 MiB bodies on /drivers/call and OpenAI routes Extend the 128 MiB JSON limit to /drivers/call (puter.ai.*) and the OpenAI-compatible routes, alongside the Anthropic ones. A body over the default 50 MiB is read only after a header or cookie credential resolves; otherwise the global parser rejects it with 413, so unauthenticated callers can't make the server buffer and parse 128 MiB. Large bodies skip the rawBody copy, and a per-process budget caps how many bytes of them are held at once, returning 503 with Retry-After past it. The prompt token estimate no longer splits text on whitespace, which took seconds and allocated a string per word on large prompts. It counts whitespace runs in a loop, scans at most 1 MiB per prompt and extrapolates the measured density past that. --------- Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
7c6c0f2d39 |
fix(ai): finish async media accounting and recheck output access (#4365)
* fix(ai): finish async media accounting and recheck output access * fix(ai): settle late media jobs on their outcome and keep their slot A job still running when the poll window closes no longer charges its estimate up front. The caller still gets the 504; the job is followed in the background, holding its credit, until it settles, and is metered from the provider's outcome: what it reports, nothing for a failure that reports no cost, the estimate only if it never settles. The driver concurrency slot is now held until the handler and any work it carries on after the response settle, so a disconnect no longer frees a slot while polling continues. A revoked puter_output_path is reported as metadata.outputSaved = false. * fix(ai): bill a lost media job the same in and after the window A poll error that isn't transient now ends the same way whether it hits inside the window or after it: a client-error refusal is a failure the provider doesn't bill, while auth, not-found and unclassified errors mean we lost a job the provider still runs, charged its estimate. A Hailuo clip already billed retries a transient file lookup instead of failing, and a concurrency slot renews from the moment it is held. |
||
|
|
7bccde40a8 | fix(hosting): use the current authenticated visitor for asset billing (#4364) | ||
|
|
bbc056cc49 | fix(hosting): track trashed roots and cached backing misses (#4363) | ||
|
|
24aac2f6d2 |
fix: app token (#4338)
release-please / release-please (push) Canceled after 0s
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
Maintain Release Merge PR / update-release-pr (push) Canceled after 0s
|
||
|
|
589a98b12c |
feat(kv): share KV prefixes with other users at watch/read/write, and bound what apps can be granted (#4331)
* feat(kv): share key-value prefixes with other users, and bound what apps can be granted - KV share handles move out of Events into KvShareService, served at /kv/shares (the /events/kv-handles routes stay as an alias). - Shares have watch, read and write levels, encoded in the permission root (kv-share, kv-share-read, kv-share-write) with write implying read and watch. - Every puter.kv method takes optConfig.handle; keys are relative to the shared prefix, cursors are sealed, and private entries stay hidden. - New puter.kv.share, unshare, listShared and listSharedByMe; optional label; kv.share.received notice in the app's mailbox only; recipient blocks apply. - puter.kv.set gains onlyIfAbsent. - fs and kv events gain viaWorker, and kv events report self from the writer. - /auth/grant-user-app only accepts canonical permissions from a fixed set of families; the consent dialog, puter.perms and docs follow. - Migrations: kv_share_handles gains revoked_by, label, and grantee and app indexes (mysql_mig_49, postgres_mig_38, sqlite 0095). * fix(kv): never name a private key in a cross-app or handle cursor, and bound flat-permission scans - Listings of another namespace (cross-app or through a handle) resume after the last entry they returned, and their cursors are sealed, bound to the namespace or handle, and padded to one length. Old plain cross-app cursors are still read when they name the target namespace; other namespaces get 400. - PermissionStore scans flat permissions a few roots at a time and skips roots nested under another root in the same call. |
||
|
|
03e483e372 | PUT-2252 (#4311) | ||
|
|
80a9cd85ee |
fix(ai): chat requests run to their upstream usage report after the caller disconnects (#4302)
- Providers send upstream calls with a driver-owned `upstreamSignal` instead of the caller's `abortSignal`. A disconnect detaches the chat stream: output stops, the provider keeps reading until the upstream reports usage, and that usage is metered. - A detached stream gets SDK_TIMEOUT_MS to finish. After that the driver aborts the upstream, and the stream is metered like any other stream that ends without usage. - The disconnect check also runs right before dispatch. - The OpenAI stream handlers report usage that arrived before an abort. - Docs: stopping a stream stops the output, and a request that reached the model is billed in full. Detached streams get 10 more minutes. |
||
|
|
1627650abc |
refactor: make teams an optional feature (#4248)
release-please / release-please (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Maintain Release Merge PR / update-release-pr (push) Canceled after 0s
* refactor: let core run without a teams registration
Teams becomes optional: `services.team` and `stores.team` may be absent, and
core stops assuming either is there.
Seventeen call sites across share, signup, account deletion and the homepage
now degrade instead of throwing: a team recipient that cannot be resolved is
"no such recipient" rather than a fault, a group share folds in nothing, and
account deletion stops asking what a seat was charged for. This generalises
the pattern `gates.ts` and `SocketService` already used.
Teams' own files take a private handle to their store and service, so the
feature's code stays free of optionality that only core needs.
No behaviour changes where Teams is registered.
* refactor: put a contract between core and teams
`core/teams.ts` holds the shapes core reads and the calls it makes, and the
registries declare the pair as provided rather than built in. The service,
store and controller are registered by whatever runs the feature.
Typing them properly turned up eight AuthController call sites the previous
commit could not see: the controller reads its stores from the built-in
registry, so an absent `team` fell to an index signature and typed as
`unknown` instead of erroring. They now go through the same optional path as
the rest.
The feature's own tests move with it. The cases in core suites that build a
team to exercise a core rule still need relocating, so those suites are red
here.
* test: stub core's seat rules, rehome the rest with the feature
A core suite can no longer build a team, so the rules that refuse a seat get
`testFixtures/seatStub.ts` instead: it answers the contract, which is all
those rules read, and puts the registry back when the test ends.
Seventeen cases move that way. Four could not: group shares and a seat's 2FA
enrolment over HTTP need the real feature and the `/teams` route, so they go
with it, as does the whole of `GroupGrants.test.ts`.
Two whoami cases asserted a seat's team through `extension.import`, which
resolves the registry rather than the stores object. They now assert the
absent case, and the behaviour they covered is asserted against
`buildUserDetails`, which takes its stores as an argument.
Suite: 12252 passed, 38 skipped.
* refactor: take the teams console out of the built-in tabs
`TabTeams`, `teamsConsole` and `teamActionIcons` are no longer built in. The
dashboard already invites a tab through its `dashboard-will-open` event, so
whatever provides Teams contributes the console the same way.
Its 113 strings go with it and register into the shipped English dictionary
at load, so `i18n('teams_*')` resolves as it did. Only `en.js` ever carried
them, so no translation is lost.
Three modules stay, because things other than the console use them:
`teamBadge` (the dashboard shell), `orgSeat` (Home, Account, Security) and
`shareTeams` (the share picker). They already render nothing when the
account has no team. `teams_account_of` stays with `teamBadge` for the same
reason, and the `share_*` and `plan_team_*` strings stay with their callers.
The GUI builds clean with no console at all, and builds it in when the tab
is contributed.
* docs: seats past the owner's current limit get no allowance
|
||
|
|
e18a5c2b54 |
fix(apps): refuse claimed subdomains as app index_url hosts (PUT-2110) (#4267)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Maintain Release Merge PR / update-release-pr (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
release-please / release-please (push) Canceled after 0s
index_url may not point at a system host: the origin, the api host, or a subdomain an extension has claimed. App create and update now apply the same refusal to `<claimed>.<domain>` (any case, any port) that they apply to the origin and api hosts. The host-to-claim match is a new exported `subdomainLabelOf` in hostRedirects, also used by the claim dispatch middleware, so both decide the same way. Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
5b0205f2bf |
fix(hosting): apps publish with write again (#4291)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Maintain Release Merge PR / update-release-pr (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
release-please / release-please (push) Canceled after 0s
Reverts the hosting part of #4290. manage stays a user-to-user grant; an app with write on its user's directory can publish and keep serving it. |
||
|
|
3bce3b056e | misc: hardening (#4290) | ||
|
|
d978538c9d |
feat: let a subdomain claim keep the main pipeline (#4268)
`extension.claimSubdomain(name, { mainPipeline: true })` serves
`<name>.<domain>` the way core's own subdomains are served: through CORS,
body parsing, auth and every route, `subdomain: '*'` ones included. Routes
declared for the name are ordinary routes, with no option restrictions.
Gated claims (`{ authorize, checkRoute? }`) behave as before.
onlyoffice's subdomain now comes from its extension's claim, so core no
longer lists it among the subdomains it serves itself. Without that claim
`onlyoffice.<domain>` gets the unclaimed-subdomain 404 like any other name.
|
||
|
|
9ff224e22f |
perf(backend): cut sequential round trips on auth, fs, driver, event and site paths (#4259)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Maintain Release Merge PR / update-release-pr (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
release-please / release-please (push) Canceled after 0s
Pipeline - CORS preflights send Access-Control-Max-Age: browsers stop re-preflighting authed calls every 5 s. - `req.ua` is parsed on first read instead of on every request. - JSON `rawBody` reuses the parsed buffer instead of copying it. - `emitAndWait` returns early when nothing listens: no span or closure per unlistened driver call. - SQLBatcher sends a lone query on the next tick while fewer than 8 flushes are in flight, and waits `maxTimeInQueue` as before otherwise. Lone reads skip the 10/30 ms wait; batching under load is unchanged. Auth and permissions - Token-to-actor auth starts the user, session and app lookups together and checks them in the same order: fewer sequential Redis round trips per authed request. - get-user-app-token and check-app reuse the resolved app row. getOrCreateApp skips the re-select after its own insert and doesn't wait on the cache write for replica rows. - getOrCreateApp reads the race winner from the primary when its insert loses, so it no longer hands out a session that was never written. - whoami runs the email check and the OIDC/taskbar/team lookups in parallel; key order unchanged. - OIDC providers are memoized once every discovery succeeds, with one discovery fetch in flight per URL, and the Apple key is parsed once. - gui-token and sync-cookie use `req.actor.user` instead of re-reading the user. - listSessions batches app lookups. App icon probes run together, and the original-icon probe skips the lineage fallback. - Default-granted permissions are answered from config before the scan cache, and exploded options are deduped: one less Redis read per /drivers/call. - ACL resolves ancestors lazily (owners and full-access tokens skip them) and scans the node first, then the ancestors concurrently on a miss. Filesystem - Missing-path lineage lookups run 10 at a time: batch-upload path resolution drops from about 1.3 s to about 40 ms per 100 new files. - MySQL single-file inserts return the row built from the written values, falling back to the primary read: one less primary round trip per new file. - Batch thumbnails are stored with one UPDATE per chunk (200 rows or 4M chars), with a per-row fallback. - storage.quota.bonus listeners run concurrently next to the usage SUM, and the payload carries `userUuid`: quota checks and /df no longer serialize the listener reads. - readdir cache backfill is one pipeline instead of 3xN SETEX. - Profile reads skip the lineage fallback; the own profile is read alongside the user lookup. - Legacy /stat runs is_empty (new `hasChildrenByParentUid`), owner and thumbnail concurrently. - Downloads and the video proxy pipe through `pipeToResponse`: aborts release the storage stream at once with no extra 'close' listeners, and the video proxy no longer crashes on a mid-stream upstream error. - mkdir looks up target and parent together. - Upload completion reuses the session from the access check (status is still re-read before completing), and multipart signing reads it once. - Moving a shared file to Trash skips two lookups that always returned the entry itself. Drivers and events - Subscription resolvers run concurrently and are folded in registration order. - SubdomainDriver and WorkerDriver overlap independent lookups. - The events "anyone subscribed?" check is one Redis pipeline when the region is warm. - Handler publish overlaps the count with the size check. - Broadcast flushes peers concurrently over a keep-alive agent, so a slow peer no longer delays cross-region invalidations to the others. Sites, share and AI - Hosted sites resolve the owner first, then the app and root together. Site config loads only on 404s. The hosted-app query selects only the columns it uses and moves into AppStore. - shareFlags asks about the plan only when an item is shared by link only. - Share listings run the count, teams and plan reads alongside their page query. - Claude attachment cleanup no longer blocks the response. - New util `awaitLater` for promises started early and awaited later. |
||
|
|
145d54cf69 |
Handle unavailable chat model routes and exclude batch variants (#4230)
* Handle model access denials and filter batch chat variants * Raise a low alarm when a provider denies model access A 403 model_not_found still returns 400 upstream_bad_request, but now alarms at info so a lost provider entitlement gets noticed. HttpError gains an alarmSeverity option the terminal alarm gate honors. --------- Co-authored-by: 404oops <oops404@util.404oops.com> Co-authored-by: Daniel Salazar <daniel.salazar@puter.com> |
||
|
|
2b254b8892 |
fix: misc bugs (#4251)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
release-please / release-please (push) Canceled after 0s
Maintain Release Merge PR / update-release-pr (push) Canceled after 0s
|
||
|
|
e5ca303c50 | PUT-1903 (#4226) | ||
|
|
84aaf005ec |
fix: give every route behind the user-protected gate a password budget (#4150)
* fix: give every route behind the user-protected gate a password budget Five of the six routes behind the gate declare a per-user hourly bucket for the password check. The sixth, delete-own-user, declared none. The bucket moves into the gate itself, so it covers every route behind it and a new one cannot be added without one. It is charged by the outcome rather than by the request: a wrong answer spends one and a right answer spends nothing, so a caller who knows the password never meets the limit. * fix: the review's findings on the password budget Reading the budget and spending it on the outcome bounded rounds rather than attempts: everything already in flight read the same budget and was answered before any of it was spent. The charge lands before the comparison now, so a burst is bounded by the same number as a sequence. The key gained a route component. One bucket across all six meant ten mistyped passwords on one route closed the other five for the hour, including the one an account owing its team's 2FA has to reach. |
||
|
|
f6a1e54642 |
fix(fs): keep S3 read stream errors from crashing the process (#4227)
Backend Tests / changes (push) Canceled after 0s
Backend Tests / typecheck (push) Canceled after 0s
Backend Tests / test shard 1/4 (push) Canceled after 0s
Backend Tests / test shard 2/4 (push) Canceled after 0s
Backend Tests / test shard 3/4 (push) Canceled after 0s
Backend Tests / test shard 4/4 (push) Canceled after 0s
Backend Tests / test (main) (push) Canceled after 0s
Backend Tests / coverage (push) Canceled after 0s
Maintain Release Merge PR / update-release-pr (push) Canceled after 0s
Notify HeyPuter / notify (push) Canceled after 0s
release-please / release-please (push) Canceled after 0s
getObjectStream now attaches an 'error' listener to every body it returns. A body that fails before its consumer attaches (socket timeout, reset, or a checksum mismatch on a truncated read) used to emit 'error' with no listener and exit the process, failing every in-flight request on the task. It now logs a warning; consumers that attach later still receive the error. |