fix: handle slashes/quotes/metachars in template description (closes #17)#18
Merged
Merged
Conversation
…metachars (#17) The sed-based substitution broke when repo descriptions contained '/' (very common). Switched to Python with .replace() — handles arbitrary strings. Also moves $REPO_DESC into 'env:' so the workflow doesn't string-interpolate $\{\{ github.event.repository.description \}\} directly into the shell command, closing a self-injection vector if a user's own description contained shell metacharacters. Closes #17.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #17 — the sed-based description substitution broke on common descriptions like "Library for X / Y" because forward slash conflicted with the sed delimiter.
Changes
sed -i "s/Add your description here/${repo_desc}/"step with a small Python heredoc using.replace()— handles arbitrary strings safely (slashes, quotes, shell metachars).repo_descinto the step'senv:block so it's no longer interpolated directly into the shell command line — closes the self-injection vector noted in template-init: sed delimiter breaks if repo description contains '/' #17.Behavior
"Library for X / Y"description = "Library for X / Y"(now works)"Quoted \"name\""description = "Quoted \"name\""(now works)descriptionline removed (unchanged)