Snyk
Developer Security Platform
A developer-first security platform. Automatically detects vulnerabilities in code, open-source dependencies, container images, and IaC templates, and provides remediation suggestions.
Developer Security Platform
A developer-first security platform. Automatically detects vulnerabilities in code, open-source dependencies, container images, and IaC templates, and provides remediation suggestions.
Snyk (pronounced "sneak") is a cloud-native security platform that champions "Developer-First Security." Since its founding in 2015, it has aimed to integrate security naturally into developer workflows, detecting vulnerabilities directly in the IDE, Git repositories, and CI/CD pipelines. Whereas existing security tools were operations-team-centric, Snyk enables developers to discover and fix security issues at the code-writing stage. It currently maintains an open-source vulnerability database of more than 10 million entries.
Snyk consists of four main products. Snyk Code is SAST (static analysis) and detects security flaws in code you write yourself. Snyk Open Source is SCA (Software Composition Analysis) and scans dependencies from package managers such as npm, pip, and Maven for vulnerabilities. Snyk Container analyzes vulnerabilities in the OS packages and application layers of Docker images. Snyk IaC detects security misconfigurations in Terraform, CloudFormation, and Kubernetes manifests.
What sets Snyk apart is "Fix." Rather than simply reporting vulnerabilities, it provides automatic PR (Pull Request) creation, safe version recommendations, and patch application methods. Snyk Advisor scores the health of open-source packages (security, maintenance, community) to help with evaluation before adoption. With the Priority Score, which combines CVSS, exploitability, and business context, you can focus on the vulnerabilities that pose a high actual risk.
In AI/ML projects, Snyk is an essential tool. It tracks vulnerabilities in ML libraries such as PyTorch, TensorFlow, and Hugging Face Transformers, as well as their dependencies (numpy, pillow, etc.). It also scans the container images and Kubernetes deployment configurations of ML pipelines, securing the model-serving infrastructure. Generating an SBOM (Software Bill of Materials) also supports compliance with supply chain security regulations.
# Snyk CLI 설치 및 기본 사용법
# npm으로 Snyk CLI 설치
npm install -g snyk
# Snyk 인증 (브라우저 열림)
snyk auth
# 프로젝트 의존성 취약점 검사
snyk test
# 컨테이너 이미지 취약점 검사
snyk container test python:3.11-slim
# IaC 파일 보안 검사
snyk iac test ./terraform/
# 코드 보안 분석 (SAST)
snyk code test
# 취약점 모니터링 등록 (지속적 알림)
snyk monitor
# 취약점 자동 수정 (PR 생성)
snyk fix
# 특정 심각도 이상만 실패 처리
snyk test --severity-threshold=high
# JSON 출력으로 CI/CD 연동
snyk test --json > snyk-report.json
# SBOM 생성 (CycloneDX 형식)
snyk sbom --format=cyclonedx1.4+json > sbom.json
# 특정 취약점 무시 (사유 기록)
snyk ignore --id=SNYK-JS-LODASH-567746 --reason="No user input reaches this function"
# GitHub Actions - Snyk 보안 검사 통합
name: Security Scan
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
schedule:
- cron: '0 9 * * 1' # 매주 월요일 오전 9시
jobs:
snyk-security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
# 오픈소스 의존성 검사
- name: Snyk Open Source Test
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high
# 코드 보안 분석 (SAST)
- name: Snyk Code Test
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: code test
# 컨테이너 이미지 검사
- name: Build Docker Image
run: docker build -t myapp:${{ github.sha }} .
- name: Snyk Container Test
uses: snyk/actions/docker@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: myapp:${{ github.sha }}
args: --severity-threshold=critical
# IaC 보안 검사
- name: Snyk IaC Test
uses: snyk/actions/iac@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=medium
# Snyk 모니터링 등록 (main 브랜치만)
- name: Monitor with Snyk
if: github.ref == 'refs/heads/main'
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: monitor
# Python - Snyk API를 활용한 취약점 관리 자동화
import requests
import json
from typing import List, Dict
class SnykClient:
"""Snyk API 클라이언트"""
def __init__(self, token: str, org_id: str):
self.base_url = "https://api.snyk.io/v1"
self.headers = {
"Authorization": f"token {token}",
"Content-Type": "application/json"
}
self.org_id = org_id
def list_projects(self) -> List[Dict]:
"""조직의 모든 프로젝트 목록 조회"""
response = requests.get(
f"{self.base_url}/org/{self.org_id}/projects",
headers=self.headers
)
response.raise_for_status()
return response.json()["projects"]
def get_project_issues(self, project_id: str) -> Dict:
"""프로젝트의 취약점 상세 조회"""
response = requests.post(
f"{self.base_url}/org/{self.org_id}/project/{project_id}/issues",
headers=self.headers,
json={
"filters": {
"severities": ["critical", "high"],
"types": ["vuln"],
"ignored": False,
"patched": False
}
}
)
response.raise_for_status()
return response.json()
def ignore_issue(self, project_id: str, issue_id: str, reason: str):
"""특정 이슈 무시 처리"""
response = requests.post(
f"{self.base_url}/org/{self.org_id}/project/{project_id}/ignore/{issue_id}",
headers=self.headers,
json={
"ignorePath": "",
"reason": reason,
"reasonType": "not-vulnerable",
"disregardIfFixable": False
}
)
response.raise_for_status()
return response.json()
def generate_report(self) -> Dict:
"""조직 전체 보안 리포트 생성"""
projects = self.list_projects()
report = {
"total_projects": len(projects),
"critical_issues": 0,
"high_issues": 0,
"projects_with_issues": []
}
for project in projects:
issues = self.get_project_issues(project["id"])
issue_count = issues.get("issues", {})
critical = len([i for i in issue_count.get("vulnerabilities", [])
if i["severity"] == "critical"])
high = len([i for i in issue_count.get("vulnerabilities", [])
if i["severity"] == "high"])
if critical > 0 or high > 0:
report["critical_issues"] += critical
report["high_issues"] += high
report["projects_with_issues"].append({
"name": project["name"],
"critical": critical,
"high": high
})
return report
# 사용 예시
if __name__ == "__main__":
client = SnykClient(
token="your-snyk-api-token",
org_id="your-org-id"
)
# 보안 리포트 생성
report = client.generate_report()
print(f"전체 프로젝트: {report['total_projects']}")
print(f"Critical 취약점: {report['critical_issues']}")
print(f"High 취약점: {report['high_issues']}")
# Slack/Teams 알림 연동 가능
for project in report["projects_with_issues"]:
print(f" - {project['name']}: C:{project['critical']} H:{project['high']}")
"At the PR stage, we scan dependencies for vulnerabilities with Snyk and set it to block merges if anything is High or above. Snyk also automatically generates a Fix PR so developers can fix issues right away. Over 80% are resolved before the security team's review."
"After switching the base image to python:3.11-slim, the Snyk Container results improved dramatically. The previous ubuntu-based image had more than 200 CVEs, but now it has fewer than 10. Using a slim image also reduces the attack surface."
"When I scanned the ML dependencies with Snyk, a few vulnerabilities showed up in pillow and numpy. Looking at the Priority Score, the actual exploitability seemed low, but let's still add a version upgrade task to the next sprint."
If you set priorities based on CVSS alone, they will diverge from actual risk. Combine the Snyk Priority Score, Exploit Maturity, and business context (whether it is exposed to the internet) to focus on the vulnerabilities that are truly dangerous.
When you ignore false positives or vulnerabilities that cannot be fixed, be sure to record the reason. Without an audit trail, you won't be able to tell later why something was ignored, and new team members will end up reviewing the same vulnerability again.
Failing the build on every vulnerability slows down development, and being too lenient makes security meaningless. Start with --severity-threshold=high and adjust it to fit your team's situation.
Set up IDE plugins to detect vulnerabilities at the coding stage, automatic scans on PRs, and weekly monitoring alerts. Generate an SBOM to prepare for supply chain security regulations (SSDF, EU CRA), and use Snyk Advisor to check the health of new packages before adopting them.