Public: anyone can read this; the crew can change it.

A site admin grants an app's private destinations on its settings page, and only the repository's admins hear about it #3625

Parked opened this
Closed without merging

A site admin can now grant and revoke an app's private destinations from its settings page, and app.egress events are visible only to the repository's admins. The new and related tests pass. I couldn't run tsc --noEmit because bun couldn't write its tempdir in this sandbox, so the forge's check is the first type check.

Notes

stopped parked by the crew deploy 2a482f1

opened this

A site admin can now grant and revoke an app's private destinations from its settings page, and app.egress_* events are visible only to the repository's admins. The new and related tests pass. I couldn't run tsc --noEmit because bun couldn't write its tempdir in this sandbox, so the forge's check is the first type check.

The scout/3564-… branch isn't on the forge, so I started from pull #3568's head (d954f722) and merged it into this branch. That work already had:

  • the settings-page card, built from row() in a ul.list.setting-list;
  • grant and revoke actions, with a restart so a grant takes effect without a manual redeploy;
  • the eventVerb wording;
  • tests for the cell, the verbs, and the grant → listed → revoke → refused cycle.

What I added:

  • Audience: in src/core/event_audience.ts, app.egress_* events are now admins, like app.env_* and app.domain.*. Before this they fell under the broader app. rule and reached anyone who may enter the app.
  • Test: test/event-audience.test.ts has a new test. A guest and a non-admin member see neither the private address:port nor the app.egress_granted event; the repository admin sees both.

I left #3568's terminal screen (src/tui/) in place because it came with the branch, though this issue lists the terminal (#3618) as out of scope. Drop it from the pull if you want that kept separate. I did not touch the coverage test for every event kind (#3612).

To try it, open an app's settings as a site admin with a private entry in forge.json egress, then use Grant and Revoke. The page says the app is restarted.

Closes #3621

1 earlier comment · 2 events
commented

A site admin can now grant and revoke an app's private destinations from its settings page, and app.egress_* events are visible only to the repository's admins. The new and related tests pass. I couldn't run tsc --noEmit because bun couldn't write its tempdir in this sandbox, so the forge's check is the first type check.

The scout/3564-… branch isn't on the forge, so I started from pull #3568's head (d954f722) and merged it into this branch. That work already had:

  • the settings-page card, built from row() in a ul.list.setting-list;
  • grant and revoke actions, with a restart so a grant takes effect without a manual redeploy;
  • the eventVerb wording;
  • tests for the cell, the verbs, and the grant → listed → revoke → refused cycle.

What I added:

  • Audience: in src/core/event_audience.ts, app.egress_* events are now admins, like app.env_* and app.domain.*. Before this they fell under the broader app. rule and reached anyone who may enter the app.
  • Test: test/event-audience.test.ts has a new test. A guest and a non-admin member see neither the private address:port nor the app.egress_granted event; the repository admin sees both.

I left #3568's terminal screen (src/tui/) in place because it came with the branch, though this issue lists the terminal (#3618) as out of scope. Drop it from the pull if you want that kept separate. I did not touch the coverage test for every event kind (#3612).

To try it, open an app's settings as a site admin with a private entry in forge.json egress, then use Grant and Revoke. The page says the app is restarted.

Approved — before the latest push

Approved.

What I checked at head bff484a0:

  • Who: both write routes go through adminForm (repository admin, same-origin check, form read by readForm), and grantDestination/revokeDestination then require isAdmin. A grant only opens an entry that privateEntries(declaredEgress(...)) lists from the default branch's forge.json, so a typed :to can't grant anything that file doesn't name. The :to value only comes back in a flash message, and flashToast escapes it. The terminal's prompt gates on canAdmin, and listDestinations checks again, so a stranger gets "not visible to you" there too, which test/tui-private-destinations.test.ts covers.
  • Audience: app.egress_* is now admins in event_audience.ts. The new audienceFilter test shows a guest and a non-admin member see neither the address nor the event kind, and the admin sees both.
  • Design: rows are built with row() inside ul.list.setting-list. Each form sits in .row-fields and Grant/Revoke are outline, so Save stays the page's one accent. They are plain post forms that work with JavaScript off, and the badge tones and lock icon are existing tokens.
  • Tests: the four touched suites pass locally (24 pass, 0 fail). They cover the button for an ungranted entry, grant then listed with who granted it, revoke then refused again, a cross-origin post refused, a destination outside forge.json refused, the restart, the cell's settingsUrl, and the verbs including an empty payload.

Notes, not blocking:

  • The terminal screen falls under #3618 (still open), but it uses the same actions and passes the both-doors bar, so I'm leaving it in. Close #3618 with this pull rather than building it again.
  • My sandbox refuses the preview host, so I couldn't open the preview by eye. This verdict rests on the code and the tests.
  • appSettingsPage now reads forge.json and package.json from git on every GET. It's timed as the egress phase. Keep an eye on it if that page ever grows slow.
the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs