-
Notifications
You must be signed in to change notification settings - Fork 1
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
BCDA-8360 add waf sync lambda #197
base: main
Are you sure you want to change the base?
Conversation
0981f4e
to
6f5068b
Compare
lambda/wafsync/db.go
Outdated
|
||
err = rows.Scan(&ip) | ||
if err != nil { | ||
log.Warningf("Scan error: %+v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about bumping this to a fatal or error level? if scan fails on reading any of the IP set that should be updated, then that would mean that the IP allow list could be out of sync between database <> waf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about bumping this to a fatal or error level? if scan fails on reading any of the IP set that should be updated, then that would mean that the IP allow list could be out of sync between database <> waf.
I think error makes more sense as we already return nil, err on issue here. Also I think returning fatal is not recommended in lambdas.
id: invoke-lambda | ||
run: | | ||
echo "STARTTIME=`date +%s`" >> "$GITHUB_OUTPUT" | ||
aws lambda invoke --function-name bcda-dev-api-waf-sync test-result.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- if an error is returned; do we need to do any verification here or do we expect a non-zero exit code?
- do we want to add any additional validation for other cases where it runs successfully, but the end result might be different from what we expect; ie the update doesn't return an error, but there are no IPs in the WAF?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I believe returning nonzero is enough but Im not entirely sure how to force the function to error out in order to test. I copied a lot of this code from the DPC version, maybe its worth pinging them?
- I feel like that would best be solved via splunk or cloudwatch alerts? They could watch for a variety of things based off the logs? I can create a ticket to look into this, either creating new alerts or modifying the jenkins alerts.
🎫 Ticket
https://jira.cms.gov/browse/BCDA-8360
🛠 Changes
Add WAF auto sync lambda
ℹ️ Context
We have recently switched over to WAF to control our allowlist of IP addresses. This lambda should sync our app DB with the source of truth on IP addresses to our WAF.
🧪 Validation
Local tests and linting passing.