Skip to content

fix: handle slashes/quotes/metachars in template description (closes #17)#18

Merged
marksverdhei merged 1 commit into
mainfrom
fix/template-init-sed-delimiter
Jun 25, 2026
Merged

fix: handle slashes/quotes/metachars in template description (closes #17)#18
marksverdhei merged 1 commit into
mainfrom
fix/template-init-sed-delimiter

Conversation

@marksverdhei

Copy link
Copy Markdown
Owner

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

  • Replaced the 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).
  • Moved repo_desc into the step's env: 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

Input Result
"Library for X / Y" description = "Library for X / Y" (now works)
"Quoted \"name\"" description = "Quoted \"name\"" (now works)
empty / unset description line removed (unchanged)

…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.
@marksverdhei marksverdhei merged commit b425e35 into main Jun 25, 2026
2 checks passed
@marksverdhei marksverdhei deleted the fix/template-init-sed-delimiter branch June 25, 2026 19:54
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.

template-init: sed delimiter breaks if repo description contains '/'

1 participant