klaws — Korean compliance risk scanner

io.github.rostradamus由 GitHub 帳號 rostradamus 發布v0.1.6更新於 Oct 24, 2026

Scan code for Korean compliance risks — PIPA/개인정보보호법, Network Act, Credit Info. Not legal advice.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

一個本機 MCP 伺服器,掃描原始碼中可能違反韓國個資與電商法規的風險,並將結果對應到具體法條。

可以做什麼
掃描目錄或單一檔案中的合規風險模式,回傳嚴重程度、位置、程式片段與對應法條(scan_directory、scan_file)。列出可用的偵測器及其檢查內容(list_detectors)。依編號查詢內建的韓國法律條文,可選擇從 law.go.kr 取得最新文本(get_law_reference)。偵測器以正規表達式比對,支援英文與韓文字段名,涵蓋《個人資料保護法》、資訊通信網法、信用資訊法與電子商務法。
適用情境
適合在程式庫處理韓國使用者的個資、信用或交易資料時做初步盤點,在正式法律審查前找出同意驗證、未加密識別碼、個資寫入日誌、保存期限與第三方傳輸等問題。
執行需求
以本機程序透過 stdio 執行,啟動指令為 klaws serve;需先安裝執行檔(Docker 映像、預先編譯檔、go install 或 Go 1.23+ 原始碼建置),或使用已發布的容器映像。不需要帳號、API 金鑰或環境變數。選用的線上法條查詢需要連線至 law.go.kr。
安裝前請注意
偵測結果來自正規表達式的啟發式比對,專案明確表示不構成法律意見,應視為待複核的提示而非合規認證。掃描工具會讀取伺服器所在機器的檔案系統,應以 scan-root 限制可存取路徑;以 HTTP 提供服務時需設定驗證權杖,該權杖僅做 Bearer 驗證,不提供 TLS。掃描在本機以唯讀方式進行,唯一的外部請求是選用的線上法條查詢。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 klaws — Korean compliance risk scanner,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

klaws

[CI] [Release] [Container] [Glama] [License: MIT]

한국어

Korean law compliance risk scanner for codebases. Scans source code for patterns that may indicate compliance risks under Korean law and maps findings to specific legal provisions. Runs as an MCP server (so AI coding assistants can scan on request) and as a standalone CLI.

Currently covers PIPA (Personal Information Protection Act), the Network Act (정보통신망법), the Credit Information Act (신용정보법), and the E-Commerce Act (전자상거래법).

Disclaimer: klaws identifies possible compliance risks for review. It does not constitute legal advice. Consult qualified legal counsel for definitive guidance.

Privacy: klaws analyzes code locally and transmits nothing. The only outbound network call is the optional --live law lookup to law.go.kr; without that flag it is fully offline. See Privacy & Security.

Quick Start

bash
# Scan the current directory with Docker — no install neededdocker run --rm -v "$PWD":/src:ro ghcr.io/rostradamus/klaws scan /src
# ...or, if you installed the binary:klaws scan ./my-project        # scan a directoryklaws scan ./MyService.java    # scan a single file

Installation

Docker (recommended)

No toolchain required — the image is published to GitHub Container Registry and works identically on macOS, Linux, and Windows:

bash
# Scan the current directory (mount it read-only at /src)docker run --rm -v "$PWD":/src:ro ghcr.io/rostradamus/klaws scan /src
# Pin a version instead of the floating latest tagdocker run --rm -v "$PWD":/src:ro ghcr.io/rostradamus/klaws:0.1.6 scan /src

Prebuilt binary

Download the archive for your platform from the latest release, extract it, and move klaws onto your PATH.

go install

bash
go install github.com/rostradamus/klaws/cmd/klaws@latest

From source

Requirements: Go 1.23+

bash
git clone https://github.com/rostradamus/klaws.gitcd klawsgo build -o klaws ./cmd/klaws/

Verify the install:

bash
klaws --version

Usage

Scan

bash
# Scan a directory (default: *.java files)klaws scan ./src
# Scan specific file typesklaws scan ./src --pattern "*.kt"
# Text output (default is JSON)klaws scan ./src --format text
# SARIF output (for GitHub code scanning / other tools)klaws scan ./src --format sarif > klaws.sarif
# Fail the command (exit 1) if any finding is at or above a severityklaws scan ./src --fail-on HIGH
# Use a custom laws fileklaws scan ./src --laws ./my-laws.yaml

