fix(package): reject trailing reference segments - #1792
Conversation
Require complete package references to match the entire input so extra path segments are not silently discarded. Add a regression case for a valid reference followed by an unexpected segment. Signed-off-by: 做着百万梦的鱼 <yangzihao_41@outlook.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: unbridled-41 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @unbridled-41! It looks like this is your first PR to OpenAtom-Linyaps/linyaps 🎉 |
|
Hi @unbridled-41. Thanks for your PR. I'm waiting for a OpenAtom-Linyaps member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Summary
Reject complete package reference strings that contain unexpected trailing path segments.
Previously,
Reference::parse()accepted a valid reference prefix even when additional segments remained in the input. The extra input was silently discarded when the parsed reference was converted back to a string.Root cause
The regular expression used by
Reference::parse()was not anchored at the start and end of the input. As a result,QRegularExpression::match()could succeed without requiring the entire input to match the expected reference format.For example:
was accepted as:
Changes
^and$.Reproduction
Reference::parse()withmain:com.example.App/1.0.0.0/x86_64/extra./extra.Test plan
Run the focused reference test:
/workspace/build-release/libs/linglong/tests/ll-tests/ll-tests --gtest_filter='Package.Reference'Verify the regression input is rejected.
Verify existing valid reference inputs continue to pass.
Run
git diff --check.Compatibility
This only changes the handling of malformed complete references containing unexpected trailing input. Valid references are unaffected.