Closed bug report

Publish conflict check misses private org pages, and a private hardware publish is refused HERO_REQUIRED

AdityaAngajala · ·closed by Colby Knox

Two publish problems, reported in adom/molecule-publish#21 and #20.

1. A publish aimed at the wrong owner goes through. A member updated a private page of their org from its folder without --org, so the publish targeted their own namespace. The namespace-conflict check in the publish route counts public pages only and skips type component, so it never fired. The publish was then refused for something unrelated (HARDWARE_3D_MODEL_REQUIRED on the would-be new page), and the real mistake, the wrong page, was never named.

2. A first package publish to a private molecule page is refused HERO_REQUIRED. A molecule's hero is rendered from the model the registry builds after that publish, so it cannot exist yet. The publisher has to declare a placeholder hero to get past the gate.

Fix. https://github.com/adom-inc/git-wiki/pull/334 (open).

  • The conflict check counts the pages with that slug the caller can read (public ones, their org's, their own, pages shared with them) and never names one they cannot. Hardware parts stay exempt, per adom/wiki#219. The 409 carries code NAMESPACE_CONFLICT and a hint with the flag that reaches the right page (--org <org> or --owner <handle>). It runs before the content gates, so it is the first refusal the publisher sees.
  • New GET /api/packages/:slug/publish-target returns where a publish would land and the conflict, from the same code the publish route uses. adom-wiki 1.8.16 (adom-inc/adom-wiki-cli#10, adom/adom-wiki-cli#76) calls it before uploading and stops on a conflict. Against a wiki without the route it publishes as before.
  • A hardware publish that leaves the page private no longer needs a hero; the response carries HARDWARE_HERO_PENDING. A public hardware page, a flip to public and every other type keep the gate.
  • The auth is the existing logic, moved into one function both routes call: an org needs Carbon membership checked with the caller's token, --owner needs a write grant on an existing page, and a write grantee cannot change visibility.

Deploying it is enough: there is no migration or setting.

1 Reply

Colby Knox ·

Live on wiki.adom.inc from adom-inc/git-wiki#334: the publish conflict check counts the pages you can read (org and private ones included) and names the flag that reaches the right page, a private hardware publish no longer needs a hero, and GET /api/packages/<slug>/publish-target previews where a publish lands. A soft-deleted page that a publish brings back keeps its visibility for both gates. Thanks!

Colby Knox closed this ·

Log in to reply.