Example Output

klaws scan reportTarget:  ./testdataFiles:   4Findings: 7
--- Finding 1 ---  Detector:  PIPA-CST-001  Risk:      HIGH  Location:  testdata/MemberController.java:10  Snippet:   @PostMapping("/register")  Message:   Endpoint accepts possible personal data without apparent consent             mechanism — may require review under PIPA Article 15  Laws:      PIPA-15
--- Finding 2 ---  Detector:  PIPA-ENC-001  Risk:      HIGH  Location:  testdata/MemberEntity.java:11  Snippet:   private String residentNumber;  Message:   Possible unencrypted personal identifier (residentNumber) — may             require review under PIPA Article 24-2  Laws:      PIPA-24-2, PIPA-29
--- Finding 3 ---  Detector:  PIPA-LOG-001  Risk:      MEDIUM  Location:  testdata/UserService.java:11  Snippet:   log.info("User registered: " + email);  Message:   Possible personal data (email) in log output — may require review             under PIPA Article 29  Laws:      PIPA-29

Look Up Law Provisions

bash
# Look up from bundled databaseklaws law PIPA-15
# Fetch live text from law.go.krklaws law PIPA-15 --live

List Detectors

bash
klaws detectors
json
[  {    "id": "PIPA-LOG-001",    "name": "Personal Data Logging Risk",    "description": "Detects log statements that may contain personal data fields",    "related_laws": ["PIPA-29"]  },  {    "id": "PIPA-ENC-001",    "name": "Unencrypted Personal Data Risk",    "description": "Detects personal identifier fields stored without apparent encryption",    "related_laws": ["PIPA-24-2", "PIPA-29"]  },  {    "id": "PIPA-CST-001",    "name": "Missing Consent Check Risk",    "description": "Detects endpoints accepting personal data without apparent consent verification",    "related_laws": ["PIPA-15"]  }]

Detectors

IDNameWhat it looks forRiskRelated Law
PIPA-LOG-001Personal Data Logginglog.*() calls containing personal data field names (email, phone, SSN, password)MEDIUMPIPA Art. 29
PIPA-ENC-001Unencrypted Personal DataSensitive identifier fields (resident number, SSN) without encryption annotations or callsHIGHPIPA Art. 24-2, 29
PIPA-CST-001Missing Consent Check@PostMapping/@PutMapping endpoints accepting personal data without consent verificationHIGHPIPA Art. 15
NIA-MKT-001Marketing Message ConsentAdvertising/marketing message dispatch (send/push) without an apparent opt-in consent checkMEDIUMNetwork Act Art. 50
CIA-ENC-001Unprotected Credit InformationCredit/financial identifier fields (card number, account number, credit score) without encryption or maskingHIGHCredit Information Act Art. 19
ECA-RET-001Transaction Record RetentionTransaction record fields (order/payment IDs) stored without apparent retention or preservation handlingMEDIUME-Commerce Act Art. 6
PIPA-RET-001Personal Data RetentionPersonal data fields (email, phone, resident number) stored without apparent destruction or retention-limit handlingMEDIUMPIPA Art. 21
PIPA-XBR-001Third-Party Data TransferPersonal data sent to a third-party or external endpoint (outbound call to an external URL/partner) without an apparent consent checkHIGHPIPA Art. 17

Detectors use regex-based pattern matching. They support both English and Korean field names (e.g., email/이메일, residentNumber/주민번호, consent/동의).

MCP Server

klaws can run as an MCP server, making its scanning capabilities available to AI coding assistants.

bash
klaws serve

Available Tools

ToolDescription
scan_directoryScan a directory for compliance risks
scan_fileScan a single file
list_detectorsList all available detectors
get_law_referenceLook up a Korean law provision by ID

Configuration

All clients use the same launch command: klaws serve over stdio. Use the absolute path to the binary (run which klaws, or where klaws on Windows, to find it), or just klaws if it is on your PATH. Prefer not to install anything? Use the Docker variant below — it works in any client that supports stdio MCP servers.

Claude Code — ~/.claude/settings.json:

