Skip to content

fix: require module path boundaries when matching packages - #7957

Merged
steadytao merged 1 commit into
caddyserver:masterfrom
wangjingshuiku:wangjingshuiku-maint-20260824
Sep 13, 2026
Merged

steadytao merged 1 commit into
caddyserver:masterfrom
wangjingshuiku:wangjingshuiku-maint-20260824

Conversation

@wangjingshuiku

@wangjingshuiku wangjingshuiku commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Assistance Disclosure

AI-assisted by OpenAI Codex and Kiro(Review again); I reviewed and tested the change.

Summary

getModules currently uses a raw string-prefix check when associating a package with a module. As a result, a module such as example.com/mod can be selected for the unrelated package example.com/module.

This change requires either an exact module-path match or a slash boundary, while retaining longest-match selection for nested modules. The table-driven test covers a module root, a child package, and an unrelated shared prefix.

Testing

  • go test ./cmd -run TestModuleContainsPackage -count=1

@CLAassistant

CLAassistant commented Aug 24, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@wangjingshuiku
wangjingshuiku force-pushed the wangjingshuiku-maint-20260824 branch from 3dac9c2 to 31be607 Compare August 24, 2026 17:17
@steadytao

Copy link
Copy Markdown
Member

Could you remove the unrelated DualStack removal and TLS loader formatting changes?

@wangjingshuiku
wangjingshuiku force-pushed the wangjingshuiku-maint-20260824 branch from 31be607 to 8c182d9 Compare September 12, 2026 08:26
@wangjingshuiku

Copy link
Copy Markdown
Contributor Author

Could you remove the unrelated DualStack removal and TLS loader formatting changes?

@steadytao Removed. Please review it again. Thanks!

Comment thread cmd/packagesfuncs.go Resolved
Signed-off-by: wangjingshuiku <wangjingshuiku@163.com>
@wangjingshuiku
wangjingshuiku force-pushed the wangjingshuiku-maint-20260824 branch from 8c182d9 to 3bd0e26 Compare September 12, 2026 16:20

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@steadytao steadytao added the bug 🐞 Something isn't working label Sep 13, 2026
@steadytao steadytao added this to the v2.11.5 milestone Sep 13, 2026
@steadytao
steadytao merged commit a75817f into caddyserver:master Sep 13, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐞 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants