Skip to content

Conversation

@raulfdm
Copy link
Owner

@raulfdm raulfdm commented Aug 28, 2025

Closes #162

This pull request improves the handling of slot values in the @layerfig/config package, 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:

  • Added a new utility function escapeBreakLine to 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)
  • Updated slot replacement logic in Source to use escapeBreakLine when inserting slot values, and refactored parsing to use JSON.parse directly for consistency. (packages/config/src/sources/source.ts, [1] [2] [3]

Testing improvements:

Documentation and changelog:

@changeset-bot
Copy link

changeset-bot bot commented Aug 28, 2025

🦋 Changeset detected

Latest commit: 57a88c3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@layerfig/config Patch

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
Copy link

gitguardian bot commented Aug 28, 2025

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
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
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. 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


🦉 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.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 28, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@raulfdm raulfdm merged commit f715693 into main Aug 28, 2025
4 checks passed
@raulfdm raulfdm deleted the issue-162-attempt-to-fix-yaml-2 branch August 28, 2025 05:15
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.

[YAML] Environment Variable value with multiline throws an error

2 participants