Skip to content

PenguinCabinet/SecCamp2025-B2-Pre-learning-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

セキュリティキャンプ 2025 B2 事前学習1

0. 動作確認済みの実行環境

項目 バージョン
Windows 11
nodejs 20.10.0
Golang 1.24.5
Docker 20.10.16

1. 環境の準備

詳しいソースコードは1.environment_constructionをご覧ください。

1-1. Golang

VS Codeで本リポジトリを開き、Dev Containerの「コンテナを再度開く」からGolangを起動してください。

VS Codeのterminalから、

go run 1.environment_construction/HelloWorld.go

と実行すれば、完了です。

1-2. TypeScript

VS Codeで本リポジトリを開き、Dev Containerの「コンテナを再度開く」からTypeScriptを起動してください。

VS Codeのterminalから、

tsc 1.environment_construction/HelloWorld.ts && node 1.environment_construction/HelloWorld.js

と実行すれば、完了です。

1-3. 完了条件

2. TypeScript

2-1. TypeScript

https://typescriptbook.jp/を読了後、作成したコードは2.TypeScript/2-1.TypeScriptにあります。

https://typescriptbook.jp/tutorialsの各章と本リポジトリのパスの対応は下記の通りです。
(「Vercelにデプロイしてみよう」の章だけパスではなくデプロイ先のURLになっています)

2-2. Fastifyの準備

 https://fastify.dev/docs/latest/Guides/Getting-Started/を読了後、作成したコードは2.TypeScript/2-2.Fastifyにあります。

 各章と実行コマンドの対応は下記の通りです。

Your first server

node src/main.js

Your first plugin

node src/main-plugin.js

MongoDB plugin

docker compose up -d

Validate your data

node src/main-validation.js

 下記のリクエストを投げて、検証してみましょう。

curl -X POST -H "Content-Type: application/json" -d '{"test":"test"}' localhost:3000

 下記のように、必須のプロパティがないため、はじかれます。

{"statusCode":400,"code":"FST_ERR_VALIDATION","error":"Bad Request","message":"body must have required property 'someKey'"}

 次に、必須のプロパティを加えたリクエストを投げます。

curl -X POST -H "Content-Type: application/json" -d '{"someKey":"test","someOtherKey":"test"}' localhost:3000

 今度は、下記の通り、someOtherKeyが数字でなければならないと、はじかれました。

{"statusCode":400,"code":"FST_ERR_VALIDATION","error":"Bad Request","message":"body/someOtherKey must be number"}

 そこで、someOtherKeyの値を数字にして、リクエストを送信します。

curl -X POST -H "Content-Type: application/json" -d '{"someKey":"test","someOtherKey":0}' localhost:3000     

 今度は、うまくいきました。

{"someKey":"test","someOtherKey":0}

Serialize your data

node src/main-serialization.js 

Parsing request payloads

node src/main-parsing.js 

2-3. 完了条件

3. Golang

3-1. Golang

Go Tour

 https://go.dev/tour/welcome/1を読了後、作成したコードは3.Golang/Tourにあります。
 フォルダ構成はgo-tour-jpのリポジトリに準拠しました

 実行方法の例は下記の通りです。

cd 3.Golang/Tour/welcome   
go run hello.go

Go Tutorials

 https://go.dev/doc/tutorial/を読了後、作成したコードは3.Golang/Tutorialsにあります。

 下記のコマンドで実行できます。

cd 3.Golang/Tutorials/create-module/hello
go run .

 greetingsをテストしたい場合、下記のコマンドで実行できます。

cd 3.Golang/Tutorials/create-module/greetings
go test

 下記のコマンドで実行できます。

cd 3.Golang/Tutorials/workspace
git clone https://go.googlesource.com/example
go run ./hello

 下記のコマンドで実行できます。

cd 3.Golang/Tutorials/data-access
docker compose up

 下記のコマンドで実行できます。

cd 3.Golang/web-service-gin
go run .

 下記のコマンドで実行できます。

cd 3.Golang/Tutorials/generics
go run .

 下記のコマンドで実行できます。

go test -fuzz=Fuzz -fuzztime 30s

 下記のコマンドで実行できます。

go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...

3-2. 完了条件

About

セキュリティキャンプ 2025 B2 事前学習1

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors