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

Support config-based values for version #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cwardcode
Copy link

@cwardcode cwardcode commented Jul 19, 2022

Hi @mikesouza, this plugin is great! I recently ran into a slight issue though and would like to attempt to address it with this PR if you are open to contributions.

Currently, if you try to pass in the version from a configuration file, the plugin will output the following regardless if V2 or Regional is passed in.

Serverless: 
-------- Invalid WAF Version Configuration --------
Version Defaulted to WAFRegional

This is because currently the validation is being handled in the constructor before the plugin is bound to the serverless configuration, so when ${this.config.version} is getting checked, it results in the string literal that's passed in from the serverless template - in my case: ${{self:custom.WafVersion}}.

Moving the verify steps and initializing this.wafVersion within a bound function will interpolate the provided value properly. To do this and maintain the current behavior, I've moved the verifyValidWafConfig function to be called as part of the before:package:cleanup lifecycle hook.

When installing packages, I saw there were a few vulnerabilities reported, so I ran npm audit fix to resolve what was found. The current version of serverless this package depends on is a couple majors behind, so I was wary of upgrading it from even 1.x to 2.x, in the event that it may introduce breaking changes to any consumers.

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