Skip to content

docker: marker-based base.conf generation + robust sed escaping - #95

Draft
MrLenin wants to merge 1 commit into
evilnet:masterfrom
MrLenin:docker-entrypoint-hardening
Draft

docker: marker-based base.conf generation + robust sed escaping#95
MrLenin wants to merge 1 commit into
evilnet:masterfrom
MrLenin:docker-entrypoint-hardening

Conversation

@MrLenin

@MrLenin MrLenin commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Companion to evilnet/x3#58's entrypoint hardening — same two fixes for the ircd's Docker entrypoint:

  • Marker-based generation policy. The entrypoint unconditionally cp'd the template over base.conf on every start, clobbering a volume-mounted hand-edited config. Now every generated conf carries a first-line marker comment: no conf → generate; marker present → regenerate (env + template stay the source of truth); marker absent → user-managed, never touched. Generation goes through a temp file so a mid-generation crash can't leave a half-substituted, marker-less conf that would then be mistaken for user-managed.
  • Substitution escaping. The sed uses | as its delimiter but only escaped / and & — a value containing | or a backslash silently corrupted the generated config. Backslash is escaped first, then & and the delimiter.

🤖 Generated with Claude Code

Two entrypoint fixes:

- Generation policy keyed on a marker comment stamped as the first line of
  every base.conf this script generates: absent -> generate; marker present
  -> regenerate (env + template are the source of truth); marker absent ->
  user-managed, never touched. Previously an unconditional cp clobbered a
  volume-mounted hand-edited base.conf on every container start.
  Generation goes through a temp file so a mid-generation crash can't
  leave a half-substituted marker-less conf behind.

- The substitution sed uses '|' as its delimiter but only escaped '/' and
  '&' in values: a value containing '|' or a backslash corrupted the conf
  silently. Escape backslash first, then '&' and the delimiter.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@MrLenin MrLenin self-assigned this Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant