Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(team-setup): check redaction on the joined instructions for an added rule
AdityaUmale25a5251354ee
diff --git a/server/team-setup-requests.test.ts b/server/team-setup-requests.test.tsindex 474aa50b45..2a1bae6abb 100644--- a/server/team-setup-requests.test.ts+++ b/server/team-setup-requests.test.ts@@ -378,6 +378,9 @@ describe("reviewed Chief team setup", () => {expect(() => h.propose([{ action: "update", botId: outsider.id, fields: { soulAppend: "More." } }])).toThrow(/Private/);h.peer.soul = `Use key sk-${"a".repeat(24)} for the API.`;expect(() => h.propose([{ action: "update", botId: h.peer.id, fields: { soulAppend: "More." } }])).toThrow(/credential-like text/);+ // Clean on its own, but the added rule completes a pattern that reaches back into the existing text.+ h.peer.soul = "Paste keys after -----BEGIN RSA PRIVATE KEY----- and keep them out of chat.";+ expect(() => h.propose([{ action: "update", botId: h.peer.id, fields: { soulAppend: "Stop at -----END RSA PRIVATE KEY-----." } }])).toThrow(/credential-like text/);});});diff --git a/server/team-setup-requests.ts b/server/team-setup-requests.tsindex 87e7dcff93..7ff9369071 100644--- a/server/team-setup-requests.ts+++ b/server/team-setup-requests.ts@@ -221,9 +221,11 @@ export class TeamSetupRequestService {// A bot this Chief may not change is never read here; validate() refuses it.if (target && !target.hidden && this.options.hasTeamAuthority(chief, target.section)) {// Re-saving runs the whole text through redaction; never let an added rule rewrite what the bot already had.- const current = target.soul ?? "";- if (redactSecretsInText(current) !== current) throw new TeamSetupError(`@${target.name}'s instructions hold credential-like text; change them with a full soul instead`);- requested.soul = current.trim() ? `${current.trimEnd()}\n\n${soulAppend}` : soulAppend;+ // Check the joined text: an added rule can complete a pattern that starts in the existing instructions.+ const kept = (target.soul ?? "").trimEnd();+ const joined = kept ? `${kept}\n\n${soulAppend}` : soulAppend;+ if (!redactSecretsInText(joined).startsWith(kept)) throw new TeamSetupError(`@${target.name}'s instructions hold credential-like text; change them with a full soul instead`);+ requested.soul = joined;}}const fields = this.fields({ ...requested, section: requested.section ?? target?.section ?? chief.section ?? "" }, target ?? undefined);