Skip to content

[2.5] Re-allow .install files containing '..' - #7009

Merged
kit-ty-kate merged 3 commits into
ocaml:2.5from
kit-ty-kate:2.5-revert-6897
Jul 8, 2026
Merged

[2.5] Re-allow .install files containing '..'#7009
kit-ty-kate merged 3 commits into
ocaml:2.5from
kit-ty-kate:2.5-revert-6897

Conversation

@kit-ty-kate

@kit-ty-kate kit-ty-kate commented Jul 7, 2026

Copy link
Copy Markdown
Member

Backport of #7008 on 2.5
Queued on #7013

@rjbou rjbou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is a missing test that checks escapability (for ex { "tmp/../../../../middle/dosiero" }. That's how a found #7010.
Besides this real_path behaviour, I understand the reason to reintroduce .. handling in 2.5.2, but i don't think we should backport it on master, at least for the moment. #6938 is open to propose an alternative solution, but we can discuss it later (but definitively before 2.6 release)

Comment thread tests/reftests/dot-install.test Outdated
Comment thread tests/reftests/dot-install.test Outdated
Comment thread tests/reftests/dot-install.test Outdated
@kit-ty-kate kit-ty-kate added the PR: QUEUED Pending pull request, waiting for other work to be merged or closed label Jul 8, 2026
@kit-ty-kate
kit-ty-kate requested a review from rjbou July 8, 2026 12:57
share: [
"a-file" { "../../a-file" }
]
misc: [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't know if it worth testing misc for this test, it needs to be an absolute path and we are testing relative paths

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

since one wrong thing in a field invalidates the whole field i think it's worth checking since this pattern isn't checked

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fair enough. It will be in #6956

Comment thread tests/reftests/dot-install.test
Comment thread tests/reftests/dot-install.test Outdated
Comment thread tests/reftests/dot-install.test
Comment thread master_changes.md
## Doc

## Security fixes
* Invalidate .install fields containing absolute destination filepath except when in the `misc` field [#6897 #7008 @kit-ty-kate]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Invalidate .install fields containing absolute destination filepath except when in the `misc` field [#6897 #7008 @kit-ty-kate]
* Re-allow `..` in `.install` files, partially reverts 2.5.1 #6879 [#7009 @kit-ty-kate]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it doesn't really matter, it's master_changes which is just for us anyway and we're doing a release right after this.

@rjbou rjbou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm with green CI
On the 2nd commit message, I think it is better to avoid having links, especially non permanent ones on commit messages. If the message is deleted, or the zulip is no longer online, it is not possible to find out the origin that you wanted to highlight.

…tination filepath trying to escape their scope
Partially reverts ae877c0

This check is no longer necessary since d7f7d8e
and broke opam repositories providing cross-compiled packages
…sary intermediate directories for paths that contain '..'
@kit-ty-kate

kit-ty-kate commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

Ignoring the unfinished Solvers-macOS jobs whose result would be unrelated to this PR anyway, and the failing cygwin build (#7007)

@kit-ty-kate
kit-ty-kate merged commit f8fb1e2 into ocaml:2.5 Jul 8, 2026
44 of 45 checks passed
@kit-ty-kate
kit-ty-kate deleted the 2.5-revert-6897 branch July 8, 2026 17:11
@WardBrian

Copy link
Copy Markdown
Contributor

I understand the reason to reintroduce .. handling in 2.5.2, but i don't think we should backport it on master, at least for the moment. #6938 is open to propose an alternative solution, but we can discuss it later (but definitively before 2.6 release)

Not sure if this is the place to discuss it, but the easiest path forward is to include this behavior and the new root/rootexec in a release, since dune wants the new fields released before targetting them. The release following that could restrict .. again if desired.

@rjbou

rjbou commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

this behavior and the new root/rootexec in a release

That's what i'm prone to, with some logging in case of '..'. I think we'll discuss it on monday dev meeting to settle it.

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.

3 participants