You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "Sun-GLiang (via GitHub)" <gi...@apache.org> on 2026/08/24 10:17:01 UTC

[PR] fix(desktop): prevent proxy password mask corruption [maka]

Sun-GLiang opened a new pull request, #3704:
URL: https://github.com/apache/maka/pull/3704

   ## Summary
   
   - keep saved proxy credentials out of persisted settings and Renderer input values
   - add an explicit keep/replace/delete credential contract with a shared Runtime Host operation lane
   - keep password editing local until blur or Enter, make Eye reveal the current draft, and remove Copy only from the proxy password field
   - preserve schema-v1 config import/export compatibility with preflight validation
   
   Fixes #3696
   
   ## Dependency
   
   - Built on `fix/proxy-auth-test-consistency`, the implementation branch for #3682.
   - Until #3682 lands, the compare view against `main` also contains dependency commit `ec3b38b3c`.
   - Rebase this branch onto the updated `main` after #3682 lands so the PR contains only `b94e9ab0d`.
   
   ## Verification
   
   - `npm test` — all workspace tests passed; Desktop 1393/1393
   - focused proxy password tests — 36/36
   - offline authenticated proxy E2E — 1/1
   - `npm run lint`
   - `npm run format:check`
   - `npm run build`
   - `npm run typecheck`
   - `npx knip --workspace apps/desktop`
   - `npx knip --workspace packages/ui`
   
   ## AI use
   
   Select exactly one:
   
   - [ ] No generative tool made a substantive contribution
   - [x] Generative tooling made a substantive contribution
   
   Tool(s) and scope: OpenAI Codex implemented the fix, tests, verification, and review-driven corrections.
   
   ## Checklist
   
   - [x] Tests cover the change and fail without it
   - [x] Lint, format, typecheck and the affected suites pass locally
   
   Does this PR entail a change in behavior?
   
   - [x] Yes — described under Summary above
   - [ ] No
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): make proxy credential updates explicit and Host-owned [maka]

Posted by "me2seeks (via GitHub)" <gi...@apache.org>.
me2seeks merged PR #3704:
URL: https://github.com/apache/maka/pull/3704


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): make proxy credential updates explicit and Host-owned [maka]

Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #3704:
URL: https://github.com/apache/maka/pull/3704#discussion_r3890169226


