Clarification Request: Why are template layout no longer being cloned?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 314
- Forks
- 61
- Avg merge
- 4h 35m
- Merged PRs (30d)
- 12
Description
Hi,
I was trying to adapt the template loading and embedding logic for my Echo-based project when I noticed this part here:
https://github.com/gofiber/template/blob/2fde445c06e9f7695cc0f549ef73121640849788/html/html.go#L211
I expected to see lay.Clone() being called here, because the current solution attaches the embed func globally. This could be a potential security threat, if someone ends up rendering main.html by mistake.
Checking the history, I saw that there was a version that cloned the template, but it was replaced, because a cloned template cannot be executed multiple times. But if you are always only executing the copy, why would the original template get executed in the first place?
I would love to hear your thoughts.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with html/html.go around line 211, then review the referenced history showing the change from lay.Clone() and the discussion about repeated execution. Reproduce the template-loading path if possible and determine whether the original template can be rendered unintentionally. Done means the intended behavior and any required follow-up are clearly agreed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100