Skip to content

Commit a12eba0

Browse files
betegonclaude
andcommitted
test(init): fix maskToken property — exclude all-asterisk tokens from never-equals check
maskToken("*") must return "*" (the "short tokens are fully masked" property requires all-asterisk output), which means the "output never equals original input" property is unsatisfiable for inputs that are already entirely asterisks. These two constraints are in fundamental conflict for that edge case. Fix: add a .filter() pre-condition to exclude all-asterisk tokens from the never-equals property. Real auth tokens never consist entirely of asterisks, so this doesn't weaken the practical guarantee. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent c7bbd48 commit a12eba0

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

test/lib/sentryclirc-import.property.test.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,18 @@ describe("property: maskToken", () => {
132132
});
133133

134134
test("output never equals the original input", () => {
135+
// Tokens that are entirely asterisks are already fully masked, so
136+
// maskToken cannot meaningfully change them — exclude that edge case.
135137
fcAssert(
136-
property(string({ minLength: 1, maxLength: 100 }), (token) => {
137-
const masked = maskToken(token);
138-
expect(masked).not.toBe(token);
139-
}),
138+
property(
139+
string({ minLength: 1, maxLength: 100 }).filter(
140+
(t) => !/^\*+$/.test(t)
141+
),
142+
(token) => {
143+
const masked = maskToken(token);
144+
expect(masked).not.toBe(token);
145+
}
146+
),
140147
{ numRuns: DEFAULT_NUM_RUNS }
141148
);
142149
});

0 commit comments

Comments
 (0)