json
{  "mcpServers": {    "klaws": {      "command": "klaws",      "args": ["serve"]    }  }}

Or add it in one command:

bash
claude mcp add klaws -- klaws serve

Claude Desktop — claude_desktop_config.json (Settings → Developer → Edit Config):

json
{  "mcpServers": {    "klaws": {      "command": "klaws",      "args": ["serve"]    }  }}

Cursor — ~/.cursor/mcp.json (or .cursor/mcp.json in a project):

json
{  "mcpServers": {    "klaws": {      "command": "klaws",      "args": ["serve"]    }  }}

VS Code — .vscode/mcp.json:

json
{  "servers": {    "klaws": {      "command": "klaws",      "args": ["serve"]    }  }}

Once connected, ask your assistant something like "scan this directory for Korean compliance risks with klaws."

Run the MCP server via Docker

No binary install needed — swap the command/args for a docker run that mounts the code you want scannable. The -i flag keeps stdin open for the stdio transport; --scan-root /src confines scans to the mounted directory:

json
{  "mcpServers": {    "klaws": {      "command": "docker",      "args": [        "run", "--rm", "-i",        "-v", "/absolute/path/to/your/project:/src:ro",        "ghcr.io/rostradamus/klaws:latest",        "serve", "--scan-root", "/src"      ]    }  }}

Point the assistant at paths under /src (the container-side mount), e.g. "scan /src for Korean compliance risks."

Remote (Streamable HTTP)

By default klaws serve uses stdio (local). To run it as a remote MCP server over HTTP, pass --http:

bash
klaws serve --http :8080# or via the published container image:docker run --rm -p 8080:8080 ghcr.io/rostradamus/klaws serve --http :8080

The MCP endpoint is then available at http://<host>:8080/mcp (Streamable HTTP transport). Point an HTTP-capable MCP client at that URL.

Securing a remote server
bash
klaws serve --http :8080 \  --auth-token "$(openssl rand -hex 32)" \  --scan-root /workspace
  • --auth-token <token> — requires Authorization: Bearer <token> on every HTTP request; unauthenticated requests get 401. Can also be supplied via the KLAWS_AUTH_TOKEN environment variable. Applies to --http only.
  • --scan-root <dir> — restricts scan_directory / scan_file to paths within <dir>; requests for paths outside it are rejected. (Also honored in stdio mode.)

Notes:

  • --auth-token provides bearer auth but not TLS. For untrusted networks, still terminate TLS at a reverse proxy / gateway in front of klaws.
  • The scan_directory and scan_file tools read the server's filesystem (the paths you pass resolve on the host running klaws). For remote scanning, run klaws where the code lives (e.g. a CI runner with the repo checked out) and set --scan-root to that checkout. The get_law_reference and list_detectors tools have no filesystem dependency.

Bundled Law Provisions

klaws ships with 40 articles across 4 Korean laws embedded in the binary (no external files needed):

PIPA (개인정보 보호법) — 10 articles

IDArticleTopic
PIPA-15Art. 15Collection and use of personal information
PIPA-17Art. 17Provision to third parties
PIPA-18Art. 18Restriction on use beyond purpose
PIPA-21Art. 21Destruction of personal information
PIPA-23Art. 23Restriction on sensitive information
PIPA-24Art. 24Restriction on unique identification info
PIPA-24-2Art. 24-2Restrictions on resident registration numbers
PIPA-29Art. 29Duty of safety measures
PIPA-30Art. 30Privacy policy
PIPA-34Art. 34Notification of data breach

Network Act (정보통신망법) — 11 articles

IDArticleTopic
NIA-22Art. 22Consent for collection/use of personal info
NIA-23Art. 23Restriction on collection
NIA-23-2Art. 23-2Restriction on resident registration numbers
NIA-24Art. 24Restriction on use
NIA-24-2Art. 24-2Provision to third parties
NIA-27Art. 27Safety measures
NIA-28Art. 28Entrustment of personal info
NIA-28-2Art. 28-2Notification of data breach
NIA-44Art. 44User protection
NIA-44-7Art. 44-7Prohibition of illegal information
NIA-50Art. 50Restriction on transmission of advertising info

Credit Information Act (신용정보법) — 10 articles