##########
apps/desktop/src/main/runtime-host-config-ipc-main.ts:
##########
@@ -150,11 +189,17 @@ export async function gatherRuntimeHostConfig(
   if (selected.has('connections') && catalog) {
     data.connections = projectHostConnections(catalog);
   }
+  // Schema v1 stores the network-proxy password and Tavily key in the
+  // settings payload. Keep a credentials-only request lossless by making the
+  // dependency explicit in the generated bundle.
   if (selected.has('settings')) {
     const settings = await deps.getSettings();
     data.settings = selected.has('credentials')
       ? restoreHostSettingsSecrets(settings, secrets)
       : stripSettingsSecretsForExport(settings);
+  } else if (selected.has('credentials')) {
+    const settingsSecrets = projectHostSettingsSecrets(secrets);

Review Comment:
   [P2] (category ① — normal credentials restore path)
   
   Thanks for keeping credentials-only export lossless. A proxy password by itself currently produces `{network.proxy.password}` without `authEnabled`; on a fresh/default target the imported patch is merged with `authEnabled: false`, then adapted to `credential: replace`, which the policy/credential operation rejects. That makes a normal credentials-only round trip fail and also prevents later Tavily/model credentials in the bundle from being applied. Could the bundle carry the minimum proxy-auth policy needed for this secret, or skip/report the incompatible secret without aborting unrelated credentials, with an export→default-target import regression? Please push back if credentials-only restore intentionally requires preconfiguring identical proxy policy on the target.



##########
apps/desktop/src/main/config-transfer-service.ts:
##########
@@ -91,13 +91,25 @@ export async function applyConfigImport(
         ? reconcileConnectionAfterEnabledModelsChange(connection, connection.enabledModelIds)
         : null;
       await deps.connectionStore.save(selection ? { ...connection, ...selection } : connection);
-      appliedConnectionSlugs.add(connection.slug);
+      credentialTargetSlugs.add(connection.slug);
     }
     result.connections = {
       created: plan.create.length,
       overwritten: plan.overwrite.length,
       skipped: plan.skipped.length,
     };
+  } else if (
+    !bundle.includedData.includes('connections') &&
+    Array.isArray(bundle.data.credentials)
+  ) {
+    // Without a connection snapshot, the credential slug names an existing
+    // logical connection directly. A bundle that does include connections
+    // still uses the create/overwrite set above so an explicit skip cannot
+    // overwrite the target's credential.
+    const existing = await deps.connectionStore.list();

Review Comment:
   [P1] (category ① — normal credentials restore path)
   
   Thanks for restoring credentials-only bundles against existing connections. The source entry still carries only `{slug, kind, value}`, while this branch treats every target connection with the same slug as eligible. A normal restore between profiles can therefore take an API key/request-header secret for source slug `team` and write it into a target `team` whose provider or custom `baseUrl` is different; the next model request sends that secret to the target endpoint. This is the remaining boundary from the earlier connection-identity comment: slug plus credential kind is not an endpoint identity. Could the exported entry include a minimal verifiable binding (at least provider type plus canonical effective endpoint/fingerprint), skip/report mismatches, and cover same-slug/different-provider and same-provider/different-baseUrl restores? Please feel free to push back if another authenticated binding is preserved outside this payload.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): make proxy credential updates explicit and Host-owned [maka]

Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #3704:
URL: https://github.com/apache/maka/pull/3704#discussion_r3892393043


##########
apps/desktop/src/main/config-transfer-service.ts:
##########
@@ -116,10 +134,14 @@ export async function applyConfigImport(
         entry.value.length > 0 &&
         VALID_CREDENTIAL_KINDS.has(entry.kind);
       if (!valid) continue;
-      // Only write a secret for a connection that was created or overwritten
-      // in this import. Skipped (or not-imported) slugs keep their existing
-      // stored secret untouched.
-      if (!appliedConnectionSlugs.has(entry.slug)) {
+      // Unknown targets and connections explicitly skipped by a connection
+      // snapshot keep their existing stored secret untouched.
+      const target = credentialTargets.get(entry.slug);
+      if (!credentialTargets.has(entry.slug)) {
+        skipped += 1;
+        continue;
+      }
+      if (target && !matchesCredentialConnection(entry.connection, target)) {

Review Comment:
   Thanks for checking provider and effective endpoint here. [P1 · category ②] This validation still happens outside the Host credential mutation authority. Another supported client can change the same connectionId/slug after this snapshot but before saveConnectionCredential reloads by slug and writes the vault; the writer never receives or revalidates this expected binding/revision. The credential can therefore be committed to the newly retargeted connection, and export has the symmetric catalog-read → secret-read window. Could Host own a bound export/write operation that validates connection revision, provider, canonical endpoint, and credential basis in its mutation lane? A deterministic two-client target-change cut would cover the gap.



##########
apps/desktop/src/main/runtime-host-config-ipc-main.ts:
##########
@@ -362,6 +437,106 @@ function restoreHostSettingsSecrets(
   };
 }
 
+function projectHostSettingsSecrets(
+  secrets: ReadonlyMap<string, string>,
+): Record<string, unknown> | undefined {
+  const proxy = secrets.get(
+    locatorKey({ scope: 'network_proxy', kind: 'password' }),
+  );
+  const tavily = secrets.get(
+    locatorKey({ scope: 'web_search', provider: 'tavily', kind: 'api_key' }),
+  );
+  if (proxy === undefined && tavily === undefined) return undefined;
+
+  return {
+    ...(proxy === undefined
+      ? {}
+      : {
+          network: {
+            proxy: { authEnabled: true, password: proxy },

Review Comment:
   Thanks for making credentials-only proxy restore valid on a default target. [P1 · category ①] The exported password still has no binding to the source proxy destination: this payload carries only authEnabled and password, not protocol/host/port/username. Importing it into a profile already configured for a different proxy therefore keeps that target endpoint and username while replacing its password; the next proxied request can send the source proxy secret to a different server. Could the bundle carry and verify the minimum proxy target/auth identity, skipping and reporting mismatches, or restore the full necessary proxy policy explicitly? A source proxy A → target proxy B regression would pin the intended contract.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): prevent proxy password mask corruption [maka]

Posted by "Sun-GLiang (via GitHub)" <gi...@apache.org>.
Sun-GLiang commented on code in PR #3704:
URL: https://github.com/apache/maka/pull/3704#discussion_r3850496525


##########
apps/desktop/src/main/runtime-host-settings-ipc-main.ts:
##########
@@ -234,26 +321,20 @@ function projectWebSearchCredential(
   };
 }
 
-async function applyHostPatch(
+async function applyHostPatchWithoutLane(
   client: RuntimeHostSettingsClient,
   patch: UpdateAppSettingsInput,
 ): Promise<void> {
   if (patch.network?.proxy) {
     const proxy = patch.network.proxy;
     await client.updateRuntimePolicy((policy) => ({
       kind: "set_network_proxy",
-      value: { ...policy.networkProxy, ...withoutSecret(proxy) },
+      value: { ...policy.networkProxy, ...withoutCredential(proxy) },
     }));
-    if (proxy.authEnabled === false)
+    if (proxy.authEnabled === false || proxy.credential?.kind === "delete")
       await deleteCredential(client, PROXY_CREDENTIAL);
-    else if (
-      proxy.password !== undefined &&
-      proxy.password !== SENSITIVE_PLACEHOLDER
-    ) {
-      if (proxy.password.length === 0)
-        await deleteCredential(client, PROXY_CREDENTIAL);
-      else await setCredential(client, PROXY_CREDENTIAL, proxy.password);
-    }
+    else if (proxy.credential?.kind === "replace")
+      await setCredential(client, PROXY_CREDENTIAL, proxy.credential.secret);

Review Comment:
   Fixed in 2948461d4. Desktop no longer performs a client-local credential CAS/retry. It sends the observed policy revision, credential basis, complete proxy policy, and keep/replace/delete intent through the Host-owned `runtime.policy.network-proxy.update` operation. The Host rejects a stale client before it can recreate a deleted credential.
   
   Added coordinator and storage tests with two clients observing the same initial basis: client B disables authentication, then client A attempts the stale replacement. The replacement is rejected, the final policy remains `authEnabled: false`, and the vault remains empty.



##########
apps/desktop/src/main/runtime-host-settings-ipc-main.ts:
##########
@@ -234,26 +321,20 @@ function projectWebSearchCredential(
   };
 }
 
-async function applyHostPatch(
+async function applyHostPatchWithoutLane(
   client: RuntimeHostSettingsClient,
   patch: UpdateAppSettingsInput,
 ): Promise<void> {
   if (patch.network?.proxy) {
     const proxy = patch.network.proxy;
     await client.updateRuntimePolicy((policy) => ({

Review Comment:
   Fixed in 2948461d4. Proxy policy and credential changes now use one Host-side recoverable operation backed by a persisted transaction intent, so Desktop no longer commits policy before a credential write that can independently fail.
   
   Added persistence-cut coverage for the compound operation and a Desktop regression test verifying that a rejected credential replacement does not expose newly requested proxy policy fields with the old credential. Recovery leaves the pair either unchanged or consistently committed, and the transaction intent is cleared after recovery.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): make proxy credential updates explicit and Host-owned [maka]

Posted by "Sun-GLiang (via GitHub)" <gi...@apache.org>.
Sun-GLiang commented on code in PR #3704:
URL: https://github.com/apache/maka/pull/3704#discussion_r3892694496


##########
apps/desktop/src/main/config-transfer-service.ts:
##########
@@ -116,10 +134,14 @@ export async function applyConfigImport(
         entry.value.length > 0 &&
         VALID_CREDENTIAL_KINDS.has(entry.kind);
       if (!valid) continue;
-      // Only write a secret for a connection that was created or overwritten
-      // in this import. Skipped (or not-imported) slugs keep their existing
-      // stored secret untouched.
-      if (!appliedConnectionSlugs.has(entry.slug)) {
+      // Unknown targets and connections explicitly skipped by a connection
+      // snapshot keep their existing stored secret untouched.
+      const target = credentialTargets.get(entry.slug);
+      if (!credentialTargets.has(entry.slug)) {
+        skipped += 1;
+        continue;
+      }
+      if (target && !matchesCredentialConnection(entry.connection, target)) {

Review Comment:
   Follow-up in 463eb56df closes the compatibility fallback introduced by 6c6644b72: when no Connection snapshot is present, an imported credential must carry entry.connection. Desktop no longer synthesizes that source binding from the target Connection; a missing binding is skipped and reported. Snapshot-backed imports retain their existing create/overwrite compatibility path. Added a regression that fails on 6c6644b72 and verifies no credential write occurs.



##########
apps/desktop/src/main/runtime-host-config-ipc-main.ts:
##########
@@ -362,6 +437,106 @@ function restoreHostSettingsSecrets(
   };
 }
 
+function projectHostSettingsSecrets(
+  secrets: ReadonlyMap<string, string>,
+): Record<string, unknown> | undefined {
+  const proxy = secrets.get(
+    locatorKey({ scope: 'network_proxy', kind: 'password' }),
+  );
+  const tavily = secrets.get(
+    locatorKey({ scope: 'web_search', provider: 'tavily', kind: 'api_key' }),
+  );
+  if (proxy === undefined && tavily === undefined) return undefined;
+
+  return {
+    ...(proxy === undefined
+      ? {}
+      : {
+          network: {
+            proxy: { authEnabled: true, password: proxy },

Review Comment:
   Follow-up in 463eb56df closes the remaining legacy path: a non-empty schema-v1 proxy password without credentialTarget is rejected during import preflight, so adaptRuntimeHostConfigImport cannot construct an unbound replace. Bound imports still normalize the target and use the existing compound Host operation. Added a regression that fails on 6c6644b72.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): prevent proxy password mask corruption [maka]

Posted by "Sun-GLiang (via GitHub)" <gi...@apache.org>.
Sun-GLiang commented on PR #3704:
URL: https://github.com/apache/maka/pull/3704#issuecomment-5423140126

   @Astro-Han Addressed the review in 7be1502b3:
   
   - corrected the earlier transaction-intent/recovery claim; the implementation uses ordered publication with `commit_outcome_unknown`, and now has first-cut unchanged plus later-cut known-unknown failure-injection coverage
   - narrowed credentials-only schema-v1 exports to only proxy password and Tavily API key fields
   - prevented window blur from committing a partial password draft
   - removed the dead password override from `network-proxy.test`; the PR Summary now states that testing commits the pending password draft first
   - removed `preserveSensitivePlaceholders`, `FileSettingsStore.testNetworkProxy()`, and the legacy registration-deps branch
   
   I kept the schema-v1 compatibility change in this PR because secret removal changes where those schema-v1 credentials come from, but reduced it to credential-bearing fields so it no longer carries or reapplies unrelated settings.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): make proxy credential updates explicit and Host-owned [maka]

Posted by "Sun-GLiang (via GitHub)" <gi...@apache.org>.
Sun-GLiang commented on code in PR #3704:
URL: https://github.com/apache/maka/pull/3704#discussion_r3889726241


##########
apps/desktop/src/main/runtime-host-config-ipc-main.ts:
##########
@@ -150,11 +189,16 @@ export async function gatherRuntimeHostConfig(
   if (selected.has('connections') && catalog) {
     data.connections = projectHostConnections(catalog);
   }
+  // Schema v1 stores the network-proxy password and Tavily key in the
+  // settings payload. Keep a credentials-only request lossless by making the
+  // dependency explicit in the generated bundle.
   if (selected.has('settings')) {
     const settings = await deps.getSettings();
     data.settings = selected.has('credentials')
       ? restoreHostSettingsSecrets(settings, secrets)
       : stripSettingsSecretsForExport(settings);
+  } else if (selected.has('credentials')) {
+    data.settings = projectHostSettingsSecrets(secrets);

Review Comment:
   Fixed in 7e14d8934. A credentials-only import now binds credential entries to an already-existing connection with the same slug when the bundle manifest omits `connections`. If the bundle does carry a connection snapshot, credential writes remain limited to connections created or overwritten by that import, so an explicit skip still preserves the target credential. Added an existing-target restore regression and made the credentials-only export test exercise a non-empty catalog.



##########
apps/desktop/src/main/runtime-host-config-ipc-main.ts:
##########
@@ -362,6 +412,98 @@ function restoreHostSettingsSecrets(
   };
 }
 
+function projectHostSettingsSecrets(
+  secrets: ReadonlyMap<string, string>,
+): Record<string, unknown> {
+  return {
+    network: {
+      proxy: {
+        password:
+          secrets.get(locatorKey({ scope: 'network_proxy', kind: 'password' })) ?? '',

Review Comment:
   Fixed in 7e14d8934. Credentials-only export now omits each absent settings-carried secret instead of encoding absence as an empty string; when both proxy and Tavily secrets are absent, no settings compatibility payload is emitted. Added proxy-only, Tavily-only, and both-absent regressions. Full settings+credentials snapshot behavior remains unchanged.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): prevent proxy password mask corruption [maka]

Posted by "Sun-GLiang (via GitHub)" <gi...@apache.org>.
Sun-GLiang commented on PR #3704:
URL: https://github.com/apache/maka/pull/3704#issuecomment-5406989381

   CI status note: `package` passed. The `test` job failed on the unrelated Desktop E2E case `slash-command-menu.spec.ts: an open menu keeps its container and skills group across projection refreshes`, where CI observed 2 DOM removals instead of 0.
   
   This PR does not change the slash-command/menu implementation or that test relative to current `upstream/main`. The exact failing case passed locally once and then 10/10 repeated runs; the proxy-password E2E also passed in the CI run. This is therefore consistent with an existing full-suite timing flake rather than a proxy-password regression. Failed job: https://github.com/apache/maka/actions/runs/32820203074/job/97716509006


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): make proxy credential updates explicit and Host-owned [maka]

Posted by "Sun-GLiang (via GitHub)" <gi...@apache.org>.
Sun-GLiang commented on code in PR #3704:
URL: https://github.com/apache/maka/pull/3704#discussion_r3891864523


##########
apps/desktop/src/main/runtime-host-config-ipc-main.ts:
##########
@@ -150,11 +189,17 @@ export async function gatherRuntimeHostConfig(
   if (selected.has('connections') && catalog) {
     data.connections = projectHostConnections(catalog);
   }
+  // Schema v1 stores the network-proxy password and Tavily key in the
+  // settings payload. Keep a credentials-only request lossless by making the
+  // dependency explicit in the generated bundle.
   if (selected.has('settings')) {
     const settings = await deps.getSettings();
     data.settings = selected.has('credentials')
       ? restoreHostSettingsSecrets(settings, secrets)
       : stripSettingsSecretsForExport(settings);
+  } else if (selected.has('credentials')) {
+    const settingsSecrets = projectHostSettingsSecrets(secrets);

Review Comment:
   Fixed in a0ea94647. When a credentials-only export contains a proxy password, its schema-v1 compatibility payload now also carries the minimum required proxy-auth policy (`authEnabled: true`). The import adapter therefore produces a valid replace operation against a fresh/default target instead of aborting the remaining credential import. Added an export-to-default-target regression; absent proxy credentials remain omitted and non-destructive.



##########
apps/desktop/src/main/config-transfer-service.ts:
##########
@@ -91,13 +91,25 @@ export async function applyConfigImport(
         ? reconcileConnectionAfterEnabledModelsChange(connection, connection.enabledModelIds)
         : null;
       await deps.connectionStore.save(selection ? { ...connection, ...selection } : connection);
-      appliedConnectionSlugs.add(connection.slug);
+      credentialTargetSlugs.add(connection.slug);
     }
     result.connections = {
       created: plan.create.length,
       overwritten: plan.overwrite.length,
       skipped: plan.skipped.length,
     };
+  } else if (
+    !bundle.includedData.includes('connections') &&
+    Array.isArray(bundle.data.credentials)
+  ) {
+    // Without a connection snapshot, the credential slug names an existing
+    // logical connection directly. A bundle that does include connections
+    // still uses the create/overwrite set above so an explicit skip cannot
+    // overwrite the target's credential.
+    const existing = await deps.connectionStore.list();

Review Comment:
   Fixed in a0ea94647. Exported connection credentials now carry a binding with the source provider type and effective base URL. A credentials-only import writes only when the existing target with that slug matches both values; same-slug/different-provider and same-provider/different-endpoint targets are skipped and reported. Connection-snapshot imports retain the existing create/overwrite boundary. Added exact-match plus both mismatch regressions.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): prevent proxy password mask corruption [maka]

Posted by "Sun-GLiang (via GitHub)" <gi...@apache.org>.
Sun-GLiang commented on code in PR #3704:
URL: https://github.com/apache/maka/pull/3704#discussion_r3850497345


##########
apps/desktop/src/main/runtime-host-settings-ipc-main.ts:
##########
@@ -234,26 +321,20 @@ function projectWebSearchCredential(
   };
 }
 
-async function applyHostPatch(
+async function applyHostPatchWithoutLane(
   client: RuntimeHostSettingsClient,
   patch: UpdateAppSettingsInput,
 ): Promise<void> {
   if (patch.network?.proxy) {
     const proxy = patch.network.proxy;
     await client.updateRuntimePolicy((policy) => ({

Review Comment:
   Updated in 7be1502b3. The Desktop path now sends one Host-owned `runtime.policy.network-proxy.update` operation with the observed policy revision, credential basis, complete policy, and explicit keep/replace/delete intent. The Host validates both bases in its mutation lane.
   
   Correction to my earlier reply: this implementation does not persist a transaction intent and does not perform automatic recovery. Storage orders replacement before enabling credential use, and stops policy use before deletion. A failure before the first publication leaves policy and credential unchanged; a later failure after one durable effect returns `commit_outcome_unknown`. Persistence-cut tests now cover both the unchanged and known-unknown cases for replacement and disable/delete.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): make proxy credential updates explicit and Host-owned [maka]

Posted by "Sun-GLiang (via GitHub)" <gi...@apache.org>.
Sun-GLiang commented on code in PR #3704:
URL: https://github.com/apache/maka/pull/3704#discussion_r3892622502


##########
apps/desktop/src/main/config-transfer-service.ts:
##########
@@ -116,10 +134,14 @@ export async function applyConfigImport(
         entry.value.length > 0 &&
         VALID_CREDENTIAL_KINDS.has(entry.kind);
       if (!valid) continue;
-      // Only write a secret for a connection that was created or overwritten
-      // in this import. Skipped (or not-imported) slugs keep their existing
-      // stored secret untouched.
-      if (!appliedConnectionSlugs.has(entry.slug)) {
+      // Unknown targets and connections explicitly skipped by a connection
+      // snapshot keep their existing stored secret untouched.
+      const target = credentialTargets.get(entry.slug);
+      if (!credentialTargets.has(entry.slug)) {
+        skipped += 1;
+        continue;
+      }
+      if (target && !matchesCredentialConnection(entry.connection, target)) {

Review Comment:
   Fixed in 6c6644b72. The existing configuration credential export and credential.vault.set paths now accept an exact connection target basis. Storage validates connection revision, slug, provider, canonical effective endpoint, and the existing credential CAS basis in its serialized lane before reading or writing secret material. Desktop retries a stale bound export and skips/reports a stale import. Added deterministic Storage and two-Client Runtime Host retarget tests.



##########
apps/desktop/src/main/runtime-host-config-ipc-main.ts:
##########
@@ -362,6 +437,106 @@ function restoreHostSettingsSecrets(
   };
 }
 
+function projectHostSettingsSecrets(
+  secrets: ReadonlyMap<string, string>,
+): Record<string, unknown> | undefined {
+  const proxy = secrets.get(
+    locatorKey({ scope: 'network_proxy', kind: 'password' }),
+  );
+  const tavily = secrets.get(
+    locatorKey({ scope: 'web_search', provider: 'tavily', kind: 'api_key' }),
+  );
+  if (proxy === undefined && tavily === undefined) return undefined;
+
+  return {
+    ...(proxy === undefined
+      ? {}
+      : {
+          network: {
+            proxy: { authEnabled: true, password: proxy },

Review Comment:
   Fixed in 6c6644b72. Credentials-only proxy export now carries the minimum Host-read target identity (protocol, normalized host, port, and username). Import passes that identity through the existing compound runtime.policy.network-proxy.update operation; Storage compares it with the current proxy inside the same lane and returns proxy_target_mismatch before either policy or vault publication. Desktop skips and reports that credential instead of changing proxy policy. Added source proxy A to target proxy B coverage and a proxy export race test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): prevent proxy password mask corruption [maka]

Posted by "jackwener (via GitHub)" <gi...@apache.org>.
jackwener commented on code in PR #3704:
URL: https://github.com/apache/maka/pull/3704#discussion_r3849891629


##########
apps/desktop/src/main/runtime-host-settings-ipc-main.ts:
##########
@@ -234,26 +321,20 @@ function projectWebSearchCredential(
   };
 }
 
-async function applyHostPatch(
+async function applyHostPatchWithoutLane(
   client: RuntimeHostSettingsClient,
   patch: UpdateAppSettingsInput,
 ): Promise<void> {
   if (patch.network?.proxy) {
     const proxy = patch.network.proxy;
     await client.updateRuntimePolicy((policy) => ({

Review Comment:
   [P2] Do not commit proxy policy before the credential write can still fail. A normal update containing both policy fields and `credential: replace/delete` first commits `set_network_proxy` here, then performs vault persistence below. If that second step rejects, the caller receives an error even though the Host is already using the new host/auth/username with the old credential. This is also reachable from the schema-v1 settings-plus-credentials import path. A production-adapter failure probe observed the rejected call with `enabled=true`, `authEnabled=true`, `username=new-user`, and the old secret still stored; the success control stored the replacement. Existing failure coverage sends a credential-only patch, so it never checks policy after the failure. Please make this a single Host-side compound operation, or define an explicit recoverable commit protocol, and test each persistence cut for committed/unchanged/known recovery semantics.



##########
apps/desktop/src/main/runtime-host-settings-ipc-main.ts:
##########
@@ -234,26 +321,20 @@ function projectWebSearchCredential(
   };
 }
 
-async function applyHostPatch(
+async function applyHostPatchWithoutLane(
   client: RuntimeHostSettingsClient,
   patch: UpdateAppSettingsInput,
 ): Promise<void> {
   if (patch.network?.proxy) {
     const proxy = patch.network.proxy;
     await client.updateRuntimePolicy((policy) => ({
       kind: "set_network_proxy",
-      value: { ...policy.networkProxy, ...withoutSecret(proxy) },
+      value: { ...policy.networkProxy, ...withoutCredential(proxy) },
     }));
-    if (proxy.authEnabled === false)
+    if (proxy.authEnabled === false || proxy.credential?.kind === "delete")
       await deleteCredential(client, PROXY_CREDENTIAL);
-    else if (
-      proxy.password !== undefined &&
-      proxy.password !== SENSITIVE_PLACEHOLDER
-    ) {
-      if (proxy.password.length === 0)
-        await deleteCredential(client, PROXY_CREDENTIAL);
-      else await setCredential(client, PROXY_CREDENTIAL, proxy.password);
-    }
+    else if (proxy.credential?.kind === "replace")
+      await setCredential(client, PROXY_CREDENTIAL, proxy.credential.secret);

Review Comment:
   [P1] Make proxy policy and credential replacement one Host-owned operation across clients. The new queue is local to one `RuntimeHostSettingsModule`, so two supported Desktop clients have independent lanes. Client A can start a replacement and pause at the credential CAS; client B can then set `authEnabled=false` and delete the credential; when A receives `credential_stale`, its retry rereads the now-empty locator and recreates the secret with `expected: null`. A production-adapter/CAS probe ended with `authEnabled=false` while the vault again contained A's replacement secret. The existing "disable wins" test uses one module and therefore cannot cover this inter-client ordering. Please move the policy decision plus keep/replace/delete into one Runtime Host atomic or recoverable operation that validates both the policy revision and credential basis, and add a two-client test asserting the vault remains empty after disable.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): make proxy credential updates explicit and Host-owned [maka]

Posted by "Sun-GLiang (via GitHub)" <gi...@apache.org>.
Sun-GLiang commented on PR #3704:
URL: https://github.com/apache/maka/pull/3704#issuecomment-5434105031

   I have updated the PR title and charter to match the change that is actually being reviewed.
   
   The title is now:
   
   > `fix(desktop): make proxy credential updates explicit and Host-owned`
   
   The PR description now presents this as a proxy-credential lifecycle migration rather than an input-mask-only fix. It separates the review into three explicit contracts:
   
   1. legacy Settings cleanup and schema-v1 credential transfer;
   2. Host-owned policy/vault CAS, publication ordering, and partial-outcome reporting;
   3. Renderer-local draft, commit/cancel/reveal behavior, and proxy-only Copy removal.
   
   I have not split the branch at this point. These contracts are independently testable, but the current implementation delivers them as one compatibility boundary. Splitting them would require a temporary dual-shape compatibility layer or restoring part of the unsafe representation during the intermediate merges:
   
   - Removing `password` from ordinary Settings requires both the read-only `passwordConfigured` projection and a write-only credential mutation.
   - The Renderer draft depends on that explicit Host mutation; otherwise an intermediate version must retain either the sentinel or the previous split-write path.
   - The Host operation must validate the policy revision and credential generation in one lane so disabling authentication wins over an older replacement, as required by #3696.
   - Once the Settings shape changes, schema-v1 transfer needs an adapter and persisted legacy Settings need cleanup so compatibility paths cannot retain or reintroduce the removed secret field.
   - The Runtime Host epoch moves with this boundary because an older peer can split policy and credential writes against different bases.
   
   The revised description does not claim an all-or-nothing storage transaction. It states the implemented contract directly: shared preflight, ordered publication, and `commit_outcome_unknown` when a durable failure occurs after only part of the compound operation has committed.
   
   The verification section is now organized around the invariant-bearing coverage for each review boundary: minimal migration and credential-only transfer cases, Host two-client/CAS and durable failure cuts, Renderer draft concurrency/failure cases, and one offline authenticated-proxy E2E. I have not moved or pruned tests while the review-unit decision remains open.
   
   Please re-evaluate the review unit under the revised title and charter. If maintainers still require a physical split after considering these compatibility dependencies, the fallback will be ordered stacked PRs rather than treating the three contracts as unrelated changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(desktop): make proxy credential updates explicit and Host-owned [maka]

Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #3704:
URL: https://github.com/apache/maka/pull/3704#discussion_r3889694347


##########
apps/desktop/src/main/runtime-host-config-ipc-main.ts:
##########
@@ -150,11 +189,16 @@ export async function gatherRuntimeHostConfig(
   if (selected.has('connections') && catalog) {
     data.connections = projectHostConnections(catalog);
   }
+  // Schema v1 stores the network-proxy password and Tavily key in the
+  // settings payload. Keep a credentials-only request lossless by making the
+  // dependency explicit in the generated bundle.
   if (selected.has('settings')) {
     const settings = await deps.getSettings();
     data.settings = selected.has('credentials')
       ? restoreHostSettingsSecrets(settings, secrets)
       : stripSettingsSecretsForExport(settings);
+  } else if (selected.has('credentials')) {
+    data.settings = projectHostSettingsSecrets(secrets);

Review Comment:
   Thanks for making the proxy/Tavily dependency explicit for credentials-only export. I think the same [P1] category ① path is still lossy for model credentials: when only `credentials` is selected, this branch adds settings secrets but still omits `data.connections`. `applyConfigImport()` only adds slugs to `appliedConnectionSlugs` for connections created or overwritten by this import, so a target that already has the matching connection skips every exported model credential. The added test uses an empty connection catalog and cannot exercise that normal restore. I suggest allowing a credentials-only bundle to bind to an already-existing exact connection identity while preserving the explicit “skip connection” protection, then adding an existing-target-connection restore test. Please push back if model credentials are intentionally excluded from the lossless claim.



##########
apps/desktop/src/main/runtime-host-config-ipc-main.ts:
##########
@@ -362,6 +412,98 @@ function restoreHostSettingsSecrets(
   };
 }
 
+function projectHostSettingsSecrets(
+  secrets: ReadonlyMap<string, string>,
+): Record<string, unknown> {
+  return {
+    network: {
+      proxy: {
+        password:
+          secrets.get(locatorKey({ scope: 'network_proxy', kind: 'password' })) ?? '',

Review Comment:
   Thanks for handling schema-v1 settings-carried secrets. Using `""` for “the source has no credential” creates a [P1] category ① destructive restore: the importer maps an empty proxy password to `credential: delete`, and the settings writer likewise deletes Tavily when `apiKey.length === 0`. A credentials-only export from a source with no proxy/Tavily secret can therefore erase valid secrets already present on the target. Generic connection credentials use omission/skip for absence, so these categories currently disagree. I suggest encoding absent, replace, and explicit delete separately (or clearly defining and testing destructive snapshot semantics) and adding source-absent/target-present regressions. Please push back if deletion is the intended public contract.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org