Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: prevent path expansion using host context #158

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

Merged
merged 1 commit into from
Jun 27, 2025

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jun 27, 2025

Any references to ~ should return an error

Any references to `~` should return an error
return cty.StringVal(path), nil
}

if path[0] != '~' {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if path[0] != '~' {
if strings.HasPrefix(path, "~") {

nit but I think this is easier to read, says what it's doing a little more loudly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this code directly from the homedir package. Just going leave it.

I made an issue to follow up: #159

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you leave a comment with a permalink to the original source to make that clearer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad
#161

@Emyrk Emyrk merged commit ae79d6d into main Jun 27, 2025
3 checks passed
@Emyrk Emyrk deleted the stevenmasley/stop_path_expand branch June 27, 2025 17:37
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.

2 participants