Add escapeBreakLine utility and tests for special character handling#165
Add escapeBreakLine utility and tests for special character handling#165
Conversation
🦋 Changeset detectedLatest commit: 57a88c3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 20477359 | Triggered | Elliptic Curve Private Key | e428c00 | packages/config/src/utils/escape-break-line.test.ts | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
layerfig | 57a88c3 | Commit Preview URL Branch Preview URL |
Aug 28 2025, 05:15 AM |
This pull request improves the handling of slot values in the
@layerfig/configpackage, especially for multiline and special-character-containing strings. The main change is the introduction of a utility to safely escape line breaks and special characters before slot value insertion, preventing misparsing and rendering issues. Additionally, tests have been added to ensure correct escaping, and the slot replacement logic in sources has been updated accordingly.Escaping and slot value handling:
escapeBreakLineto escape backslashes, double quotes, newlines, carriage returns, and tabs in slot values before insertion, preventing parsing and rendering errors. (packages/config/src/utils/escape-break-line.ts, packages/config/src/utils/escape-break-line.tsR1-R12)Sourceto useescapeBreakLinewhen inserting slot values, and refactored parsing to useJSON.parsedirectly for consistency. (packages/config/src/sources/source.ts, [1] [2] [3]Testing improvements:
escapeBreakLine, covering all relevant escape scenarios including multiline PEM keys and combinations of special characters. (packages/config/src/utils/escape-break-line.test.ts, packages/config/src/utils/escape-break-line.test.tsR1-R74)packages/config/src/config-builder.test.ts, packages/config/src/config-builder.test.tsR202-R226)Documentation and changelog:
.changeset/tasty-baboons-run.md, .changeset/tasty-baboons-run.mdR1-R7)