Skip to content

Commit 2ff85da

Browse files
committed
fix(cli): keep the stack-plugins loop anchor unique and refuse combinators in the secret-rows double
`refuseTwoCryptoProviderPlugins` iterated with the same text as the stack `plugins` loop that the #9863 audit-registration scan anchors on, so the scan could no longer name one place. Its loop now reads `candidate of composed`. The new test's in-memory `sys_secret` double matched by scalar equality and read a `$`-key as a field name; it now refuses a combinator or operator, as check:where-matcher requires. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czs7cUFAphQEUFSrcz
1 parent b308ea8 commit 2ff85da

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎packages/cli/src/commands/serve-host-crypto-provider.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,11 @@ function secretRows() {
229229
async insert(_object: string, data: Row) { rows.set(String(data.id), data); return data; },
230230
async find(_object: string, query: { where?: Row; limit?: number }) {
231231
const hits = [...rows.values()].filter((row) =>
232-
Object.entries(query.where ?? {}).every(([k, v]) => row[k] === v));
232+
Object.entries(query.where ?? {}).every(([k, v]) => {
233+
// Scalar equality only: a combinator or operator is refused, never read as a field name.
234+
if (k.startsWith('$')) throw new Error(`secretRows double: no '${k}' support`);
235+
return row[k] === v;
236+
}));
233237
return typeof query.limit === 'number' ? hits.slice(0, query.limit) : hits;
234238
},
235239
};

‎packages/cli/src/commands/serve.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6365,11 +6365,11 @@ export function createHostCryptoProvider(local: () => ICryptoProvider): {
63656365
* every declaring plugin before any of them initializes. A plugin registered
63666366
* twice under one `name` boots once (the later one), and is counted once.
63676367
*/
6368-
export function refuseTwoCryptoProviderPlugins(plugins: Iterable<unknown>): void {
6368+
export function refuseTwoCryptoProviderPlugins(composed: Iterable<unknown>): void {
63696369
const byName = new Map<string, unknown>();
6370-
for (const plugin of plugins) {
6371-
const name = (plugin as { name?: unknown } | null)?.name;
6372-
if (typeof name === 'string') byName.set(name, plugin);
6370+
for (const candidate of composed) {
6371+
const name = (candidate as { name?: unknown } | null)?.name;
6372+
if (typeof name === 'string') byName.set(name, candidate);
63736373
}
63746374
const declaring = [...byName]
63756375
.filter(([, plugin]) => {

0 commit comments

Comments
 (0)