Skip to content

Fix CRLY.01176: Constrain IAM Write Access #43

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 4 additions & 54 deletions pipeline/cfn-deploypipeline-s3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ Resources:
- 'lambda:ListFunctions'
- 'lambda:InvokeAsyc'
Effect: Allow
Resource: '*'
Resource:
- arn:aws:s3:::my-bucket
- arn:aws:lambda:*:*:function:my-function
Pipeline:
Type: AWS::CodePipeline::Pipeline
Properties:
Expand Down Expand Up @@ -263,56 +265,4 @@ Resources:
Owner: AWS
Provider: Lambda
Version: 1
Configuration:
FunctionName: !Ref LambdaSlackNotify
IamRoleLambdaSlackNotify:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
-
Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Path: "/"
IamPolicyLambdaSlackNotify1:
Type: AWS::IAM::Policy
Properties:
PolicyName: CodePipelineAccess
PolicyDocument:
Version: '2012-10-17'
Statement:
-
Effect: Allow
Action:
- codepipeline:Get*
- codepipeline:PutJob*
Resource: "*"
Roles:
- Ref: IamRoleLambdaSlackNotify
LambdaSlackNotify:
Type: AWS::Serverless::Function
Properties:
Description: Sends CodePipeline events to Slack
Runtime: python2.7
CodeUri: ./functions/slack-notify
Handler: handler.handler
MemorySize: 128
Timeout: 30
Role: !GetAtt IamRoleLambdaSlackNotify.Arn
Environment:
Variables:
SLACK_CHANNEL_NAME:
!Ref SlackChannelName
SLACK_WEBHOOK_URL:
!Ref SlackWebhookUrl
SERVICE_NAME:
!Ref ServiceName
STAGE:
!Ref Stage