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

fix: protect read file from path traversal #4943

Merged
merged 7 commits into from
Sep 22, 2024

Conversation

ndom91
Copy link
Contributor

@ndom91 ndom91 commented Sep 18, 2024

☕️ Reasoning

  • Ensure that the new get_pr_template_contents fn can't read anything outside of the project's root directory

🧢 Changes

Copy link

vercel bot commented Sep 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitbutler-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 22, 2024 5:07pm

@ndom91
Copy link
Contributor Author

ndom91 commented Sep 18, 2024

@mtsgrd some small rust question:

  • There's probably no need for .context() on each method that potentially fails, right?
  • Is it okay to add the entire git2 crate to gitbutler-fs's Cargo.toml? Can I add something like feature = { Repository } to only add what I need here?

@Byron
Copy link
Collaborator

Byron commented Sep 18, 2024

  • Is it okay to add the entire git2 crate to gitbutler-fs's Cargo.toml? Can I add something like feature = { Repository } to only add what I need here?

Features are predefined in the crate and they usually only provide features if it grates off other dependencies, not just code. When I see the example above, it reminds me of typescript imports :).

@ndom91 ndom91 force-pushed the fix-protect-read-file-from-path-traversal branch from 6f8eb44 to a9fabb2 Compare September 22, 2024 17:07
@ndom91 ndom91 enabled auto-merge (squash) September 22, 2024 17:09
@ndom91 ndom91 merged commit 992496f into master Sep 22, 2024
18 checks passed
@ndom91 ndom91 deleted the fix-protect-read-file-from-path-traversal branch September 22, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants