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

caddyfile: reject cyclic imports #4022

Merged
merged 9 commits into from
Apr 9, 2021
Merged

caddyfile: reject cyclic imports #4022

merged 9 commits into from
Apr 9, 2021

Conversation

mohammed90
Copy link
Member

Fix an edge case of Caddyfile import itself. I don't imagine anyone deliberately self-importing a Caddyfile but could happen if glob expansion wasn't vetted by the user.

@francislavoie francislavoie added the bug 🐞 Something isn't working label Feb 16, 2021
@francislavoie francislavoie added this to the v2.4.0 milestone Feb 16, 2021
@mohammed90 mohammed90 changed the title caddyfile: reject recursive self-imports caddyfile: reject cyclic imports Feb 16, 2021
@mohammed90 mohammed90 marked this pull request as draft February 16, 2021 15:49
@mohammed90
Copy link
Member Author

Converting it to draft as @francislavoie and I found more corner cases

@mohammed90 mohammed90 marked this pull request as ready for review April 3, 2021 15:39
@mohammed90
Copy link
Member Author

I opted for minimal implementation of the graph to avoid pulling an additional dep just for tracking cycles.

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Thanks for contributing this. Might save some people some head scratching.

I have just a couple requests, nothing major.

caddyconfig/caddyfile/lexer.go Outdated Show resolved Hide resolved
caddyconfig/caddyfile/parse.go Outdated Show resolved Hide resolved
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Cool, hopefully this will help a few people and prevent some problems! Thanks for contributing this @mohammed90 !

@mholt mholt merged commit 3903642 into master Apr 9, 2021
@mohammed90 mohammed90 deleted the recursive-import branch April 9, 2021 18:09
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