Skip to content

feat(joust): joust playground in Gradle projects, over the JVM dev host (ADR-0024 M2) - #178

Open
satran004 wants to merge 26 commits into
feat/playground-m1from
feat/playground-m2
Open

satran004 wants to merge 26 commits into
feat/playground-m1from
feat/playground-m2

Conversation

@satran004

@satran004 satran004 commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

ADR-0024 M2: joust playground in Gradle projects, over the JVM dev host. Stacked on #174 (M1); the base is feat/playground-m1.

What it adds

  • Gradle launch, client side (js/joust/src/playground/gradle.js, jar.js), per protocol 1 §Launch:
    • build/joust/host-spec.json is validated strictly: protocol, absolute java, mainClass, ordered entries and every hash.
    • Every entry is copied into a private read-only snapshot. Only regular files are copied, opened without following links and without blocking; a link anywhere in a path is refused, and so is a jar whose manifest has a Class-Path.
    • The digest is computed from the copied bytes.
    • The JDK is launched with exactly the protocol's arguments and environment allow-list, and the snapshot is deleted when the host exits.
    • The page's anchors come from the snapshot, never from the host.
  • One client. M1's framing and host client are shared through launchHost. A session takes a build source (npmSource / gradleSource).
  • joust playground in a Gradle project:
    • It runs ./gradlew build joustHostSpec, so the build's own ABI and lock gates apply. --accept-abi and --accept-lock are refused; accept a change with the Gradle tasks instead.
    • I6: after a rebuild the session is stale and prepares nothing. The next new session reruns the build first.
  • Native joust playground (julc-state-cli Playground.java, Q1):
    • It checks for Node 22+ and npm.
    • It installs @julclang/joust@<its own version> once into ~/.joust/playground/<version>, never from the project. npm checks the registry tarball's integrity and the lock file records it.
    • The install is atomic: it happens in a temp dir and is renamed into place. Development builds need JOUST_PLAYGROUND_TARBALLS (tests and CI only).
  • Named views appear in the page when the host advertises views (JVM). On npm the page says they are not available.
  • CI:
    • The cli job gains "Test the Gradle playground", with Gradle and Chromium required and no skips.
    • The release job builds playground/dist, so the cached install (which has no Vite) can serve the page.
  • Docs: a Gradle section in js/joust/README.md and the Java quick start.

The branch also merges #174's review rounds 1 and 2 (the M1 fixes). That is why its diff touches M1 files; the conflicts are resolved in the merge commits.

Tests (local)

Suite Result
playground-gradle.test.js (staged Maven repo, native CLI, Chromium) 19/19
playground.test.js (npm, M1) 22/22
js/joust host, host-conformance, offline-ledger, cli 182/182 (with playground)
CLI Gradle tests (PlaygroundTest, JoustMainTest, ScaffoldTest) 51/51

playground-gradle.test.js covers:

  • the launcher rules: tampered spec, symlink, FIFO, Class-Path, digest mismatch, the exact launch;
  • I6 with a fake rebuild and with a real one;
  • the Counter walkthrough in Chromium for a real joust new Gradle project, in Java and in .jsc (Alice creates and increments, Bob is refused, the named view count, reset);
  • I11: the four walkthroughs (Java and .jsc × npm and Gradle) give the same step-by-step transcript;
  • the .jsc ABI gate (I10);
  • the native CLI end to end from an empty cache.

Points for review

  • A new session after a rebuild runs ./gradlew build joustHostSpec from inside an HTTP request. The command is fixed, the token is required, and nothing comes from the request.
  • Staleness (I6) compares contents: the class directories' inventories and hashes, and the build's own jars by hash. Dependency jars are compared by size, mtime, inode and device. Gradle rewriting the spec with reordered keys marks a session stale, which is conservative.
  • The minimal jar reader refuses ZIP64, duplicate entry names, ambiguous manifests and Multi-Release jars that version a validator or a JOUST resource.
  • A hard kill leaves a snapshot behind in the temp dir. Day-old ones are swept at the next start.
  • The issue's Gradle "common bundle" is replaced by the host's verified snapshot (ADR-0024 §5, point 8 of docs(adr): ADR-0024 a dev playground over the dev host (proposed) #159).

🤖 Generated with Claude Code

satran004 and others added 6 commits November 24, 2026 09:02
…st (ADR-0024 M2)

The playground's client side of the JVM host's launch (dev-host protocol 1, "Launch and framing"):
- `joust playground` in a Gradle project runs `./gradlew build joustHostSpec` through the build's own wrapper (its
  gates: checkJscAbi, the lock check); --accept-abi/--accept-lock are refused there (I10).
