Skip to content

fix(mcp): skip empty secret values in redactText#39923

Open
derodero24 wants to merge 1 commit intomicrosoft:mainfrom
derodero24:fix-1474
Open

fix(mcp): skip empty secret values in redactText#39923
derodero24 wants to merge 1 commit intomicrosoft:mainfrom
derodero24:fix-1474

Conversation

@derodero24
Copy link
Copy Markdown

Summary

Fixes microsoft/playwright-mcp#1474

Empty-string secret values parsed from .env files (e.g. KEY=#{VAR}# where dotenv strips comments) cause String.replaceAll("", ...) to insert the replacement tag between every character. This grows the string exponentially across multiple empty secrets, crashing V8 with a RangeError.

  • Skip empty secretValue in _redactSecrets() before calling replaceAll
  • Filter out empty values in dotenvFileLoader() at parse time

Fixes microsoft/playwright-mcp#1474

When a secrets .env file contains empty-string values (e.g. from
dotenv parsing comments like `KEY=#{VAR}#`), `replaceAll("", ...)`
inserts the replacement between every character, causing exponential
string growth and a V8 RangeError.

Guard against empty values in both `_redactSecrets` and
`dotenvFileLoader` to prevent the crash.

Fixes microsoft/playwright-mcp#1474
@derodero24
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] RangeError: Invalid string length on Blazor WASM pages - snapshot serialization crashes

1 participant