์ปจํ ์ด๋ํ๋ ๋น๋๋ฅผ ์ฌ์ฉํ๋ code scanning ์ ๋ณด
์ปดํ์ผ๋ ์ธ์ด์ ๋ํด code scanning์(๋ฅผ) ๊ตฌ์ฑํ๊ณ ์ปจํ ์ด๋ํ๋ ํ๊ฒฝ์์ ์ฝ๋๋ฅผ ๋น๋ํ๋ ๊ฒฝ์ฐ. โ๋น๋ ์ค ์์ค ์ฝ๋๊ฐ ํ์๋์ง ์์์ต๋๋คโ๋ผ๋ ์ค๋ฅ ๋ฉ์์ง๊ฐ ๋จ๋ฉด์ ๋ถ์์ด ์คํจํ ์ ์์ต๋๋ค. ์ด๋ CodeQL์ด ์ปดํ์ผ๋ ๋ ์ฝ๋๋ฅผ ๋ชจ๋ํฐ๋งํ ์ ์์์ ๋ํ๋ ๋๋ค.
์ฝ๋๋ฅผ ๋น๋ํ๋ ์ปจํ ์ด๋ ๋ด์์ CodeQL์ ์คํํด์ผ ํฉ๋๋ค. ์ด๋ CodeQL CLI ๋๋ GitHub Actions ์ฌ์ฉ ์ฌ๋ถ์ ๊ด๊ณ์์ด ๋ฐ์ํ ์ ์์ต๋๋ค. CodeQL CLI์ ๋ํ ์์ธํ ์ ๋ณด๋ ๊ธฐ์กด CI ์์คํ ์์ ์ฝ๋ ๊ฒ์ ์ฌ์ฉํ๊ธฐ์(๋ฅผ) ์ฐธ์กฐํ์ธ์. GitHub Actions๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๋์ผํ ์ปจํ ์ด๋์์ ๋ชจ๋ ์์ ์ ์คํํ๋๋ก ์ํฌํ๋ก๋ฅผ ๊ตฌ์ฑํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ์์ ์ํฌํ๋ก๋ฅผ ์ฐธ์กฐํ์ธ์.
์ฐธ๊ณ ํญ๋ชฉ
CodeQL CLI๋ (musl ๊ธฐ๋ฐ) Alpine Linux์ ๊ฐ์ ๋น glibc Linux ๋ฐฐํฌํ๊ณผ ํ์ฌ ํธํ๋์ง ์์ต๋๋ค.
CodeQL code scanning์ ๋ํ ์ข ์์ฑ
์ฌ์ฉ ์ค์ธ ์ปจํ
์ด๋์ ํน์ ์ข
์์ฑ์ด ๋๋ฝ๋ ๊ฒฝ์ฐ code scanning๋ฅผ ์คํํ๋ ๋ฐ ์ด๋ ค์์ด ์์ ์ ์์ต๋๋ค(์: Git์ ์ค์นํ๊ณ PATH ๋ณ์์ ์ถ๊ฐํด์ผ ํจ). ์ข
์์ฑ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ ๊ฒฝ์ฐ ์ผ๋ฐ์ ์ผ๋ก GitHub์ ์คํ๊ธฐ ์ด๋ฏธ์ง์ ํฌํจ๋ ์ํํธ์จ์ด ๋ชฉ๋ก์ ๊ฒํ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ค์ ์์น์ ์๋ ๋ฒ์ ๋ณ readme
ํ์ผ์ ์ฐธ์กฐํ์ธ์.
- Linux: https://github.com/actions/runner-images/tree/main/images/ubuntu
- macOS: https://github.com/actions/runner-images/tree/main/images/macos
- Windows: https://github.com/actions/runner-images/tree/main/images/windows
์์ ์ํฌํ๋ก
์ด ์ํ ์ํฌํ๋ก๋ GitHub Actions๋ฅผ ์ฌ์ฉํ์ฌ ์ปจํ
์ด๋ํ๋ ํ๊ฒฝ์์ CodeQL ๋ถ์์ ์ํํฉ๋๋ค. container.image
๊ฐ์ ์ฌ์ฉํ ์ปจํ
์ด๋๋ฅผ ์๋ณํฉ๋๋ค. ์ด ์์์ ์ด๋ฏธ์ง ์ด๋ฆ์ codeql-container
์ด๊ณ ํ๊ทธ๋ f0f91db
์
๋๋ค. ์์ธํ ๋ด์ฉ์ GitHub Actions์ ๋ํ ์ํฌํ๋ก ๊ตฌ๋ฌธ์(๋ฅผ) ์ฐธ์กฐํ์ธ์.
name: "CodeQL"
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '15 5 * * 3'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
strategy:
fail-fast: false
matrix:
language: [java-kotlin]
# Specify the container in which actions will run
container:
image: codeql-container:f0f91db
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Build
run: |
./configure
make
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3