Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

funcs: Don't panic if templatefile path is sensitive #35180

Merged
merged 1 commit into from
May 20, 2024

Conversation

apparentlymart
Copy link
Member

Previously we were partially propagating any marks from the path, but not going all the way so we still ran into trouble when trying to use the string containing the file contents.

Now we'll have loadTmpl also return the marks it had to read through to actually parse the template, and then we'll use those (instead of the original path marks) to mark the result. In practice the pathMarks and the tmplMarks should always match today, but this is intentionally structured to make the data flow clearer -- the marks always travel along with whatever they related to -- so we're less likely to break this accidentally under future maintenance.

This fixes #31119.

Previously we were partially propagating any marks from the path, but not
going all the way so we still ran into trouble when trying to use the
string containing the file contents.

Now we'll have loadTmpl also return the marks it had to read through to
actually parse the template, and then we'll use those (instead of the
original path marks) to mark the result. In practice the pathMarks and
the tmplMarks should always match today, but this is intentionally
structured to make the data flow clearer -- the marks always travel along
with whatever they related to -- so we're less likely to break this
accidentally under future maintenence.
@kmoe
Copy link
Member

kmoe commented May 20, 2024

@apparentlymart do we want to backport this into v1.8?

@apparentlymart
Copy link
Member Author

This situation seems rare enough that backporting would not be very impactful vs. just waiting for v1.9, but I'm happy to do if you disagree and think it's worth it!

@apparentlymart apparentlymart merged commit 9dd28fc into main May 20, 2024
10 checks passed
@apparentlymart apparentlymart deleted the b-templatefile-sensitive-path-crash branch May 20, 2024 15:34
Copy link

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

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.1.9: templatefile + sensitive value: go panic: value is marked, so must be unmarked first
2 participants