Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/server/src/auth/RpcAuthorization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ describe("RPC authorization scopes", () => {
}
});

it("still lets readers load settings the way installed Swift clients ask", () => {
expect(requiredScopeForRpcMethod("server.getSettings")).toBe(AuthOrchestrationReadScope);
});

it("rejects unknown RPC method names", () => {
for (const method of ["server.notRegistered", "toString", "constructor"]) {
expect(() => requiredScopeForRpcMethod(method)).toThrow(
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/auth/RpcAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const RPC_REQUIRED_SCOPES = {
[WS_METHODS.serverRemoveKeybinding]: AuthSettingsWriteScope,
[WS_METHODS.serverGetStorageCleanupReport]: AuthOrchestrationReadScope,
[WS_METHODS.serverGetDatabaseStorage]: AuthOrchestrationReadScope,
[WS_METHODS.serverGetSettings]: AuthOrchestrationReadScope,
[WS_METHODS.peerLinksList]: AuthAccessReadScope,
[WS_METHODS.serverUpdateSettings]: AuthSettingsWriteScope,
[WS_METHODS.serverSearchAcpRegistry]: AuthOrchestrationReadScope,
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/observability/RpcInstrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const RPC_AGGREGATES = {
[WS_METHODS.peerLinksLink]: "peerLinks",
[WS_METHODS.peerLinksUnlink]: "peerLinks",
[WS_METHODS.peerLinksAnswerRequest]: "peerLinks",
[WS_METHODS.serverGetSettings]: "server",
[WS_METHODS.serverUpdateSettings]: "server",
[WS_METHODS.serverSearchAcpRegistry]: "server",
[WS_METHODS.serverPrepareAcpRegistryAgent]: "server",
Expand Down
4 changes: 4 additions & 0 deletions apps/server/src/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2657,6 +2657,10 @@ export const layerWsRpc = (
Effect.annotateCurrentSpan({ "orchestration_v2.thread_id": input.threadId }).pipe(
Effect.andThen(peerLinkRequests.answer(input)),
),
[WS_METHODS.serverGetSettings]: (_input) =>
Effect.map(serverSettings.getSettings, (settings) =>
ServerSettings.redactServerSettingsForClient(settings, settingsClient),
),
[WS_METHODS.serverUpdateSettings]:
/* Request instrumentation already owns the span; keep this helper in that context. */
Effect.fnUntraced(function* ({ patch, providerInstanceMutation }) {
Expand Down
9 changes: 9 additions & 0 deletions packages/contracts/src/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ export const WS_METHODS = {
peerLinksLink: "peerLinks.link",
peerLinksUnlink: "peerLinks.unlink",
peerLinksAnswerRequest: "peerLinks.answerRequest",
serverGetSettings: "server.getSettings",
serverUpdateSettings: "server.updateSettings",
serverDiscoverSourceControl: "server.discoverSourceControl",
serverCheckSecretSource: "server.checkSecretSource",
Expand Down Expand Up @@ -864,6 +865,13 @@ const WsPeerLinksAnswerRequestRpc = Rpc.make(WS_METHODS.peerLinksAnswerRequest,
error: Schema.Union([PeerLinkRequestError, EnvironmentAuthorizationError]),
});

// No in-tree caller; installed Swift TestFlight builds still request it.
const WsServerGetSettingsRpc = Rpc.make(WS_METHODS.serverGetSettings, {
payload: Schema.Struct({}),
success: ServerSettings,
error: Schema.Union([ServerSettingsError, EnvironmentAuthorizationError]),
});

const WsServerUpdateSettingsRpc = Rpc.make(WS_METHODS.serverUpdateSettings, {
payload: Schema.Struct({
patch: ClientServerSettingsPatch,
Expand Down Expand Up @@ -2132,6 +2140,7 @@ export const WsRpcGroup = RpcGroup.make(
WsServerRunStorageCleanupRpc,
WsServerGetStorageCleanupReportRpc,
WsServerGetDatabaseStorageRpc,
WsServerGetSettingsRpc,
WsServerReclaimDatabaseSpaceRpc,
WsServerUpdateSettingsRpc,
WsPeerLinksListRpc,
Expand Down
Loading