- build/joust/host-spec.json is validated strictly; every launch entry is copied into a private, read-only snapshot
  (regular files only, opened with O_NOFOLLOW|O_NONBLOCK, no link on the way), each file's hash and the digest are
  checked against the copied bytes, jars with a manifest Class-Path are refused, and the JDK is launched on the
  snapshot with exactly the protocol's arguments and environment allow-list. The snapshot is deleted when the host exits.
- The page's anchors (descriptions, compiled scripts) are read from the same snapshot, sibling jars included (a small
  jar reader), as the host reads them: the first description in class-path order, the script from beside its
  validator class only (refused when that entry holds another class of the same simple name).
- I6: a session is stale once the launch entries or the spec change; the next session runs the build again first.
- Sessions take a build source (npmSource, gradleSource); the server and session are otherwise unchanged.
- Named views run in the page when the host advertises `views` (the JVM host); on npm the page says they are not
  available.
- The npm joust runs `playground` in a Gradle build (the native joust's cached package does).

Tests (playground-gradle.test.js): the spec, snapshot, links, FIFO, Class-Path, digest and script rules; the exact
launch; I6 with a fake build; and, with a staged repository and a joust CLI, the Counter walkthrough in Java and .jsc
Gradle projects compared step by step with the npm walkthroughs (I11), a real rebuild during a session (I6), the .jsc
ABI gate (I10), and the native joust's playground end to end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f this joust's own version (ADR-0024 Q1)

The native joust gains `playground` in a Gradle build. It runs the npm package @julclang/joust of its own version,
never the project's, from ~/.joust/playground/<version> (JOUST_PLAYGROUND_HOME moves it), in the nearest Gradle
project directory; the package then runs ./gradlew build joustHostSpec and the JVM dev host.

- Node.js 22+ is a checked prerequisite (node --version), npm too.
- The cache is installed once by npm into a private temporary directory beside it (its own package.json, so no
  project or ancestor .npmrc applies; --ignore-scripts, --workspaces=false, --save-exact), then renamed into place
  atomically; a concurrent install that won is used, a failed one leaves nothing. npm checks the registry tarball
  against its published integrity and records it in the cache's package-lock.json; the installed version must be
  this joust's.
- A development build has no package of its version on npm: it is refused unless JOUST_PLAYGROUND_TARBALLS names
  local tarballs (tests and CI).
- Scaffold's npm invocation (its JavaScript entry point by our node) is shared as npmCommand.

Tests: PlaygroundTest (install once then the cached package in the project; a subdirectory; Node missing, old or
unreadable; a development build; tarball paths; another version; a failed install; a concurrent install; help), and a
real npm install of a local tarball with its integrity recorded. The Java quick start documents the command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge prebuilt (ADR-0024 M2, Q1)

- js/joust/scripts/build-playground.mjs builds the page into js/joust/playground/dist/, which the package ships: the
  native joust's per-user cache has no Vite, so a published @julclang/joust without the page could not serve it.
- release.yml builds it (setup-js's pinned dependencies) before the packages are prepared and published.
- build.yml's cli job (the native joust, JDK 25, Node 22, the staged repository, this commit's engines) gains "Test the
  Gradle playground": the page built, this commit's npm tarballs packed, Playwright's Chromium installed, and
  test/playground-gradle.test.js run with JOUST_REQUIRE_GRADLE and JOUST_REQUIRE_CHROMIUM, then checked for skipped
  cases. The job's timeout goes from 60 to 90 minutes (four Gradle builds and five browser walkthroughs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts: server.js (the serial session lifecycle with M2's build source), index.js
