Disallow parent traversal in Defaults List config group paths#3246
Conversation
aaa30b6 to
0db3690
Compare
|
|
||
| legacy_hydra_override = False | ||
| if isinstance(d, GroupDefault): | ||
| assert d.group is not None |
There was a problem hiding this comment.
I haven't put the check directly here, because I thought doing it downstream would be better for future readability, since all other checks would be near as well
|
Thanks for working on this. I want this to reject One reason I originally decided not to support relative parent traversal here is command-line override clarity. Defaults List config group paths have a stable identity: they are relative to the containing config, or absolute when prefixed with So the intended rule is simpler:
I think the current PR catches config-file entries but misses external appends, because |
|
Thank you for the explanation. I agree that stable, predictable group paths make override semantics clearer. I've simplified the validation to a single rule (reject any .. segment regardless of context) and added a test covering the CLI append path. |
|
Thanks, this is moving in the right direction. I think there is still one important gap: the validation currently checks only the config group path ( For example, these are still accepted by the parser and flow into Defaults List processing: +missing_group=../file1
+missing_group=[file1,../file1]
group1=../file1The same gap exists in config files: defaults:
- group1: ../file1and: defaults:
- group1:
- file1
- ../file1The intended rule is that Suggested additional tests:
The distinction matters for the CLI tests:
|
|
Thanks for working on this and for addressing the earlier feedback. I have taken over the PR, completed the remaining validation and test coverage, and rebased it onto current main. Your original commits and authorship are preserved. Thanks again for getting this started. |
Motivation
It has been 2 years since original issue #2878 related to this PR have been opened by me, a lot has changed in my life since then, and now it is time to put this issue and following issues #3202 to the conclusion.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Tests have been added to cover and reproduce these new error messages appearing.