IDArticleTopic
CIA-15Art. 15Principles of collection
CIA-17Art. 17Prohibition of disclosure beyond purpose
CIA-19Art. 19Safety of credit info systems
CIA-20Art. 20Accuracy and currency of credit info
CIA-32Art. 32Consent for provision/use
CIA-33Art. 33Use of personal credit info
CIA-34Art. 34Provision/use of personal credit info
CIA-38Art. 38Protection of credit info
CIA-39Art. 39Notification of data breach
CIA-40Art. 40Rights of credit info subjects

E-Commerce Act (전자상거래법) — 9 articles

IDArticleTopic
ECA-6Art. 6Preservation of transaction records
ECA-7Art. 7Prevention of operational errors
ECA-11Art. 11Reliability of electronic payment
ECA-13Art. 13Provision of identity and transaction info
ECA-14Art. 14Confirmation of orders
ECA-17Art. 17Right of withdrawal
ECA-21Art. 21Use of consumer information
ECA-24Art. 24Cybermall security
ECA-26Art. 26Protection of consumer information

Full Korean article text is included. Use --live to fetch the latest version from law.go.kr.

Privacy & Security

klaws is designed to be safe to point at private code:

  • Local-only analysis. Scanning is pure static pattern-matching on files you pass in. Source code never leaves your machine — nothing is uploaded, logged remotely, or sent to any service.
  • One optional outbound call. The only network request klaws ever makes is the --live law lookup (CLI) / get_law_reference with live fetch (MCP), which fetches public statute text from law.go.kr. It sends only the statute's name (e.g. 개인정보보호법, resolved from the provision you looked up) as the search query — never your code. Omit --live to stay fully offline.
  • Read-only by design. klaws only reads the files it scans; it never modifies your code. Its MCP tools are annotated read-only.
  • Confine the reachable filesystem. When exposing the MCP server, pass --scan-root <dir> to restrict scan_directory/scan_file to a single tree, and --auth-token when serving over --http. See Securing a remote server.

To report a vulnerability, see SECURITY.md.

Architecture

klaws scan ./src       │       ▼   FileWalker ──► walks directory, matches glob pattern       │       ▼  ScannerService ──► reads each file       │       ▼  DetectorRegistry ──► runs all detectors on source code       │       ▼    Findings ──► mapped to law provisions       │       ▼   Report ──► JSON or text output

Roadmap

  • More detectors: marketing-message consent (NIA-MKT-001) (done), unprotected credit information (CIA-ENC-001) (done), transaction-record retention (ECA-RET-001) (done), personal-data retention (PIPA-RET-001) (done), third-party/cross-border transfer (PIPA-XBR-001) (done)
  • Multi-language: Python, JavaScript/TypeScript detection patterns
  • More Korean laws: E-Commerce Act (전자상거래법) consumer protection rules (done), Network Act (정보통신망법) (done), Credit Information Act (신용정보법) (done)
  • CI/CD: GitHub Action, SARIF output, severity thresholds (done)
  • Configuration: custom pattern rules via config file

GitHub Action (CI)

klaws ships a composite action that scans your code and produces a SARIF report, which you can upload to GitHub code scanning so findings appear inline on pull requests and in the Security tab.

yaml
# .github/workflows/klaws.ymlname: klaws compliance scanon: [pull_request]
permissions:  contents: read  security-events: write   # required to upload SARIF
jobs:  scan:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v4
      - id: klaws        uses: rostradamus/klaws@v0   # moving major tag; add `version: vX.Y.Z` below to pin the klaws binary        with:          path: ./src          pattern: "*.java"          fail-on: none      # or MEDIUM / HIGH to gate the PR
      - name: Upload SARIF        if: always()          # upload even if fail-on tripped the step        uses: github/codeql-action/upload-sarif@v3        with:          sarif_file: ${{ steps.klaws.outputs.sarif }}

Set fail-on: HIGH (or MEDIUM) to make the check fail the PR when findings at that severity or above are present. The if: always() on the upload step ensures the SARIF is still published when the gate fails.

Releasing

Maintainers: see RELEASE.md for how to cut a release and publish to the MCP registry.

License

MIT

來源:README.md,提交 1b3b071

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.6最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分