(the token-free browser launch shared by the npm and Gradle paths), release.yml (one
page-build step: M2's build-playground.mjs, before the versions are rewritten).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflict: index.js (writeLauncher with M2's Gradle path and the shared announce).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
satran004 and others added 2 commits November 24, 2026 09:51
…, exact freshness, hardened jars (#178)

Codex P1/P2 and the security and design reviews of #178, each with a regression test (playground-gradle.test.js):
- P1-1 The wrapper is found as the native joust's Locator.gradleBuildRoot finds it (project.js gradleBuildRoot): the
  nearest settings file, walking only through trusted directories (this user's, or JOUST_SAFE_DIRS), never to the
  filesystem root; else the project's own wrapper.
- P1-2 The spec's java must be a JDK's bin/java (bin/java.exe) whose release file declares Java 25+ (ADR-0022 D3),
  launched by its real path; checked before anything is copied.
- P1-4 Windows: a wrapper path holding a cmd.exe metacharacter (& ^ % ( ) ! " < > |) is refused.
- P1-5 Freshness is decided against the exact spec bytes and manifest the copy was verified against, checked again
  after the copy: a build that changed between the reads is copied again (the old copy discarded), so a session never
  runs one build while reporting another as current.
- P2 I6 compares contents, not size and time: every launch directory's inventory and file hashes, the build's own jars
  hashed, dependency jars (Gradle's cache) by their file identity at the copy.
- P2 The spec is read once, as a bounded, non-blocking, no-follow regular file (a FIFO there is refused at launch and
  stale for a session).
- P2 Manifests are found case-insensitively; a second manifest or a repeated attribute is refused.
- P2 A snapshot directory or class-path entry holding the class-path delimiter is refused.
- P2/G1 A Gradle project is classified as bin/joust.js does (npm only with joust.config.json or a @julclang/joust
  dependency): an unrelated package.json no longer sends it the npm way.
- P2 A Multi-Release jar that versions a validator class or a JOUST resource is refused (not resolved per JDK).
- G-S4 The zip's end record must end the file and the central directory end where it starts.
- G-S5 This user's snapshots a day old whose playground is gone (owner.pid) are swept at start, unlocked first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omplete for the install wanted (#178)

Codex P1-3 and the security and design reviews of #178:
- A cache directory (and its home) is used only when it is this user's (its owner), private (no group or other access),
  not a link, its .complete names exactly the install wanted, and bin/joust.js resolves inside it: before a cache hit
  and before accepting a concurrent install that won the rename. A directory that fails is refused with the reason,
  never installed over.
- G-S1 JOUST_PLAYGROUND_TARBALLS needs JOUST_PLAYGROUND_HOME: tarballs never fill the real per-user cache.
- G3 Tarball installs are keyed by the tarballs' SHA-256 too: a rebuilt tarball is installed again.
- G-S5 Install directories an interrupted install left are swept after a day.

Tests (PlaygroundTest): a hit refused when group-writable, another user's, for another version, or with bin/joust.js
linked out; a linked cache and a foreign home; a world-writable concurrent winner; tarballs without their own cache, a
same tarball's hit, a rebuilt tarball reinstalled; the sweep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply: round r1 · head 2c40977

Review round 1 is addressed. Codex and the design reviewer asked for changes; the security reviewer approved, with P3s.

Finding Change
Codex P1: the wrapper search walked to the filesystem root gradleBuildRoot in project.js uses the native Locator's rule: only directories the user owns or lists in JOUST_SAFE_DIRS. If nothing is found, the project's own wrapper is used
Codex P1: any executable passed as java The real path must be bin/java(.exe) in a JDK whose release file declares 25+. The host launches by that real path
Codex P1: a cache hit skipped the ownership checks A hit, or a concurrent winner, is used only if it is owned by the user, 0700 and not a link. .complete must name the install wanted, and bin/joust.js must resolve inside the directory
Codex P1: on Windows, the wrapper path was parsed as command text Paths with cmd metacharacters are refused
Codex P1: a rebuild between reads made an old snapshot look current The spec bytes are read once. Freshness is judged against those bytes and the verified manifest, and re-checked after the copy; if the build changed, the copy is retried
Codex P2: staleness by size and mtime Contents are compared: class directory inventories and hashes, and the build's own jars by hash
Codex P2: a FIFO at the spec path The spec is read as a bounded, non-blocking, no-follow regular file
Codex P2: manifest lookup differed from the JDK's The manifest is found case-insensitively; a duplicate manifest or attribute is refused
Codex P2: a class-path delimiter in the snapshot path Refused
Codex P2 / design G1: an unrelated package.json made the project npm The rule is now !isNpmRoot && isGradle, as in project.js; tested
Codex P2: Multi-Release jars Refused when they version a validator or a JOUST resource
Security G-S1 / design G3: tarball installs JOUST_PLAYGROUND_TARBALLS requires JOUST_PLAYGROUND_HOME, and the cache is keyed by the tarballs' hash
Security G-S4: the end-of-central-directory record It must end the file, and the central directory must end where it starts
Security G-S5: leftover snapshots and installs Day-old ones belonging to the user are swept at start

Each change has a regression test. Local results: playground-gradle.test.js 30/30 (11 new launcher cases), playground.test.js 22/22, cli.test.js 13/13, CLI Gradle tests 56/56.

Follow-up issue: an npm-shrinkwrap.json for @julclang/joust (G-S2/G2), to pin the cache's transitive dependencies. The request-timeout caveat in the PR body was wrong and is removed: Node's requestTimeout only bounds receiving the request.

satran004 and others added 3 commits November 24, 2026 10:01
…ory entries kept once, a linked cache home refused before any chmod (#178)

- jar.js: a repeated directory entry (no content) is kept once; a repeated file name is
  still refused (real dependency jars repeat directories, e.g. archunit).
- Playground.java: a linked cache home is refused before privateDir, whose chmod would
  follow the link to its target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…own, gated first session, hashed external jars (#178)

Codex round 2 on #178, each with a regression test (playground-gradle.test.js):
- P1-1 Gradle searches upwards for a settings file itself: the trusted build root must hold its own settings.gradle(.kts)
  (a regular file, not a link) before Gradle runs, else refused with what to add.
- P1-4 The first session runs only the spec the gated startup build wrote (`build joustHostSpec`, its bytes captured
  right after it): a spec written since (a bare joustHostSpec, which skips checkJscAbi) makes the open build again. The
  gated baseline is carried through copy retries and later opens.
- P2-1 The metadata-only freshness check is kept for modules in Gradle's immutable dependency cache
  (caches/modules-2/files-2.1/...) only; every other jar (the build's, local file dependencies, composite outputs) is
  hashed against the spec.
- P2-2 jar.js: each central-directory record must lie within the directory, and exactly the declared number of records
  must fill it (the JDK recounts an understated count).
- P2-3 The owner entry's count of classes of the validator's simple name is ValidatorScripts' raw count, META-INF/versions
  entries included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ew cache directories private from creation (#178)

Codex round 2 on #178 (P1-2, P1-3), with tests (PlaygroundTest):
- Every directory above the cache home, as written and as resolved (the default ~/.joust/playground and
  JOUST_PLAYGROUND_HOME alike), must be owned by this user or root and not writable by others unless sticky; checked
  before the install, on a cache hit and for a concurrent install's winner.
- Missing cache directories (and each install directory) are created private (0700) at creation; an existing home is
  checked and never changed (no chmod): one others can read is refused and left as it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply: round r2 · head c638345

Codex's round-2 findings, plus the round-2 P3s from the design and security reviewers (both approved round 2):

Finding Change
Codex P1: Gradle's own upward search could load an ancestor's settings The trusted build root must hold its own settings.gradle(.kts), a regular file and not a link, or the playground refuses and says to add one
Codex P1: the cache could be replaced through a parent directory Every ancestor of the cache home, as written and as resolved, must be owned by this user or root and not writable by others unless sticky. Checked before an install, on a hit, and for a concurrent winner
Codex P1 / security G-S6: refusing a linked home changed its target's permissions A link is refused before any chmod. Missing directories are created 0700; an existing home is only checked, and its mode is never changed
Codex P1: the first session could skip the build gates The spec bytes are captured right after the gated startup build. On first open the build reruns if the spec changed. The baseline carries through retries
Codex P2: external jars were checked by size and mtime only That shortcut applies only to Gradle's module cache (caches/modules-2/files-2.1). Every other jar is hashed
Codex P2: the ZIP record count was trusted Each record must lie within the central directory, and the cursor must end exactly at its end
Codex P2: same-name counting differed from ValidatorScripts It uses the same raw count, including META-INF/versions entries
Design G5: repeated directory entries were refused They are kept once; repeated file names are still refused

Each change has a regression test. Local results: playground-gradle.test.js 33/33, playground 22/22, cli 13/13, CLI tests 59/59.

Follow-up issue (design G2 / security G-S2): an npm-shrinkwrap.json for the cache's transitive dependencies.

satran004 and others added 5 commits November 24, 2026 10:21
One-time pairing from M1 (#174 round 3): the Gradle path announces itself through the same flow as npm (index.js
announce(): the launcher file and printed links carry a single-use pairing code, the session token stays in memory),
so no reusable token appears in Gradle mode either. startPlayground takes the build source and the pairing options;
the Gradle tests open server.pairingUrl() and read the native joust's printed #pair= link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ay how to fix it (#178 G-S8)

Still refused; the message names the directory and the fix (chmod go-w <dir>, or another JOUST_PLAYGROUND_HOME). A
directory another account owns keeps the advice to choose another home.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es, checked before every run; the real module cache only (#178)

Codex round 3 on #178, with tests (playground-gradle.test.js):
- The settings file checked is the one Gradle takes: refused when both settings.gradle and settings.gradle.kts exist,
  or when it is not a regular file (Gradle follows a link). The build-root walk also skips a directory others can
  write (unless sticky or listed in JOUST_SAFE_DIRS): another account could plant a settings file there.
- The build root and its settings are resolved and checked again right before every wrapper run, automatic rebuilds
  included: a settings file removed since (a branch switch) is refused and the wrapper never runs.
- The identity-only freshness check is limited to Gradle's real module cache (GRADLE_USER_HOME or ~/.gradle,
  caches/modules-2/files-2.1, resolved); a cache-shaped directory elsewhere, inside the build especially, is hashed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cal path (#178)

Codex round 3 on #178: the cache home's deepest existing ancestor is resolved to its real path once; that canonical
path is what is checked (every directory above it this user's or root's, not writable by others unless sticky),
created, installed into and given to node. A link hop in a directory another account controls can no longer make the
checked cache and the one run differ. A linked home itself is still refused. Test: an alias through a link in a
world-writable directory installs and runs under the canonical path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply: round r3 · head 085803d

Codex's round-3 findings. The design and security reviewers both approved round 3. This branch also merges #174's reviews r3 and r4: one-time pairing applies to the Gradle path too, with no reusable token in a file, log or argument.

Finding Change
P1: cache validation lost intermediate symlink hops The cache home's deepest existing ancestor is resolved once to a canonical path, which is used for the checks, creation, the install and the node command. A linked home is still refused
P1: the settings check could approve a different script from Gradle's Refused when both settings.gradle and settings.gradle.kts exist, or when the one present is not a regular file. The build-root walk also skips directories others can write, unless sticky or listed in JOUST_SAFE_DIRS
P1: rebuilds reused the startup settings check The build root and its settings are resolved and validated again before every wrapper run, automatic rebuilds included. Tested: settings removed between two opens means the wrapper never runs
P2: a cache-shaped path skipped hashing Only jars under the resolved <GRADLE_USER_HOME>/caches/modules-2/files-2.1 skip hashing; everything else is hashed
P2: the gated baseline is read from the shared spec file Follow-up issue (round 4 rule: not security-relevant)
Security G-S8 The refusal names the directory and says chmod go-w <dir>

Local results: playground-gradle.test.js 35/35, playground 23/23, cli 13/13, CLI tests 60/60.

satran004 added a commit that referenced this pull request Nov 24, 2026
…round-m3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	js/joust/playground/main.js
satran004 and others added 3 commits November 24, 2026 10:52
…ky exception, DCL settings, opener failures (#178)

Codex round 4 on #178, with tests (playground-gradle.test.js):
- The build root itself must pass the walk's trust (the walk falls back to the project it started in): a project
  others can write (0775) is refused unless listed in JOUST_SAFE_DIRS.
- No sticky-bit exception in the settings walk: a sticky directory still lets another account create a settings file,
  so a group- or world-writable build directory needs JOUST_SAFE_DIRS (the npm cache's sticky rule is unchanged).
- settings.gradle.dcl counts as Gradle 9 counts it: in the walk (a link counts, Gradle follows it) and in the candidate
  check (one candidate per directory, a regular file).
- A browser opener that starts and then exits non-zero (xdg-open without a browser) falls back as a spawn error does:
  one fresh pairing link, unless the page paired meanwhile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex round 4 on #178: normalising drops a link followed by .., which the file system resolves to the link target's
parent, so the cache would be checked in one directory and used in another. JOUST_PLAYGROUND_HOME with a .. component
is refused before anything is resolved. Test: alias/../cache refused, nothing created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply: round r4 · head 8e699d5

Codex's round-4 findings:

Finding Change
P1: a rejected project directory was reused as the build root The build root itself must pass the walk's trust. A 0775 project is refused ("run chmod go-w on it, or list it in JOUST_SAFE_DIRS"), and JOUST_SAFE_DIRS admits it; both tested
P1: sticky directories could supply another account's settings The settings walk drops the sticky exception; a group- or world-writable build directory needs JOUST_SAFE_DIRS. The npm cache's rule is unchanged
P2: a nearer settings.gradle.dcl was skipped .dcl counts in the walk and in the candidate check. More than one candidate in a directory is refused, and so is a linked one
P2: .. in the cache path A JOUST_PLAYGROUND_HOME with a .. component is refused before anything is resolved or created
P2: an opener that exits with an error left no usable link A non-zero or signalled opener exit takes the spawn-error fallback, which prints one fresh pairing link if the page has not paired

Also merges #174 r5. Local results: playground-gradle.test.js 38/38, playground 23/23, cli 13/13, CLI tests 61/61.

…yours and writable by nobody else (#178)

Codex round 5 on #178: for a build root not listed in JOUST_SAFE_DIRS, the settings file Gradle takes and gradlew must
be owned by this user (or root) and not group- or other-writable; the refusal names the file and the fix (chmod go-w,
or list the root). Test: a 0755 root with a 0664 settings file, then a 0775 gradlew; listed, accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply: round r5 · head 448e5a9

Codex's round-5 findings:

Finding Change
P1: the suggested chmod left group-writable settings executable When the build root isn't in JOUST_SAFE_DIRS, the settings file Gradle will take and gradlew must themselves be owned by this user or root and not writable by group or others. The refusal names the file and says chmod go-w <file>. Tested: a 0755 root with 0664 settings, and a 0775 gradlew
P2: DCL in the CLI's project discovery; the default cache path's ../symlink semantics; aliased JOUST_SAFE_DIRS entries Follow-up issues (round 5, not security-relevant)

Local results: playground-gradle.test.js 39/39, playground 23/23, cli 13/13, CLI tests 61/61. The final pass (Codex, plus two independent reviewers, one on Fable) runs on this head.

satran004 and others added 2 commits November 24, 2026 11:27
…build, linked wrapper, ZIP64 locator (#178)

The final reviews of #178 (Fable, Opus), each with a test (playground-gradle.test.js):
- FG1 A linked gradlew is refused, as a linked settings file is.
- FG2 Every path that lets another account change what Gradle runs (the directories walked from the project to the
  build root, the settings file, gradlew) is named in one refusal with one `chmod go-w <paths>` line (or JOUST_SAFE_DIRS
  for the root): a umask 002 system's `joust new` or `git clone` is fixed in one step. The walk now enters this user's
  directories whatever their mode and refuses afterwards, naming them. Documented in the Java quick start.
- FG4 A walk that stops at a directory holding the settings file but not this user's names that directory (list it in
  JOUST_SAFE_DIRS if trusted) instead of asking for a settings file.
- FG5 jar.js refuses a repeated name only for what the launch reads or the JVM loads (the manifest, META-INF/joust,
  plutus and versions entries, classes); other repeats keep their first copy.
- FP1 A ZIP64 end locator before the end record is refused: the JDK always follows it, possibly to another central
  directory (fixture: the final reviewer's polyglot jar, test/fixtures/playground/zip64-poly.jar).
- FP2 A compiled script whose JSON names cborHex more than once is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply: final pass · head 8e6e657

The final pass ran Codex, a Fable reviewer and an Opus reviewer over the whole branch at 448e5a9. The Opus reviewer approved; the JVM side and the JS client agree. The Fable reviewer asked for one security fix. All fixes are in 87ef72bb, each with a test:

Finding Change
FG1 (security P2): the wrapper check inspected a symlink A linked gradlew is refused, like a linked settings file
FG2 (umask 002): three separate refusals One refusal lists every writable path (directories up to the build root, settings, gradlew) and ends in a single chmod go-w <paths…> line, or names JOUST_SAFE_DIRS. Tested under a real umask 002; the quick start describes it
FG4: a misleading "add a settings.gradle" The message names the directory holding the settings file and its owner
FG5: duplicate jar entries Refused only for what the launch reads or the JVM loads (MANIFEST.MF, `META-INF/joust
FP1 (Opus): a ZIP64 end locator the JDK honours Refused. The reviewer's polyglot jar is now a test fixture
FP2: cborHex twice in a .plutus.json Refused

FG3 (a rebuild that only adds a first launch directory) is a follow-up issue. This head also merges #174's final-pass fixes. Local results: playground-gradle.test.js 43/43, playground 25/25, cli 13/13, CLI tests 61/61.

satran004 and others added 2 commits November 24, 2026 11:34
…es below it (#178 FG6)

Regression from 87ef72b: with the root listed in JOUST_SAFE_DIRS the directories walked from the project to the root
went unchecked. Each walked directory that is not itself listed is checked again, whatever the root's listing; listing
the root still exempts only the settings file and the wrapper. The refusal names the directories to list. Tests: a
listed root with a 0777 subproject is refused (the reviewer's probe, case 4), accepted once the subproject is listed;
the umask 002 case needs each writable directory listed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ies) into feat/playground-m2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply · head b6e96ab

The Fable reviewer approved the final-pass fixes and found one regression from them (FG6). It is fixed in c427cc34. Every directory walked from the project up to the build root is checked for group/other write unless that directory is itself in JOUST_SAFE_DIRS. Listing the root exempts only the settings file and gradlew. The refusal names exactly which directories to list or chmod go-w. Tested with a 0777 subproject under a listed root, and the umask-002 case.

This head also merges #174's final-pass fix: identities use their enterprise address. Local results: playground-gradle.test.js 44/44, playground 26/26.

satran004 and others added 2 commits November 24, 2026 11:41
…ord (#178)

Codex's confirm of 87ef72b (P2): the refusal's `chmod go-w …` line single-quotes each pathname (an embedded quote
closed, escaped and reopened), so a path with a space, $, ; or a quote is one argument when the line is pasted into a
shell. Test: shellQuote round-trips such a name through sh -c; a build under "it's a $HOME; touch pwned" is fixed
by running its printed line, and nothing else runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satran004

Copy link
Copy Markdown
Member Author

Author reply: review complete · head 718db28

Codex's confirm of the final-pass fixes:

Finding Outcome
P1: listing the root exempted subprojects Already fixed by FG6 (c427cc34)
P1: build.gradle left writable Declined by design. The project's own build files are the user's build, trusted as ./gradlew build trusts them. The checks only keep the playground from taking a build root, settings file or wrapper from outside the user's control. Recorded in ADR-0024 §13 (e4b65261 on #159)
P2: the printed chmod command was not shell-quoted Fixed in ce784976: each path is single-quoted. Tested with a root named it's a $HOME; touch pwned; running the printed line with sh -c fixes the build and runs nothing else
P2: an escaped duplicate cborHex key Follow-up issue. The page's hash check refuses a mismatched script anyway

Status of #178:

  • Design reviewer and security reviewer: approved.
  • Final pass: Fable approved after confirming its fixes; Opus approved.
  • playground-gradle.test.js: 45/45.

Merging is the maintainer's call.

satran004 added a commit that referenced this pull request Nov 24, 2026
…feat/playground-m4

Conflicts:
- devkit.js: M3's re-checked problemOf, with M4's keyed windowProblem in it; the
  session status carries M4's keyedLimits beside M3's fencedUntil.
- main.js: M3's enterprise-address identities (with M4's labelled identities for
  replay; the separate enterprise-holdings line is gone, since the identity's address
  now is its enterprise address), fill and confirmedNotes in M4's approval and signing
  path, both session-start steps, the union of imports.
The keyed operation records stay in the chain's journal beside M3's reservations,
under the same lock and written before the call goes on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant