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

feat: BN014 detect duplicate policies #468

Merged
merged 3 commits into from
Sep 27, 2024
Merged

Conversation

DinoChiesa
Copy link
Collaborator

I don't know why, but previously the EP001 plugin, which is intended to check for CORS policy placement, also made a lame attempt to check for duplicate CORS policies. That always failed, because the check was naive: any policy that had a different name was considered to be different. Therefore it never detected a duplicate.

So that code needed to go. But it seems like it's possible that someone might have multiple differently named policies (CORS or otherwise), with identical configuration, in the same proxy bundle. And if that might occur, it would be good to check for that and issue a warning. So I implemented that check in a new plugin, BN014. It has "pretty good" XML policy comparison logic: two different policies will not be judged to be different if the only differences are in whitespace or indenting. They will be judged to be different if the element order is different.

Not sure how useful this will be. But rather than remove the duplicate policy check, I thought it would be better to keep it, as a new plugin.

This also increases code coverage for the EP001 plugin.

@DinoChiesa DinoChiesa merged commit e21e568 into apigee:main Sep 27, 2024
2 checks passed
@DinoChiesa DinoChiesa deleted the BN014-try2 branch September 27, 2024 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant