SlideShare a Scribd company logo
1 of 33
CONFIDENTIAL
クラウドを使って
開発する時に注意したことがいいあれこれ
2021/11/18
アイレット株式会社
カスタマー支援事業部 小石倉
CONFIDENTIAL
自己紹介
2
2
• 名前 : 小石倉 広樹
• 入社 : 2019年新卒入社
• 仕事 : 開発エンジニア
• 趣味 : スノーボード
• 大好物 : ビール
• 好きなサービス: API Gateway, Lambda
CONFIDENTIAL
アジェンダ
3
3
• クレデンシャル情報をパブリックリポジトリに載せちゃう
• lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
• CodeCommitで差分がでない
• developブランチをマージする時に間違えて消しちゃう
CONFIDENTIAL
アジェンダ
4
4
• クレデンシャル情報をパブリックリポジトリに載せちゃう
• lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
• CodeCommitで差分がでない
• developブランチをマージする時に間違えて消しちゃう
CONFIDENTIAL
クレデンシャル情報をパブリックリポジトリに載せちゃう
5
5
CONFIDENTIAL
クレデンシャル情報をパブリックリポジトリに載せちゃう
6
6
CONFIDENTIAL
クレデンシャル情報をパブリックリポジトリに載せちゃう
7
7
S3
ファイル情報欲しい
CONFIDENTIAL
クレデンシャル情報をパブリックリポジトリに載せちゃう
8
8
S3
ファイル情報欲しい
どなたです??
CONFIDENTIAL
クレデンシャル情報をパブリックリポジトリに載せちゃう
9
9
S3
ファイル情報欲しい
CONFIDENTIAL
クレデンシャル情報をパブリックリポジトリに載せちゃう
10
10
S3
ファイル情報欲しい
情報これです〜
CONFIDENTIAL
クレデンシャル情報をパブリックリポジトリに載せちゃう
11
11
S3
ファイル情報欲しい
情報これです〜
CONFIDENTIAL
クレデンシャル情報をパブリックリポジトリに載せちゃう
12
12
• 一般公開されたリポジトリに公開しちゃう
• 技術ブログに載せちゃう
• Etc…
どうやって漏れちゃうの?
CONFIDENTIAL
クレデンシャル情報をパブリックリポジトリに載せちゃう
13
13
• Git Secrets を導入する
• クレデンシャルの権限を絞る
• クレデンシャル情報を載せるファイルを
Git管理対象のファイルにしない
対処法
CONFIDENTIAL
アジェンダ
14
14
• クレデンシャル情報をパブリックリポジトリに載せちゃう
• lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
• CodeCommitで差分がでない
• developブランチをマージする時に間違えて消しちゃう
CONFIDENTIAL
lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
15
15
CONFIDENTIAL
lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
16
16
じゃあ最新バージョンはなんだろ
https://pypi.org/project/boto3/
引用
CONFIDENTIAL
lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
17
17
• Lambda Layers を使う
対処法
CONFIDENTIAL
lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
18
18
$ pip3 install -t ./python boto3
CONFIDENTIAL
lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
19
19
$ pip3 install -t ./python boto3
$ zip -r boto3-1.20.7.zip python
CONFIDENTIAL
lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
20
20
CONFIDENTIAL
lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
21
21
CONFIDENTIAL
lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
22
22
CONFIDENTIAL
アジェンダ
23
23
• クレデンシャル情報をパブリックリポジトリに載せちゃう
• lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
• CodeCommitで差分がでない
• developブランチをマージする時に間違えて消しちゃう
CONFIDENTIAL
CodeCommitで差分がでない
24
24
CodeCommitで
”違いを表示できません。個別のファイルが大きすぎて表示できないか、ファ
イル間の全体的な違いが複雑すぎます。”
と言う警告と共に差分が表示されないことがある。
👉 本当にすごく行数の多いファイルや、
バイナリファイルでもないのにこれになることがある。
CONFIDENTIAL
CodeCommitで差分がでない
25
25
CodeCommitで
”違いを表示できません。個別のファイルが大きすぎて表示できないか、ファ
イル間の全体的な違いが複雑すぎます。”
と言う警告と共に差分が表示されないことがある。
👉 本当にすごく行数の多いファイルや、
バイナリファイルでもないのにこれになることがある。
👉 もしかしたら全角大文字がファイルの中に入ってるかも。
消したら直りました
CONFIDENTIAL
アジェンダ
26
26
• クレデンシャル情報をパブリックリポジトリに載せちゃう
• lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う
• CodeCommitで差分がでない
• developブランチをマージする時に間違えて消しちゃう
CONFIDENTIAL
developブランチをマージする時に間違えて消しちゃう
27
27
想像してください。
あなたはとても優秀な開発エンジニアです。
とても長い期間を経てある機能を開発し、
プルリクに来る辛辣な指摘コメントにも耐え、developブランチへのマージを
もぎ取りました。動作確認もし、いよいよリリースの時です。
リリースと言っても、優秀なCICDが備わっているので
やることはmainブランチに対して
プルリクを介してマージするだけです。
CONFIDENTIAL
developブランチをマージする時に間違えて消しちゃう
28
28
CONFIDENTIAL
developブランチをマージする時に間違えて消しちゃう
29
29
あれ?Developブランチなくね?
CONFIDENTIAL
developブランチをマージする時に間違えて消しちゃう
30
30
あれ?Developブランチなくね?
😱
CONFIDENTIAL
developブランチをマージする時に間違えて消しちゃう
31
31
CONFIDENTIAL
developブランチをマージする時に間違えて消しちゃう
32
32
• IAMの設定で、developブランチを削除できないようにする
対処法
CONFIDENTIAL
33
33
参考にさせていただいた記事
https://qiita.com/RZQiita/items/b8dd2612ef04e395473d
AWS CodeCommit の使いにくい点
https://qiita.com/hayao_k/items/b9750cc8fa69d0ce91b0
Lambda Layers で最新の AWS SDK を使用する
https://qiita.com/saitotak/items/813ac6c2057ac64d5fef
GitHub に AWS キーペアを上げると抜かれるってほんと???試してみよー!
https://qiita.com/jqtype/items/9196e047eddb53d07a91
git-secretsはじめました

More Related Content

What's hot

How WSO2 API Manager Supports the Ministry of Hajj and Umrah
How WSO2 API Manager Supports the Ministry of Hajj and UmrahHow WSO2 API Manager Supports the Ministry of Hajj and Umrah
How WSO2 API Manager Supports the Ministry of Hajj and Umrah
WSO2
 
Cloud Native Application Development-build fast, low TCO, scalable & agile so...
Cloud Native Application Development-build fast, low TCO, scalable & agile so...Cloud Native Application Development-build fast, low TCO, scalable & agile so...
Cloud Native Application Development-build fast, low TCO, scalable & agile so...
Lucas Jellema
 

What's hot (20)

[WSO2 Integration Summit San Francisco 2019] Protecting API Infrastructures —...
[WSO2 Integration Summit San Francisco 2019] Protecting API Infrastructures —...[WSO2 Integration Summit San Francisco 2019] Protecting API Infrastructures —...
[WSO2 Integration Summit San Francisco 2019] Protecting API Infrastructures —...
 
[WSO2 Integration Summit San Francisco 2019] Cloud-native Integration for the...
[WSO2 Integration Summit San Francisco 2019] Cloud-native Integration for the...[WSO2 Integration Summit San Francisco 2019] Cloud-native Integration for the...
[WSO2 Integration Summit San Francisco 2019] Cloud-native Integration for the...
 
New NeXt for Advanced Developers
New NeXt for Advanced DevelopersNew NeXt for Advanced Developers
New NeXt for Advanced Developers
 
APIdays Paris 2019 - Zero Downtime in API Management by Waldemar Rosenfeld, A...
APIdays Paris 2019 - Zero Downtime in API Management by Waldemar Rosenfeld, A...APIdays Paris 2019 - Zero Downtime in API Management by Waldemar Rosenfeld, A...
APIdays Paris 2019 - Zero Downtime in API Management by Waldemar Rosenfeld, A...
 
[WSO2 Integration Summit San Francisco 2019] The Composable Enterprise
[WSO2 Integration Summit San Francisco 2019] The Composable Enterprise[WSO2 Integration Summit San Francisco 2019] The Composable Enterprise
[WSO2 Integration Summit San Francisco 2019] The Composable Enterprise
 
apidays LIVE Paris - Multicluster Service Mesh in Action by Denis Jannot
apidays LIVE Paris - Multicluster Service Mesh in Action by Denis Jannotapidays LIVE Paris - Multicluster Service Mesh in Action by Denis Jannot
apidays LIVE Paris - Multicluster Service Mesh in Action by Denis Jannot
 
apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...
apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...
apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...
 
[WSO2 Integration Summit Stuttgart 2019] Decentralizing APIs for Agile Busine...
[WSO2 Integration Summit Stuttgart 2019] Decentralizing APIs for Agile Busine...[WSO2 Integration Summit Stuttgart 2019] Decentralizing APIs for Agile Busine...
[WSO2 Integration Summit Stuttgart 2019] Decentralizing APIs for Agile Busine...
 
[WSO2 Integration Summit San Francisco 2019] The API-driven World
[WSO2 Integration Summit San Francisco 2019] The API-driven World[WSO2 Integration Summit San Francisco 2019] The API-driven World
[WSO2 Integration Summit San Francisco 2019] The API-driven World
 
apidays LIVE Australia 2021 - API Horror Stories from an Unnamed Coworking Co...
apidays LIVE Australia 2021 - API Horror Stories from an Unnamed Coworking Co...apidays LIVE Australia 2021 - API Horror Stories from an Unnamed Coworking Co...
apidays LIVE Australia 2021 - API Horror Stories from an Unnamed Coworking Co...
 
[WSO2 Integration Summit San Francisco 2019] Ballerina - Cloud Native Middlew...
[WSO2 Integration Summit San Francisco 2019] Ballerina - Cloud Native Middlew...[WSO2 Integration Summit San Francisco 2019] Ballerina - Cloud Native Middlew...
[WSO2 Integration Summit San Francisco 2019] Ballerina - Cloud Native Middlew...
 
[APIdays INTERFACE 2021] Programming the Cloud through APIs
[APIdays INTERFACE 2021] Programming the Cloud through APIs[APIdays INTERFACE 2021] Programming the Cloud through APIs
[APIdays INTERFACE 2021] Programming the Cloud through APIs
 
[WSO2 Summit Sydney 2019] Ballerina - Cloud Native Programming Language
[WSO2 Summit Sydney 2019] Ballerina - Cloud Native Programming Language[WSO2 Summit Sydney 2019] Ballerina - Cloud Native Programming Language
[WSO2 Summit Sydney 2019] Ballerina - Cloud Native Programming Language
 
Microsserviços .NET no Azure
Microsserviços .NET no AzureMicrosserviços .NET no Azure
Microsserviços .NET no Azure
 
apidays LIVE London 2021 - Application to API Security, drivers to the Shift ...
apidays LIVE London 2021 - Application to API Security, drivers to the Shift ...apidays LIVE London 2021 - Application to API Security, drivers to the Shift ...
apidays LIVE London 2021 - Application to API Security, drivers to the Shift ...
 
How WSO2 API Manager Supports the Ministry of Hajj and Umrah
How WSO2 API Manager Supports the Ministry of Hajj and UmrahHow WSO2 API Manager Supports the Ministry of Hajj and Umrah
How WSO2 API Manager Supports the Ministry of Hajj and Umrah
 
Scalable Smart Caching for Spring Developers
Scalable Smart Caching for Spring DevelopersScalable Smart Caching for Spring Developers
Scalable Smart Caching for Spring Developers
 
Cloud Native Application Development-build fast, low TCO, scalable & agile so...
Cloud Native Application Development-build fast, low TCO, scalable & agile so...Cloud Native Application Development-build fast, low TCO, scalable & agile so...
Cloud Native Application Development-build fast, low TCO, scalable & agile so...
 
apidays LIVE Paris 2021 - Detecting and Protecting PII by Rob Dickinson, Resu...
apidays LIVE Paris 2021 - Detecting and Protecting PII by Rob Dickinson, Resu...apidays LIVE Paris 2021 - Detecting and Protecting PII by Rob Dickinson, Resu...
apidays LIVE Paris 2021 - Detecting and Protecting PII by Rob Dickinson, Resu...
 
Secure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINX
Secure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINXSecure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINX
Secure, Strengthen, Automate, and Scale Modern Workloads with Red Hat & NGINX
 

Similar to Iret tech labo_14

Similar to Iret tech labo_14 (20)

Embed Spark calling SDK in Your App - Olivier PROFFIT - Cisco Live Berlin 2017
Embed Spark calling SDK in Your App - Olivier PROFFIT - Cisco Live Berlin 2017Embed Spark calling SDK in Your App - Olivier PROFFIT - Cisco Live Berlin 2017
Embed Spark calling SDK in Your App - Olivier PROFFIT - Cisco Live Berlin 2017
 
apidays Paris 2022 - Adding a mock as a service capability to your API strate...
apidays Paris 2022 - Adding a mock as a service capability to your API strate...apidays Paris 2022 - Adding a mock as a service capability to your API strate...
apidays Paris 2022 - Adding a mock as a service capability to your API strate...
 
2017 Hackathon Scality & 42 School
2017 Hackathon Scality & 42 School2017 Hackathon Scality & 42 School
2017 Hackathon Scality & 42 School
 
Interop2018 contrail ContrailEnterpriseMulticloud
Interop2018 contrail ContrailEnterpriseMulticloudInterop2018 contrail ContrailEnterpriseMulticloud
Interop2018 contrail ContrailEnterpriseMulticloud
 
Kernel Con 2022: Securing Cloud Native Workloads
Kernel Con 2022: Securing Cloud Native WorkloadsKernel Con 2022: Securing Cloud Native Workloads
Kernel Con 2022: Securing Cloud Native Workloads
 
Hybrid Integration with SAP
Hybrid Integration with SAPHybrid Integration with SAP
Hybrid Integration with SAP
 
DevOps on AWS: A Practical Introduction
DevOps on AWS: A Practical IntroductionDevOps on AWS: A Practical Introduction
DevOps on AWS: A Practical Introduction
 
Tech Talk: Monitor Microservices in Docker, Cloud Foundry and AWS Cloud
Tech Talk: Monitor Microservices in Docker, Cloud Foundry and AWS CloudTech Talk: Monitor Microservices in Docker, Cloud Foundry and AWS Cloud
Tech Talk: Monitor Microservices in Docker, Cloud Foundry and AWS Cloud
 
OSS Tools: Creating a Reverse Engineering Plug-in for r2frida
OSS Tools: Creating a Reverse Engineering Plug-in for r2fridaOSS Tools: Creating a Reverse Engineering Plug-in for r2frida
OSS Tools: Creating a Reverse Engineering Plug-in for r2frida
 
Lessons learned while going serverless in production
Lessons learned while going serverless in productionLessons learned while going serverless in production
Lessons learned while going serverless in production
 
Second Screen Apps with the Google Cast SDK
Second Screen Apps with the Google Cast SDKSecond Screen Apps with the Google Cast SDK
Second Screen Apps with the Google Cast SDK
 
Hybrid integrationwithsap (Glenn Colpaert @ Integration Monday)
Hybrid integrationwithsap (Glenn Colpaert @ Integration Monday)Hybrid integrationwithsap (Glenn Colpaert @ Integration Monday)
Hybrid integrationwithsap (Glenn Colpaert @ Integration Monday)
 
Scribe Online CDK & Connector Development
Scribe Online CDK & Connector DevelopmentScribe Online CDK & Connector Development
Scribe Online CDK & Connector Development
 
AWS Meetup Paris - Short URL project by Pernod Ricard
AWS Meetup Paris - Short URL project by Pernod RicardAWS Meetup Paris - Short URL project by Pernod Ricard
AWS Meetup Paris - Short URL project by Pernod Ricard
 
Developing Microservices Directly in AKS/Kubernetes
Developing Microservices Directly in AKS/KubernetesDeveloping Microservices Directly in AKS/Kubernetes
Developing Microservices Directly in AKS/Kubernetes
 
Valvencoder
ValvencoderValvencoder
Valvencoder
 
Valvencoder
ValvencoderValvencoder
Valvencoder
 
Let's Program The Cloud
Let's Program The CloudLet's Program The Cloud
Let's Program The Cloud
 
Confluent Cloud Networking | Rajan Sundaram, Confluent
Confluent Cloud Networking | Rajan Sundaram, ConfluentConfluent Cloud Networking | Rajan Sundaram, Confluent
Confluent Cloud Networking | Rajan Sundaram, Confluent
 
Intro to AWS Cloud Development Kit | AWS Floor28
Intro to AWS Cloud Development Kit | AWS Floor28Intro to AWS Cloud Development Kit | AWS Floor28
Intro to AWS Cloud Development Kit | AWS Floor28
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Iret tech labo_14

Editor's Notes

  1. まずは自己紹介させてください。 名前が小石倉広樹と言います。 2019年に新卒としてiretに入社いたしました。 仕事は開発エンジニアとしてAPIの開発を主にやっております。最近はちょくちょくNuxtを触ることも出てきました。 大好物はビールです。特に伊勢角谷さんのビールが好きです。八重洲と新宿にお店があるのでよかったら行ってみてください。W 好きなサービスはAPI GatewayとLambdaです。
  2. はい。では早速やっていきましょう!アジェンダはこちらとなっております。 クレデンシャル情報をパブリックリポジトリに載せちゃう lambdaのランタイムに入ってるAWS SDKと最新のSDKのバージョンが違う CodeCommitで差分がでない developブランチをマージする時に間違えて消しちゃう の四本立てです! もうすでに共感してくださってる方が中にはいらっしゃるんじゃないでしょうか!!
  3. まずはこちらです。 これ、知ってる方も多いんじゃないでしょうか。 Twitterとかでたまにネタにされてますよねww
  4. はい。まずはクレデンシャル情報とはなんぞや。と言うところなのですが、 仮に皆さんが、クラウドにアプリをデプロイして、そこで動かすサービスを開発してる最中とします。 そのアプリはAWSで動かすとしましょう。
  5. で、そのアプリはEC2と呼ばれる仮想サーバーで動かし
  6. ファイルストレージサービスのS3からファイルを取得する必要があると。
  7. ただ、この時S3が情報を全員に公開するような設定になっていなくて、 特定のアクセス元のみに情報を渡す設定になってると、リクエストを送ってきた元が誰かわからず、君誰ですか?となってしまい、情報がもらえなくなっちゃうと言う事が起こります。
  8. そこで例のクレデンシャル情報を使います。 具体的にはクレデンシャル情報のアクセスキーというものとシークレットアクセスキーというものを使います。
  9. それを使うことによってS3は誰からリクエストが来たかを判定することができ、 情報を渡すことができるようになると言ったものです。S3が情報これです〜と言って渡してますね。
  10. ただ言い換えると、このクレデンシャル情報が悪意ある人に渡ってしまうとリクエスト元を詐称することができ、 クレデンシャル情報に与えられた権限の中でなんでもできてしまうことになってしまいます。 S3にだけ権限が絞られていればまだ、S3だけで被害が収まりますが、これがrootアカウント、つまり一番強い権限を持ったアカウントのクレデンシャル情報だと大変なことになってしまいます。 世界中のリージョンにEC2を建てられたりして請求額がえらいことになります。 実際それをやらかして120万円請求された人もいたとか。。少し前にQiitaに記事上がって有名になりましたよね。あれがちょうど公開された頃確か自分は新卒で入ったばっかりで震えた記憶があります。
  11. じゃあどうやってクレデンシャル情報が漏れちゃうか、ですが この二つが多いと思われます。その中でも一番上が漏れてから悪用されるまでが一番早いので一番注意しなければなりません。 というのも不確かな情報ではありますが、Githubなどの公開リポジトリを運営しているサービスにクレデンシャル情報がないかどうか悪意あるユーザーがクロールしているらしいです。 もちろん悪用するために。。 ただ、AWS公式もGithubをクロールしていてクレデンシャル情報が漏れたアカウントに対して警告してくれているって情報もあったりします。。 まあただそうなってからでは遅いですよね。。
  12. じゃあ対処法は?というとこちらです。 ここでミソなのがこれらのどれが欠けても完璧ではない、ということです。 一番上のGit SecretsというのはGitのcommit/commit message等の中身を調べて、その中に事前設定した秘密情報が含まれていたら、そのcommitをさせない仕組みです。 ここに書かれている以外でもSecret ManagerやSSMを駆使してそもそもアプリ上に絶対クレデンシャル情報を書かないと言った方法もありますが、コストもかかりますので それらを使用しない場合はここに書かれていることを厳守する必要があります。
  13. 続きましてこちらです。これ意外にびっくりされた方いらっしゃるんじゃないでしょうか 自分も最初聞いた時にとても衝撃を受けました。
  14. まあまずは見ていただきましょう。 こちらは普通にSDKのバージョンをまずは普通に出すだけのlambda関数を作り、実行したものです。 左がソースで右が実行結果です バージョンが1.18.55と出ますね
  15. じゃあ最新バージョンは幾つなんだろというとこですが、本家サイト見に行くとどうやら1.20.7っぽいです。 マイナーバージョン2つ分も違うことになりますね。。 じゃあこれによって何が引き起こるかというと、言わずもがなですが、ドキュメント見て書いたのに動かない!!とかなったりしますね。
  16. じゃあどうすれば良いかと言うと、Lambda Layerを使います。 ここではあまり深く解説しませんが、簡単に言うと複数のLambda関数同士でライブラリを共有できる仕組みと思っていただけると。。
  17. じゃあ実際に使ってみます。 まずはSDKをダウンロードしてきます
  18. Zip化します
  19. そしたら新しいレイヤーを作成し、そこに先ほどzip化したSDKをアップロード
  20. そしたら新しいレイヤーを追加してやると。
  21. 先ほどと同じソースで実行するとバージョンが1.20.7になったことがわかりました。
  22. 続きましてこちらです。これわりと遭遇された方多いんじゃないでしょうか。
  23. CodeCommitを使ってると “違いを表示できません。個別のファイルが大きすぎて表示できないか、ファイル間の全体的な違いが複雑すぎます”と言う警告と共に差分がでないことがあります。 しかもめっちゃ大きなファイルでもないのに。。
  24. そう言う時はもしかすると全角大文字が半角英数字の文字列の中に紛れてたりする事があります。 以外にそれを消すだけで洗われたりします。
  25. 最後はこちらです。これも意外な落とし穴ですよね。
  26. ちょっと読みますね。 想像してください。 あなたはとても優秀な開発エンジニアです。 とても長い期間を経てある機能を開発し、 プルリクに来る辛辣な指摘コメントにも耐え、developブランチへのマージを もぎ取りました。動作確認もし、いよいよリリースの時です。 リリースと言っても、優秀なCICDが備わっているので やることはmainブランチに対して プルリクを介してマージするだけです。
  27. あなたはちゃんと宛先が間違っていないか何度も確認し、意を決して右下のマージボタンを押しました! CICDが走り、production環境へデプロイが走ります! デプロイが問題なく終わり、動作確認もできました!完璧かと思われましたが、ふと他のエンジニアが言います
  28. あれ?Developブランチなくね?
  29. ギャー!と言うわけでなんでこんなことになったんでしょうか。
  30. 先ほどの画面、よくよく見返すとしたに マージ後にソースブランチdevelopを削除しますか?とあります。そうなんです。Codecommitをプルリクでマージする時にデフォルトでブランチを削除する設定になっているんです。
  31. 対処法としては書いてある通りでIAMでdevelopブランチを削除できないようにできるのでその設定を行うようにします。
  32. 以上で発表を終わります。ご清聴ありがとうございました。