Add user-bot Lambda code, tests and deploy workflows - #211
Merged
Merged
Conversation
22 of 25 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #209 (PR 2 of 2: the Lambda code and its workflows; the infrastructure went in with #210)
What changes did you make?
lambda/user-bot/: TypeScript Lambda. On a successfulCreateLoginProfilefor a user taggedmanaged-by = terraform-devops-securitywith a validslack_id, it sets a 20-character temporary password (forced reset) and sends it through aMessageSender. Otherwise it changes nothing. The password is never logged.SlackMessageSender(chat.postMessage, checks Slack'sokfield rather than the HTTP status) andStubMessageSender(logs only). The deployed handler uses the stub until a Slack app and token existaws-sdk-client-mock, Slack by mockingfetch. 36 testsuser-bot-test.yml(PRs touchinglambda/user-bot/**, no AWS credentials) anduser-bot-deploy.yml(merge tomainor manual run; assumesdevops-security-user-bot-deployand updates only the function's code)terraform-plan.yaml,terraform-apply.yamland everything underterraform/are unchangedWhy did you make the changes (we will use this info to test)?
Test user-bot Lambdashould run on this PR and passDeploy user-bot Lambdashould run green, andaws lambda get-function --function-name user-bot --region us-east-1should show aCodeSha256different from the placeholder's (LLba/aL0rfujZfe2GX308Af+BuAl7oqRUuVOV4dV1mo=)