Files
PaperClipAI/ui/src/components/AgentSecretAccessEditor.test.tsx
T
DottaandPaperclip 079fb1fe63 fix(secrets): add env-name secret guardrails, collision recovery, and API-access clarity (#22982)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Operators configure agent and environment secrets across Environment
variables and Secret access settings
> - Three common mistakes currently fail poorly or leak credentials:
pasting a token into an environment variable name passes validation and
leaks into run settings and logs, converting a plain environment
variable onto an existing secret name dead-ends with a disabled submit
button, and adding an API-access secret does not clarify that processes
will not see `$NAME` unless it is also bound as an environment variable
> - Secret configuration should prevent credential leaks by default and
recover cleanly from common setup mistakes
> - This pull request rejects and redacts secret-shaped environment
variable names and access aliases across shared, server, and UI layers,
adds "Use existing secret" and "Save as new version" recovery actions on
secret name collisions, and explains API-only vs `$NAME` delivery with
an "Also bind as env var" quick action
> - The benefit is safer secret handling with zero raw token leaks in
errors, settings, or logs and a smoother operator workflow

## Linked Issues or Issue Description

**What happened?**

Three issues occur when operators configure agent and environment
secrets:

1. Pasting a credential token (for example `github_pat_...`, `ghp_...`,
or `sk-...`) into an environment variable Name field passes
`^[A-Za-z_][A-Za-z0-9_]*$` for underscore-based tokens (such as
`github_pat_...` and `ghp_...`) or echoes the raw token in the server
error message for dashed tokens (such as `sk-...`). Existing redactors
also scrub only values, not secret-shaped object keys, so legacy or
rejected payloads leak the token in run settings and logs.
2. Converting a plain environment variable to a secret via
`ConvertToSecretPopover` (or creating a secret via
`CreateSecretPopover`) disables submission with `"A secret with this
name already exists"` whenever the suggested name already exists,
forcing the operator to cancel and switch flows manually.
3. Binding a secret under `Secret access > API access (no env var)` does
not state clearly that agent processes and shell scripts will not see
`$NAME` unless the secret is also bound under Environment variables, and
provides no quick action to add the matching environment variable
binding.

**Expected behavior**

1. Both UI and server reject secret-shaped environment variable names
and access aliases with an actionable error that never echoes the token,
mask accidental token input immediately in the UI, and redact
secret-shaped keys in adapter configs, event payloads, command/text
redaction, and HTTP 4xx/5xx request logs.
2. When a secret name already exists in `CreateSecretPopover` /
`ConvertToSecretPopover`, the popover lets the operator bind the
existing secret directly or save the typed value as a new version
(rotate) without dead-ending.
3. `AgentSecretAccessEditor` clearly explains that API-access secrets
are not injected as `$NAME` in the process environment and offers an
`"Also bind as env var"` quick action for API-only bindings.

**Steps to reproduce**

1. Open an agent's Secrets & variables settings and paste a GitHub
fine-grained PAT (`github_pat_...`) into an environment variable Name
field and save; observe that it is accepted and returned verbatim in
redacted adapter config / logs.
2. Create a company secret named `gh_token`, then add a plain env var
`GH_TOKEN` with a value and click "Store as secret"; observe the
disabled `"Store & bind"` dead end.
3. Bind a secret under `Secret access > API access (no env var)` and
observe that no guidance mentions `$NAME` visibility for
processes/scripts and no quick action exists to also bind it as an
environment variable.

**Paperclip version or commit**

Reproduced on `origin/master` commit
`2d065677959b585065ff3fec8718156a4cf6f41d`.

## What Changed

- **Shared credential-token detection
(`packages/shared/src/validators/secret.ts`,
`packages/shared/src/validators/index.ts`,
`packages/shared/src/index.ts`)**: Exported `ENV_VAR_NAME_RE`,
`looksLikeCredentialToken`, `SECRET_SHAPED_ENV_NAME_ERROR`, and
`SECRET_SHAPED_ACCESS_ALIAS_ERROR` as a single source of truth shared by
`adapter-utils`, `server`, and `ui`. Updated pinned registry
`tests/runner-e2e/source-sdk-public-inputs.json`.
- **Server validation and defense-in-depth redaction
(`server/src/services/secrets.ts`, `server/src/redaction.ts`,
`server/src/middleware/redact-sensitive.ts`,
`packages/adapter-utils/src/command-redaction.ts`)**:
- Rejected credential-shaped env var names and `access.*` aliases in
`normalizeEnvConfig`, `normalizeAdapterConfigForPersistenceInternal`,
`assertSecretBindingConfigPath`, `resolveEnvBindings`, and
`resolveAdapterConfigForRuntime` without echoing the raw token.
- Redacted secret-shaped object keys in `redactAgentAdapterConfig`,
`sanitizeRecord`, and HTTP log `redactSensitive`, and expanded
`command-redaction.ts` / `redaction.ts` token patterns and hints to
cover `github_pat_`, `sk_live_`/`sk_test_`, `rk_live_`/`rk_test_`, Slack
(`xox*-`), AWS (`AKIA`/`ASIA`), Google (`AIza`), and GitLab (`glpat-`)
tokens.
- **UI env-name guardrails
(`ui/src/components/environment-variables-editor/sensitive.ts`,
`model.ts`, `Row.tsx`, `index.tsx`,
`ui/src/components/AgentSecretAccessEditor.tsx`)**:
- Flagged credential-shaped variable names and access aliases
immediately with an inline error, masked the input (`type="password"` +
`ANALYTICS_NO_CAPTURE_CLASS`), redacted credential-shaped names in the
unsaved-changes summary, disabled inline Save while present, and dropped
credential-shaped aliases from emitted access maps.
- **Plain-to-secret collision recovery
(`ui/src/components/environment-variables-editor/CreateSecretPopover.tsx`,
`Row.tsx`, `index.tsx`, `ui/src/components/AgentSecretAccessEditor.tsx`,
`ui/src/components/AgentConfigForm.tsx`,
`ui/src/pages/CompanyEnvironments.tsx`,
`ui/src/components/ProjectProperties.tsx`)**:
- Replaced the dead-end duplicate-name error in `SecretPopoverForm` with
an inline recovery panel offering `"Use existing secret"` and `"Save as
new version"` (when active and rotatable), wired to `secretsApi.rotate`
across agent, environment, and project editors.
- **API-access vs `$NAME` clarity
(`ui/src/components/AgentSecretAccessEditor.tsx`,
`ui/src/lib/secret-delivery.ts`,
`ui/src/components/AgentConfigForm.tsx`)**:
- Clarified under `API access (no env var)` that processes and shell
scripts will not see `$NAME` unless bound under Environment variables
above, and added an `"Also bind as env var"` quick action on API-only
secret summaries wired to `AgentConfigForm`.
- **Tests**: Extended existing owner suites
(`server/src/__tests__/redaction.test.ts`,
`server/src/__tests__/redact-sensitive.test.ts`,
`server/src/__tests__/agents-adapter-config-user-secret.test.ts`,
`ui/src/components/environment-variables-editor/model.test.ts`,
`ui/src/components/environment-variables-editor/EnvironmentVariablesEditor.test.tsx`,
`ui/src/components/AgentSecretAccessEditor.test.tsx`).

## Verification

- `pnpm vitest run
ui/src/components/environment-variables-editor/EnvironmentVariablesEditor.test.tsx
ui/src/components/AgentSecretAccessEditor.test.tsx
ui/src/components/environment-variables-editor/model.test.ts
ui/src/components/environment-variables-editor/sensitive.test.ts
server/src/__tests__/redaction.test.ts
server/src/__tests__/redact-sensitive.test.ts` — 6 files, 149/149
passed.
- `pnpm vitest run --hookTimeout=120000 --testTimeout=120000
server/src/__tests__/agents-adapter-config-user-secret.test.ts` — 1
file, 6/6 passed (embedded Postgres route test verifying HTTP 422
rejection without token echo for `github_pat_`, `ghp_`, and `sk-` env
var names).
- `pnpm vitest run packages/adapter-utils/src/command-redaction.test.ts`
— 1 file, 43/43 passed.
- `pnpm --filter @paperclipai/shared typecheck && pnpm --filter
@paperclipai/adapter-utils typecheck && pnpm --filter
@paperclipai/server typecheck && pnpm --filter @paperclipai/ui
typecheck` — PASS (0 errors, Storybook catalog clean).
- `pnpm check:token-gates` — PASS (all 4 token gates clean).
- `node scripts/check-test-budget.mjs --files
server/src/__tests__/redaction.test.ts
server/src/__tests__/redact-sensitive.test.ts
server/src/__tests__/agents-adapter-config-user-secret.test.ts
ui/src/components/environment-variables-editor/model.test.ts
ui/src/components/environment-variables-editor/EnvironmentVariablesEditor.test.tsx
ui/src/components/AgentSecretAccessEditor.test.tsx` — PASS.
- `pnpm verify --base 2d06567795
--explain` — `source-sdk-public-inputs.json` verified in sync; exited 2
due to broad input (`tests/runner-e2e/source-sdk-public-inputs.json`),
deferring repo-wide matrix to sharded PR CI.

## Risks

- Low risk. `looksLikeCredentialToken` matches only explicit provider
credential prefixes (`gh[pousr]_`, `github_pat_`, `sk-`,
`sk_live_`/`sk_test_`, `rk_live_`/`rk_test_`, `xox[baprs]-`,
`AKIA`/`ASIA`, `AIza`, `glpat-`, `npm_`, `hf_`, `lin_api_`, `sbp_`,
`SG.`, JWTs, PEM headers, `Bearer `) so ordinary uppercase or long env
var names are unaffected.
- Legacy agent or environment records that already stored a
secret-shaped env var key will now have that key masked as
`***REDACTED***` on reads and skipped with a redacted warning at runtime
(preserving existing heartbeats) and rejected on subsequent saves until
removed/renamed.
- No database migrations are required.

## Model Used

- Google Gemini (Antigravity agentic coding assistant with extended
reasoning, tool use, and local command execution)

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-11-25 22:08:28 +00:00

408 lines
15 KiB
TypeScript

// @vitest-environment jsdom
import { flushSync } from "react-dom";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { CompanySecret, EnvSecretRefBinding } from "@paperclipai/shared";
const mockSecretPickerRender = vi.hoisted(() => vi.fn());
// Keep this component test focused on access-row behavior while asserting that
// the editor routes selection through the shared, folder-aware env picker.
vi.mock("./environment-variables-editor/SecretPicker", () => ({
SecretPicker: (props: {
secretId: string;
secrets: readonly CompanySecret[];
onSelect: (secretId: string) => void;
onCreateNew?: (query: string) => void;
}) => {
mockSecretPickerRender(props);
return <>
<button type="button" data-testid="pick-secret" onClick={() => props.onSelect("s1")}>
pick
</button>
{props.onCreateNew ? (
<button type="button" data-testid="create-secret" onClick={() => props.onCreateNew?.("new_secret")}>
create
</button>
) : null}
</>;
},
}));
import {
AgentSecretAccessEditor,
parseAccessGrants,
parseEnvSecretRefs,
rowsToAccessMap,
summarizeAgentBindings,
} from "./AgentSecretAccessEditor";
function makeSecret(id: string, name: string): CompanySecret {
return {
id,
companyId: "co",
scope: "company",
ownerUserId: null,
userSecretDefinitionId: null,
key: id,
name,
provider: "local_encrypted",
status: "active",
managedMode: "paperclip_managed",
externalRef: null,
providerConfigId: null,
providerMetadata: null,
latestVersion: 1,
description: null,
lastResolvedAt: null,
lastRotatedAt: null,
deletedAt: null,
createdByAgentId: null,
createdByUserId: null,
createdAt: new Date(0),
updatedAt: new Date(0),
};
}
describe("AgentSecretAccessEditor model", () => {
const config = {
env: {
GH_TOKEN: { type: "secret_ref", secretId: "s1", version: 2 },
PLAIN: { type: "plain", value: "hi" },
},
"access.STRIPE": { type: "secret_ref", secretId: "s1" },
"access.BROKEN": { type: "plain", value: "nope" },
model: "claude",
};
it("parses env secret refs, ignoring plain values", () => {
expect(parseEnvSecretRefs(config)).toEqual([{ name: "GH_TOKEN", secretId: "s1", version: 2 }]);
});
it("parses only well-formed top-level access.* secret refs", () => {
expect(parseAccessGrants(config)).toEqual([{ name: "STRIPE", secretId: "s1", version: "latest" }]);
});
it("summarizes bindings per secret with both delivery modes", () => {
const summary = summarizeAgentBindings(parseEnvSecretRefs(config), parseAccessGrants(config));
expect(summary).toEqual([{ secretId: "s1", envKeys: ["GH_TOKEN"], apiAliases: ["STRIPE"] }]);
});
it("drops incomplete, invalid-alias, and unselected rows from the emitted access map", () => {
expect(
rowsToAccessMap([
{ id: "1", alias: "OK", secretId: "s1", version: "latest" },
{ id: "2", alias: "", secretId: "s1", version: "latest" }, // no alias
{ id: "3", alias: "1BAD", secretId: "s1", version: "latest" }, // invalid alias
{ id: "4", alias: "NOSECRET", secretId: "", version: "latest" }, // no secret
]),
).toEqual({ OK: { type: "secret_ref", secretId: "s1", version: "latest" } });
});
});
describe("AgentSecretAccessEditor component", () => {
let container: HTMLDivElement;
let root: Root | null = null;
beforeEach(() => {
container = document.createElement("div");
document.body.appendChild(container);
});
afterEach(() => {
flushSync(() => root?.unmount());
root = null;
container.remove();
vi.clearAllMocks();
});
function render(node: React.ReactNode) {
root = createRoot(container);
flushSync(() => root!.render(node));
}
const secrets = [makeSecret("s1", "STRIPE_KEY")];
it("shows the delivery-mode overview for existing bindings", () => {
render(
<AgentSecretAccessEditor
config={{
env: { GH_TOKEN: { type: "secret_ref", secretId: "s1" } },
"access.STRIPE": { type: "secret_ref", secretId: "s1" },
}}
secrets={secrets}
onChange={() => {}}
/>,
);
expect(container.textContent).toContain("STRIPE_KEY");
expect(container.textContent).toContain("Env var");
expect(container.textContent).toContain("API access");
expect(container.textContent).toContain("env.GH_TOKEN");
expect(container.textContent).toContain("access.STRIPE");
});
it("adds an API-access grant, emitting an access.<ALIAS> secret_ref", () => {
const emitted: Array<Record<string, EnvSecretRefBinding>> = [];
render(
<AgentSecretAccessEditor
config={{}}
secrets={secrets}
onChange={(next) => emitted.push(next)}
/>,
);
// "Add API access" appends an editable row.
const addButton = [...container.querySelectorAll("button")].find(
(button) => button.textContent?.includes("Add API access"),
)!;
flushSync(() => addButton.click());
// Type an alias.
const aliasInput = container.querySelector<HTMLInputElement>('input[aria-label="Access alias"]')!;
const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")!.set!;
setter.call(aliasInput, "STRIPE");
flushSync(() => aliasInput.dispatchEvent(new Event("input", { bubbles: true })));
// Bind a secret via the stubbed picker.
const pick = container.querySelector<HTMLButtonElement>('[data-testid="pick-secret"]')!;
expect(mockSecretPickerRender).toHaveBeenLastCalledWith(
expect.objectContaining({ secretId: "", secrets }),
);
flushSync(() => pick.click());
const last = emitted.at(-1)!;
expect(last).toEqual({ STRIPE: { type: "secret_ref", secretId: "s1", version: "latest" } });
});
it("keeps the create form open when focus returns to the shared picker anchor", async () => {
vi.useFakeTimers();
try {
render(
<AgentSecretAccessEditor
config={{ "access.STRIPE": { type: "secret_ref", secretId: "s1" } }}
secrets={secrets}
onChange={() => {}}
onCreateSecret={async () => secrets[0]!}
/>,
);
const createButton = container.querySelector<HTMLButtonElement>('[data-testid="create-secret"]')!;
flushSync(() => createButton.click());
flushSync(() => vi.runAllTimers());
expect(document.body.textContent).toContain("Create secret");
const pickerButton = container.querySelector<HTMLButtonElement>('[data-testid="pick-secret"]')!;
pickerButton.focus();
flushSync(() => {});
expect(document.body.textContent).toContain("Create secret");
expect(document.querySelector('input[aria-label="Secret name"]')).toBeTruthy();
} finally {
vi.useRealTimers();
}
});
it("renders pending binding proposals as Proposed rows with approve/reject", () => {
const approved: string[] = [];
const rejected: string[] = [];
const proposal = {
id: "prop-1",
companyId: "co",
kind: "binding" as const,
status: "pending" as const,
justification: "Bind Stripe for the billing agent.",
proposedName: null,
proposedKey: null,
proposedDescription: null,
valueFingerprintSha256: null,
valueLength: null,
secretId: "s1",
secretName: "STRIPE_KEY",
secretProposalId: null,
secretProposalName: null,
targetType: "agent" as const,
target: { id: "agent-1", name: "BillingBot", icon: null },
configPath: "access.STRIPE",
proposedBy: { id: "agent-2", name: "ClaudeCoder", icon: null },
originIssue: null,
originRunId: "run-1",
expiresAt: new Date(Date.now() + 86_400_000).toISOString(),
createdAt: new Date(0).toISOString(),
resolvedByUserId: null,
resolvedAt: null,
resolutionReason: null,
createdSecretId: null,
appliedBindingConfigPath: null,
viewerCanApprove: true,
approveBlockReason: null,
};
render(
<AgentSecretAccessEditor
config={{}}
secrets={secrets}
onChange={() => {}}
proposals={[proposal]}
onApproveProposal={(p) => approved.push(p.id)}
onRejectProposal={(p) => rejected.push(p.id)}
/>,
);
expect(container.textContent).toContain("Proposed access");
expect(container.textContent).toContain("STRIPE"); // alias + bound secret name
expect(container.textContent).toContain("ClaudeCoder"); // proposer
const approveButton = [...container.querySelectorAll("button")].find(
(button) => button.textContent?.trim() === "Approve",
)!;
flushSync(() => approveButton.click());
expect(approved).toEqual(["prop-1"]);
const rejectButton = [...container.querySelectorAll("button")].find(
(button) => button.textContent?.trim() === "Reject",
)!;
flushSync(() => rejectButton.click());
expect(rejected).toEqual(["prop-1"]);
});
it("explains that API-access secrets are not exposed as $NAME env vars and offers a quick bind-as-env-var action", () => {
const boundEnv: Array<{ envKey: string; secretId: string; version: number | "latest" }> = [];
render(
<AgentSecretAccessEditor
config={{
"access.STRIPE_KEY": { type: "secret_ref", secretId: "s1", version: "latest" },
}}
secrets={secrets}
onChange={() => {}}
onBindAsEnvVar={(binding) => boundEnv.push(binding)}
/>,
);
// Clarifies that processes/scripts will not see $NAME unless bound under Environment variables.
expect(container.textContent).toMatch(/\$NAME|\$STRIPE_KEY/);
expect(container.textContent?.toLowerCase()).toContain("environment variables");
const bindEnvButton = [...container.querySelectorAll<HTMLButtonElement>("button")].find((button) =>
button.textContent?.includes("Also bind as env var"),
);
expect(bindEnvButton, "Also bind as env var action should render for API-only binding").toBeTruthy();
flushSync(() => bindEnvButton!.click());
expect(boundEnv).toEqual([{ envKey: "STRIPE_KEY", secretId: "s1", version: "latest" }]);
});
it("asks before replacing an occupied env var name on Also bind as env var", () => {
const boundEnv: Array<{ envKey: string; secretId: string; version: number | "latest"; replaceExisting?: boolean }> = [];
render(
<AgentSecretAccessEditor
config={{
env: {
STRIPE_KEY: { type: "plain", value: "existing-plain" },
},
"access.STRIPE_KEY": { type: "secret_ref", secretId: "s1", version: "latest" },
}}
secrets={secrets}
onChange={() => {}}
onBindAsEnvVar={(binding) => boundEnv.push(binding)}
/>,
);
const bindEnvButton = [...container.querySelectorAll<HTMLButtonElement>("button")].find((button) =>
button.textContent?.includes("Also bind as env var"),
)!;
flushSync(() => bindEnvButton.click());
// Must not silently overwrite the occupied env var.
expect(boundEnv).toEqual([]);
expect(container.textContent).toContain("$STRIPE_KEY already exists");
// Option 1: pick the unused fallback name.
const fallbackButton = [...container.querySelectorAll<HTMLButtonElement>("button")].find((button) =>
button.textContent?.includes("Bind as STRIPE_KEY_2"),
)!;
flushSync(() => fallbackButton.click());
expect(boundEnv).toEqual([{ envKey: "STRIPE_KEY_2", secretId: "s1", version: "latest" }]);
// Option 2: explicitly confirm replacing the occupied name.
flushSync(() => bindEnvButton.click());
const replaceButton = [...container.querySelectorAll<HTMLButtonElement>("button")].find((button) =>
button.textContent?.includes("Replace STRIPE_KEY"),
)!;
flushSync(() => replaceButton.click());
expect(boundEnv.at(-1)).toEqual({
envKey: "STRIPE_KEY",
secretId: "s1",
version: "latest",
replaceExisting: true,
});
});
it("copies the chosen free alias's pinned version when multiple aliases reference the same secret", () => {
const boundEnv: Array<{ envKey: string; secretId: string; version: number | "latest" }> = [];
render(
<AgentSecretAccessEditor
config={{
env: {
OLD: { type: "plain", value: "occupied" },
},
"access.OLD": { type: "secret_ref", secretId: "s1", version: 1 },
"access.NEW": { type: "secret_ref", secretId: "s1", version: 3 },
}}
secrets={secrets}
onChange={() => {}}
onBindAsEnvVar={(binding) => boundEnv.push(binding)}
/>,
);
const bindEnvButton = [...container.querySelectorAll<HTMLButtonElement>("button")].find((button) =>
button.textContent?.includes("Also bind as env var"),
)!;
flushSync(() => bindEnvButton.click());
expect(boundEnv).toEqual([{ envKey: "NEW", secretId: "s1", version: 3 }]);
});
it("scales linearly when rendering and editing an alias across 200 secrets and bindings", () => {
const count = 200;
let secretIdReads = 0;
const maxReads = count * 20;
const largeSecrets = Array.from({ length: count }, (_, index) => {
const secret = makeSecret(`s-${index}`, `SECRET_${index}`);
let idValue = secret.id;
Object.defineProperty(secret, "id", {
enumerable: true,
get() {
secretIdReads += 1;
if (secretIdReads > maxReads) {
throw new Error(`Quadratic secret lookup detected (${secretIdReads} reads for ${count} secrets)`);
}
return idValue;
},
set(next: string) {
idValue = next;
},
});
return secret;
});
const largeConfig: Record<string, unknown> = {};
for (let index = 0; index < count; index += 1) {
largeConfig[`access.ALIAS_${index}`] = { type: "secret_ref", secretId: `s-${index}`, version: "latest" };
}
render(
<AgentSecretAccessEditor
config={largeConfig}
secrets={largeSecrets}
onChange={() => {}}
onBindAsEnvVar={() => {}}
/>,
);
const readsAfterMount = secretIdReads;
expect(readsAfterMount).toBeLessThanOrEqual(count * 4);
// Typing into one alias input must not rescan secrets per row/summary.
const aliasInput = container.querySelector<HTMLInputElement>('input[aria-label="Access alias"]')!;
const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")!.set!;
setter.call(aliasInput, "ALIAS_0_EDITED");
flushSync(() => aliasInput.dispatchEvent(new Event("input", { bubbles: true })));
expect(secretIdReads - readsAfterMount).toBeLessThanOrEqual(count * 2);
});
});