Repository navigation
feat: Library writes through the object-storage tools, and Connect leads with the decocms-studio skill - #7885
Merged
Merged
Conversation
viktormarinho
changed the base branch from
fix/org-fs-manifest-bypass
to
main
October 13, 2026 16:40
4 tasks done
PUT_PRESIGNED_URL, DELETE_OBJECT and DELETE_OBJECTS accept any key, including `_fs/<volume>/...`, where org filesystem bytes live. The Library lists files from the `org_fs_entry` index, which only the /api/:org/fs routes write, so an agent that uploads to `_fs/home/pages/x.html` through a presigned URL gets bytes in the bucket and nothing in the Library; a raw delete leaves an index row with no bytes behind. Reject `_fs/` keys in those three tools (normalized like buildS3Key, so `a/../_fs/x` and encoded spellings count) and point to the fs route. Fix the decocms-studio skill, whose rest.md told agents to prefer those tools while the line above it said to write files through `fs`. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The Connect page only offered MCP snippets, and an agent connected that way has no route to write Library files. Put the skill install and the one-time `decocms auth login` first, and keep MCP below for clients without a shell. The skill now tells the agent to hand the user the login command instead of working around a missing session, to stat a file before saying it is in the Library, and how to link and share it (public or password).
CLI + skill opens first and carries a Recommended badge; MCP keeps its client tabs and install method inside its own tab.
The install step gets the same Claude / Cursor / Codex / Other tabs as MCP, sharing one selection. Cursor and Codex pass -a to the skills CLI; Other lets it ask.
The CLI needs the Bun runtime even under npx, so the skill now has the agent offer to install Bun when bunx is missing, and the Connect hint links to it.
…tools Instead of rejecting _fs/ keys, PUT_PRESIGNED_URL hands out a Studio upload URL carrying a signed, one-file grant (at most an hour), and the new PUT /api/:org/fs/:volume/upload/:token route writes it through OrgFs, so the file lands in the Library index. DELETE_OBJECT(S) delete _fs/ keys through OrgFs too, and remove bytes a raw write left unindexed. Both apply the fs routes' rules (public and synced volumes read-only, personal folders owner-only); the upload route checks them again at upload time. The HMAC grant code shared with Jira attachment downloads moves to core/signed-grant.ts, and upload grants carry a purpose field so another grant type signed with the same key never passes.
Library writes work over MCP now; sharing files and messaging agents remain REST-only.
viktormarinho
force-pushed
the
viktor/connect-agent-skill
branch
from
October 13, 2026 16:46
c06b50b to
6182c7d
Compare
decocms Bot
pushed a commit
that referenced
this pull request
Oct 13, 2026
PR: #7885 feat: Library writes through the object-storage tools, and Connect leads with the decocms-studio skill Bump type: minor - decocms (apps/api/package.json): 4.470.0 -> 4.471.0 - @decocms/native (apps/native/package.json): 4.470.0 -> 4.471.0 - @decocms/e2e (packages/e2e/package.json): 1.104.0 -> 1.105.0 Deploy-Scope: both
pedrofrxncx
added a commit
that referenced
this pull request
Oct 15, 2026
…home folder (#7976) GET_PRESIGNED_URL hands back a presigned download URL for any key in the org's bucket, including `_fs/home/users/<id>/...` — the Library's object-storage addressing for org-fs bytes. That bypasses the personal-home carve-out the `/api/:org/fs` routes and PUT_PRESIGNED_URL already enforce (org-fs.ts's ACL note: every member reads/writes every volume except another member's `home/users/<id>/` folder), letting any org member read a teammate's private notes by presigning the raw key instead of going through the fs read route. Reject `_fs/` keys whose path falls inside another member's personal home, mirroring the `requireOrgFsWrite` guard PUT_PRESIGNED_URL already applies on the write side (see #7885). Reviewer: run `bun test apps/api/src/tools/object-storage/get-presigned-url.test.ts`. Verified locally: `bun run fmt`, `tsc --noEmit` in apps/api, the targeted test file above (3 pass), and `oxlint` on the three changed files (clean). Full CI validates the rest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this contribution about?
An agent connected through "Connect your agent to Studio" wrote an HTML page to the Library with
PUT_PRESIGNED_URL(key_fs/home/pages/x.html). The bytes reached the bucket, but the file never appeared in the Library. The Library lists from theorg_fs_entryindex, and onlyOrgFs.write()maintains it, so a presigned upload that goes straight to S3 is invisible. A rawDELETE_OBJECTon an_fs/key does the reverse and leaves an index row with no bytes. Separately, the Connect page only offered MCP, and nothing pointed people at thedecocms-studioskill and CLI.This PR includes #7883's commit (it introduced the
_fs/key check and the first skill fixes) and replaces its rejection with working behavior. #7883 is closed in favor of this one.Object-storage tools now write the Library correctly
PUT_PRESIGNED_URLon an_fs/<volume>/<path>key returns a Studio URL instead of an S3 one:PUT /api/<org>/fs/<volume>/upload/<token>. The token is a signed grant for one file, one org and the member who asked, and lasts at most an hour. The route writes throughOrgFs.write(), so the file is indexed, quota-checked and announced to mounts like any other fs write. Clients don't change: they stillPUTthe bytes to the URL they got.resolveOrgFromPathlets it through like the public-share read and unlock routes. It returns 404 for a forged, expired or mismatched grant (other org, other volume).DELETE_OBJECT/DELETE_OBJECTSon_fs/keys delete throughOrgFs.delete(), which removes the index row, or the whole folder for a directory. A key with bytes but no index row (what a raw write used to leave) has its bytes deleted.file-storage/org-fs-write-guard.ts): public volumes and repo-synced volumes are read-only,home/users/<id>/is owner-only, and the volume root is not writable. The upload route checks them again at upload time, since a volume can become a sync mirror after the grant was minted.jira/attachment-token.tsmoved tocore/signed-grant.tsso both grant types share it. Upload grants carrypurpose: "org-fs-upload"and are validated with a schema, so another grant type signed with the same key is refused.Connect page
claude plugin marketplace add decocms/studio+claude plugin install decocms-studio@decocms. Cursor and Codex:npx skills add decocms/studio --skill decocms-studio -g -a cursor|codex. Other: the same command without-a, so the installer asks.bunx decocms@latest auth login.--target <origin>is added only when the page isn't served fromstudio.decocms.com(self-hosted or local). "Needs Bun." links to bun.com: the CLI needs the Bun runtime even undernpx.Skill (
decocms-studio1.0.3)bunxis missing, the agent asks before installing Bun.Not logged inorCould not refresh session, the agent hands the user the login command. It does not work around a missing session with API keys, MCP tokens or presigned URLs.fs/<vol>/statreturns the entry. The agent then gives the Studio link (/<slug>/library?path=…&preview=…) and the directfs/<vol>/readlink.rest.mddocuments sharing (private/public/password): the agent shares only when asked, and hands back the link and the password together. It also says what the object-storage tools now do with_fs/keys.How did you verify your code works?
bun run test: 10581 pass, 0 fail.bun run check: every workspace exits 0. The firstverifyrun had 3 timing-based failures (circuit breaker, a web chat store test, the hosted-harness heartbeat) while a dev server and a Postgres were also running. All three pass alone, and the full suite passed on the rerun.upload-grant.test.ts: round trip, expiry, an edited payload, a Jira grant signed with the same key, garbage tokens.put-presigned-url.test.ts: the URL and grant for an_fs/key, the 1h cap, and refusals for another member's folder, a synced volume, a public volume and the volume root.delete-object.test.ts: indexed delete, deleting stray bytes, a personal-folder refusal, per-key errors in a batch.parseOrgFsKeykey spellings.skill-install.test.ts: install command per client, login command with and without--target.org-fs.integration.test.ts, run against a migrated throwaway Postgres: an upload without a session is written and indexed; expired, other-org, other-volume and edited grants get 404; another member's folder gets 403. The rest of that file andfile-storage/org-fs.integration.test.tspass too, except the S3 backfill test, which needs an S3 endpoint this machine doesn't have (ECONNREFUSED). CI's storage-integration job covers it.PUT_PRESIGNED_URLon_fs/home/pages/…returned the Studio URL, an unauthenticatedcurl -X PUTwrote the file, andstatfound it. A tampered token and a URL pointing at another volume got 404. Another member's folder got 403.DELETE_OBJECTremoved the file andstatthen returned 404.PUT fs/home/file+stat, the Library link opened the file in preview, and anonymousreadreturned 401 private, the password form in password mode, and 200 public.SKILL.mdandrest.md.studio.decocms.comfrom a fresh machine.Screenshots/Demonstration
Settings › Connect on a local studio:
How to Test
decocms tools call, callPUT_PRESIGNED_URLwith{"key":"_fs/home/test/a.html"}. Expected: a URL ending in/fs/home/upload/<token>.curl -X PUT -H "Content-Type: text/html" --data-binary @a.html <url>. Expected:{entry}, and the file is in the Library undertest/.DELETE_OBJECTwith the same key. Expected:{success:true}and the file is gone from the Library.PUT_PRESIGNED_URLwith_fs/home/users/<another member's id>/x.md. Expected: 403.stat, then returns the Library link, the share link and the password.Migration Notes
None. Plugin installs pick up 1.0.3 on their next marketplace update. Files written raw under
_fs/before this change stay unindexed. Re-uploading them, or deleting them withDELETE_OBJECT, clears that up.Review Checklist
_fs/keys behave as before)