Skip to main content
Glama

๐Ÿ›ก๏ธ SecureGateway (formerly SecureMCP)

Same project, new name. See the 1.0.0 rename and clean-install notes.

Local English/Korean Masking ยท Subscription Gateway ยท Trusted Restoration

์˜์–ดยทํ•œ๊ตญ์–ดยท์ฝ”๋“œ๋ฅผ ๋กœ์ปฌ์—์„œ ๋งˆ์Šคํ‚นํ•˜๊ณ , ๋„๊ตฌ ์‹คํ–‰๊ณผ ์‚ฌ์šฉ์ž ํ™”๋ฉด์—์„œ ์›๋ฌธ์„ ๋ณต์›ํ•˜๋Š” ๊ฐœ์ธ์ •๋ณด ๋ณดํ˜ธ ๋„๊ตฌ

Version Python Platforms CI MCP License


English ยท ํ•œ๊ตญ์–ด ์•ˆ๋‚ด ยท Supported Versions ยท Quick Start ยท ์„ค์น˜ยท์šด์˜ ๊ฐ€์ด๋“œ ยท Features ยท Architecture ยท Documentation


English Overview

SecureGateway masks English/Korean text and code locally, with session-based restoration.

Version 0.5 adds an experimental local subscription gateway for Claude Code and Codex. Run secure-gateway gateway install once, then use claude / codex normally. Requests are masked automatically; responses and local tool arguments are restored automatically. Existing CLI subscription OAuth is forwarded to the original subscription service; API keys are refused. No agent hooks are installed. See subscription gateway for setup, automatic startup, tested versions and the exact protection boundary.

Legacy agent hooks remain optional utilities. They cover selected tool text rather than complete requests; local integration documents their limits.

Other hosts have explicit support levels in the compatibility table. Antigravity provides verified stdio MCP utility integration. SDK 0.1.21 uses a context-owned authenticated bridge to the explicit xAI API gateway; native file reads and restoration are verified offline, with separate API billing. The separate xAI API mode and Grok custom model require opt-in and incur API charges, independently of Claude/Codex or Grok subscriptions.

Mask confidential input before sending it to a provider. Restore responses in your trusted local application and show them to the user there. Model-invoked MCP tool arguments are already visible to the provider; adding this server to Claude Desktop or Cursor does not automatically intercept or protect prompts. Restored originals must not be sent back into the model context. This is heuristic masking, not a proof of anonymity, cryptographic zero knowledge, or regulatory compliance.


Related MCP server: phantomswap

Supported Versions

Component

Supported versions / scope

SecureGateway

1.0.0

Python

3.10 ยท 3.11 ยท 3.12 ยท 3.13 ยท 3.14 in CI; package requires Python โ‰ฅ 3.10

Operating systems

Windows ยท macOS ยท Linux in CI

Claude Code gateway

2.1.287 / Sonnet 5.5 native fixtures and live subscription file-read/masking/restoration verified in English and Korean

Codex gateway

CLI 0.160.0 / gpt-6.1-sol native fixtures and live ChatGPT subscription file-read/masking/restoration verified in English and Korean

MCP transport

Local stdio; CLI HTTP/SSE transports are disabled

Natural languages

English ยท ํ•œ๊ตญ์–ด ยท mixed input

Code languages

Python ยท JavaScript ยท TypeScript ยท Go ยท Rust ยท Java ยท C ยท C++ ยท SQL

The CI matrix covers 15 Python/OS combinations. Code-language support describes lexer modes, not compatibility with every language release or compiler. The gateway is experimental. Native fixture tests verify routing/masking/restoration. Both agents passed live subscription tests: native file reads, masked source transmission, model answers and automatic restoration in English and Korean. Claude's attribution and alias compatibility bugs are fixed. The earlier 429 was not subscription exhaustion. This does not certify all-traffic privacy.


Quick Start

Automatic subscription integration

uv tool install .
secure-gateway gateway install
secure-gateway gateway status

Restart Claude Code/Codex and use their normal commands. Setup preserves login caches and registers a hidden user-login startup task. It changes user-wide provider settings; no agent hooks are added. Subscription limits still apply. This is text/code inference protection; images, remote attachments and unsupported payloads are blocked. See gateway guide. For the complete lifecycle, including the local dashboard and login, see ์„ค์น˜ยท์šด์˜ ๊ฐ€์ด๋“œ.

์„ค์น˜ยท์‹คํ–‰ยท๊ด€๋ฆฌ์ž ํŽ˜์ด์ง€ยท์ข…๋ฃŒยท์‚ญ์ œ

์•„๋ž˜๋Š” Claude Code / Codex ๊ตฌ๋… ๊ฒŒ์ดํŠธ์›จ์ด์˜ ์ „์ฒด ์‚ฌ์šฉ ์ˆœ์„œ์ž…๋‹ˆ๋‹ค. Python 3.10 ์ด์ƒ, uv, Git์„ ์ค€๋น„ํ•˜๊ณ  ์‚ฌ์šฉํ•  ์—์ด์ „ํŠธ์—์„œ ๊ธฐ์กด ๊ตฌ๋… ๋กœ๊ทธ์ธ์„ ์™„๋ฃŒํ•˜์„ธ์š”. ๊ด€๋ฆฌ์ž ์›นํŽ˜์ด์ง€๋Š” ๊ฒŒ์ดํŠธ์›จ์ด์— ํฌํ•จ๋˜์–ด ์žˆ์œผ๋ฉฐ ๋ณ„๋„ ์›น์„œ๋ฒ„๋ฅผ ์„ค์น˜ํ•  ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.

1. ํŒจํ‚ค์ง€ ์„ค์น˜์™€ ์ตœ์ดˆ ์„ค์ •

git clone https://github.com/mj10612/SecureGateway.git
cd SecureGateway
uv tool install .
secure-gateway gateway install
secure-gateway gateway status

์ด๋ฏธ ์ €์žฅ์†Œ๋ฅผ ๋‚ด๋ ค๋ฐ›์•˜๋‹ค๋ฉด ํ•ด๋‹น ํด๋”์—์„œ uv tool install .๋ถ€ํ„ฐ ์‹คํ–‰ํ•˜์„ธ์š”. gateway install์€ ๊ธฐ๋ณธ์ ์œผ๋กœ Claude Code์™€ Codex์˜ ์‚ฌ์šฉ์ž ์„ค์ •์„ ๋ฐฑ์—…ยท๋ณ€๊ฒฝํ•˜๊ณ , ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ์ฆ‰์‹œ ๋ฐฑ๊ทธ๋ผ์šด๋“œ๋กœ ์‹คํ–‰ํ•˜๋ฉฐ ์šด์˜์ฒด์ œ ์‚ฌ์šฉ์ž ๋กœ๊ทธ์ธ ์‹œ ์ž๋™ ์‹œ์ž‘์„ ๋“ฑ๋กํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ์กด Claude/ChatGPT ๋กœ๊ทธ์ธ ํŒŒ์ผ์€ ๋ณ€๊ฒฝํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์„ค์น˜ ํ›„ ์‹คํ–‰ ์ค‘์ด๋˜ ์—์ด์ „ํŠธ๋ฅผ ์ข…๋ฃŒํ•˜๊ณ  ๋‹ค์‹œ ์‹คํ–‰ํ•ด์•ผ ์ƒˆ ๊ฒฝ๋กœ๊ฐ€ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

ํ•œ ์—์ด์ „ํŠธ๋งŒ ์„ค์ •ํ•˜๊ฑฐ๋‚˜ ํฌํŠธ๋ฅผ ๋ฐ”๊พธ๋ ค๋ฉด ์ตœ์ดˆ ์„ค์น˜ ๋•Œ ์˜ต์…˜์„ ์ง€์ •ํ•˜์„ธ์š”.

secure-gateway gateway install --agent codex
# ๋˜๋Š” Claude Code๋งŒ ์„ค์ •
secure-gateway gateway install --agent claude
# ๊ธฐ๋ณธ ํฌํŠธ 38117 ๋Œ€์‹  ๋‹ค๋ฅธ ํฌํŠธ ์‚ฌ์šฉ
secure-gateway gateway install --port 38119

์œ„ ์˜ˆ์‹œ๋Š” ์„ ํƒ์ง€์ด๋ฉฐ ์ „๋ถ€ ์‹คํ–‰ํ•  ํ•„์š”๋Š” ์—†์Šต๋‹ˆ๋‹ค. ๊ธฐ์กด ์„ค์น˜์˜ ํฌํŠธ๋ฅผ ๋ณ€๊ฒฝํ•˜๋ ค๋ฉด ๋จผ์ € gateway uninstall๋กœ ์„ค์ •์„ ๋ณต์›ํ•œ ๋’ค ์›ํ•˜๋Š” ํฌํŠธ๋กœ ๋‹ค์‹œ ์„ค์น˜ํ•˜์„ธ์š”. secure-gateway ๋ช…๋ น์„ ์ฐพ์ง€ ๋ชปํ•œ๋‹ค๋ฉด uv tool update-shell์„ ์‹คํ–‰ํ•˜๊ณ  ํ„ฐ๋ฏธ๋„์„ ๋‹ค์‹œ ์—ฌ์„ธ์š”.

2. ์‹คํ–‰ยท์ƒํƒœ ํ™•์ธยท์žฌ์‹œ์ž‘

์ตœ์ดˆ ์„ค์น˜ ํ›„์—๋Š” ํ‰์†Œ์ฒ˜๋Ÿผ claude / codex๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธ ์‹œ ์ž๋™ ์‹œ์ž‘๋œ ๊ฒŒ์ดํŠธ์›จ์ด๊ฐ€ ๋งˆ์Šคํ‚นยท์ค‘๊ณ„ยท๋ณต์›์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. ์ƒํƒœ๋Š” ๋‹ค์Œ ๋ช…๋ น์œผ๋กœ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

secure-gateway gateway status

์ด ๋ช…๋ น์€ ์„œ๋ฒ„ ์ƒํƒœ์™€ ์„ค์น˜ ํŒŒ์ผ ๋ณ€๊ฒฝ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ์‹ค์ œ ์ถ”๋ก  ์š”์ฒญ์ด ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ํ†ต๊ณผํ•˜๋Š”์ง€๋Š” ์—์ด์ „ํŠธ์—์„œ ์š”์ฒญ์„ ๋ณด๋‚ธ ๋’ค ๊ด€๋ฆฌ์ž ํŽ˜์ด์ง€์˜ ์ฒ˜๋ฆฌ ๋กœ๊ทธ๋กœ ํ™•์ธํ•˜์„ธ์š”.

์ˆ˜๋™ ์‹คํ–‰ ๋˜๋Š” ์ง„๋‹จ์ด ํ•„์š”ํ•˜๋ฉด ๊ธฐ์กด ๋ฐฑ๊ทธ๋ผ์šด๋“œ ํ”„๋กœ์„ธ์Šค๋ฅผ ๋จผ์ € ์ข…๋ฃŒํ•œ ๋’ค ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

secure-gateway gateway stop
secure-gateway gateway run

gateway run์€ ํ˜„์žฌ ํ„ฐ๋ฏธ๋„์—์„œ ๊ณ„์† ์‹คํ–‰๋˜๋ฉฐ Ctrl+C๋กœ ์ข…๋ฃŒํ•ฉ๋‹ˆ๋‹ค. ์ด ์ƒํƒœ์—์„œ ๊ด€๋ฆฌ์ž ํŽ˜์ด์ง€๋ฅผ ์—ด๋ ค๋ฉด ๋‹ค๋ฅธ ํ„ฐ๋ฏธ๋„์„ ์‚ฌ์šฉํ•˜์„ธ์š”. ์ข…๋ฃŒํ•œ ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ๋‹ค์‹œ ๋ฐฑ๊ทธ๋ผ์šด๋“œ๋กœ ์‹คํ–‰ํ•˜๋ ค๋ฉด ์„ค์น˜ ์„ค์ •์ด ๋ณ€๊ฒฝ๋˜์ง€ ์•Š์€ ์ƒํƒœ์—์„œ secure-gateway gateway install์„ ๋‹ค์‹œ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ €์žฅ์†Œ์˜ ์ตœ์‹  ์ฝ”๋“œ๋กœ ๊ธฐ์กด ํŒจํ‚ค์ง€๋ฅผ ์—…๋ฐ์ดํŠธํ•  ๋•Œ๋Š” ๋‹ค์Œ ์ˆœ์„œ๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”.

secure-gateway gateway stop
uv tool install --force .
secure-gateway gateway install

์ดํ›„ ์—์ด์ „ํŠธ๋ฅผ ์žฌ์‹œ์ž‘ํ•˜์„ธ์š”. ์„ค์น˜ ๋’ค ํ˜ธ์ŠคํŠธ ์„ค์ •์ด ์ˆ˜์ •๋๋‹ค๋ฉด ์žฌ์„ค์น˜ยท์ œ๊ฑฐ๊ฐ€ ๊ฑฐ๋ถ€๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ค๋ฅ˜๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” ์„ค์ •๊ณผ installation.json์˜ ๋ฐฑ์—…์„ ๊ฒ€ํ† ยท๋ณ‘ํ•ฉํ•œ ๋’ค ์žฌ์‹œ๋„ํ•˜์„ธ์š”.

3. ๊ด€๋ฆฌ์ž ํŽ˜์ด์ง€ ์‹คํ–‰

๊ฒŒ์ดํŠธ์›จ์ด๊ฐ€ ์‹คํ–‰ ์ค‘์ผ ๋•Œ ๋‹ค์Œ ๋ช…๋ น์œผ๋กœ ๊ธฐ๋ณธ ๋ธŒ๋ผ์šฐ์ €๋ฅผ ์—ฝ๋‹ˆ๋‹ค.

secure-gateway gateway admin

๊ธฐ๋ณธ ์ฃผ์†Œ๋Š” http://127.0.0.1:38117/admin์ž…๋‹ˆ๋‹ค. ์„ค์น˜ ์‹œ ํฌํŠธ๋ฅผ ๋ณ€๊ฒฝํ–ˆ๋‹ค๋ฉด ํ•ด๋‹น ํฌํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”. gateway admin์€ ์„ค์ • ํŒŒ์ผ์—์„œ ํฌํŠธ๋ฅผ ์ฝ์–ด ์˜ฌ๋ฐ”๋ฅธ ์ฃผ์†Œ๋ฅผ ์•ˆ๋‚ดํ•ฉ๋‹ˆ๋‹ค. ๋ธŒ๋ผ์šฐ์ €๋ฅผ ์ž๋™์œผ๋กœ ์—ด์ง€ ์•Š๊ณ  ์ฃผ์†Œ๋งŒ ํ™•์ธํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

secure-gateway gateway admin --no-open

์ด ๋ช…๋ น์€ ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ์ƒˆ๋กœ ์‹œ์ž‘ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์„œ๋ฒ„๊ฐ€ ์ค‘์ง€๋๋‹ค๋ฉด ๋จผ์ € ์‹คํ–‰ํ•˜์„ธ์š”.

4. ๊ด€๋ฆฌ์ž ๋กœ๊ทธ์ธ๊ณผ ๋กœ๊ทธ ์กฐํšŒ

์„ค์ • ํŒŒ์ผ์— ํ† ํฐ์ด ์žˆ๋‹ค๊ณ  ์ž๋™ ๋กœ๊ทธ์ธ๋˜๋Š” ๊ฒƒ์€ ์•„๋‹™๋‹ˆ๋‹ค. ๋ธŒ๋ผ์šฐ์ €๋Š” ๋กœ์ปฌ ์„ค์ • ํŒŒ์ผ์„ ์ฝ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ์ˆœ์„œ๋กœ ๋กœ๊ทธ์ธํ•˜์„ธ์š”.

  1. ์‚ฌ์šฉ ์ค‘์ธ ๊ฒŒ์ดํŠธ์›จ์ด์˜ config.json์„ ๋กœ์ปฌ ํŽธ์ง‘๊ธฐ๋กœ ์—ฝ๋‹ˆ๋‹ค.

  2. JSON์˜ token ํ•ญ๋ชฉ ๊ฐ’์„ ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๊ฐ’ ์ฃผ๋ณ€์˜ ํฐ๋”ฐ์˜ดํ‘œ๋Š” ์ œ์™ธํ•ฉ๋‹ˆ๋‹ค.

  3. ๊ด€๋ฆฌ์ž ํŽ˜์ด์ง€์˜ ๊ด€๋ฆฌ์ž ์ธ์ฆ ํ† ํฐ ์ž…๋ ฅ๋ž€์— ๋ถ™์—ฌ ๋„ฃ์Šต๋‹ˆ๋‹ค.

  4. ๊ด€๋ฆฌ์ž ํŽ˜์ด์ง€ ์—ด๊ธฐ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฆ…๋‹ˆ๋‹ค.

์šด์˜์ฒด์ œ

๊ธฐ๋ณธ ์„ค์ • ํŒŒ์ผ

Windows

%USERPROFILE%\.secure-gateway\gateway\config.json

macOS / Linux

~/.secure-gateway/gateway/config.json

์ด ํ† ํฐ์€ ์„ค์น˜ํ•  ๋•Œ ์ƒ์„ฑ๋˜๋Š” ๋กœ์ปฌ ๊ฒŒ์ดํŠธ์›จ์ด ์ ‘๊ทผ ํ† ํฐ์ž…๋‹ˆ๋‹ค. Claude/ChatGPT์˜ ๊ตฌ๋… ๋กœ๊ทธ์ธ ํ† ํฐ์ด๋‚˜ API ํ‚ค๋ฅผ ์ž…๋ ฅํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹™๋‹ˆ๋‹ค. ๋ณ„๋„์˜ ๊ด€๋ฆฌ์ž ๊ณ„์ •ยท๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” ์—†์œผ๋ฉฐ, ์„ค์ • ํŒŒ์ผ์˜ ํ† ํฐ๊ณผ ์ผ์น˜ํ•˜๋ฉด ๊ด€๋ฆฌ์ž ๋กœ๊ทธ๋ฅผ ์กฐํšŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ† ํฐ์€ URL์— ๋„ฃ๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ์‚ฌ๋žŒ์—๊ฒŒ ๊ณต์œ ํ•˜์ง€ ๋งˆ์„ธ์š”.

ํ† ํฐ์€ ํ˜„์žฌ ๋ธŒ๋ผ์šฐ์ € ํƒญ์˜ ๋ฉ”๋ชจ๋ฆฌ์—๋งŒ ๋ณด๊ด€ํ•ฉ๋‹ˆ๋‹ค. ๋ธŒ๋ผ์šฐ์ € ํŽ˜์ด์ง€๋ฅผ ์ƒˆ๋กœ๊ณ ์นจ(F5)ํ•˜๊ฑฐ๋‚˜ ํƒญ์„ ๋‹ซ์œผ๋ฉด ๋‹ค์‹œ ์ž…๋ ฅํ•ด์•ผ ํ•˜๋ฉฐ, ํ™”๋ฉด์˜ ๋กœ๊ทธ์•„์›ƒ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ํ† ํฐ๊ณผ ํ‘œ์‹œ๋œ ๋‚ด์—ญ์ด ์ง€์›Œ์ง‘๋‹ˆ๋‹ค. ํ™”๋ฉด ์•ˆ์˜ ์ƒˆ๋กœ๊ณ ์นจ ๋ฒ„ํŠผ์€ ๋กœ๊ทธ์ธ ์ƒํƒœ๋ฅผ ์œ ์ง€ํ•˜๋ฉด์„œ ๋กœ๊ทธ๋งŒ ๋‹ค์‹œ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค. ๋กœ๊ทธ์•„์›ƒ์€ ๊ฒŒ์ดํŠธ์›จ์ด ์ข…๋ฃŒ๋‚˜ SQLite ๋กœ๊ทธ ์‚ญ์ œ๋ฅผ ์˜๋ฏธํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๊ด€๋ฆฌ์ž ํ™”๋ฉด์—์„œ๋Š” ์—์ด์ „ํŠธยท์ œ๊ณต์žยท๊ตฌ๋…/API ์ธ์ฆยท๊ฒฐ๊ณผยท์‹œ์ž‘ ์ผ์‹œยท์ต๋ช… ๊ณ„์ • ID๋กœ ๋กœ๊ทธ๋ฅผ ํ•„ํ„ฐ๋งํ•˜๊ณ , ๊ฐ ์š”์ฒญ์˜ ๋ชจ๋ธยท๋ชฉ์ ์ง€ยทHTTP ์ƒํƒœยท์ „์†ก ์‹œ๋„ยท์ฒ˜๋ฆฌ ์‹œ๊ฐ„ยท๋ฐ”์ดํŠธ ์ˆ˜๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Claude ๊ตฌ๋…, ChatGPT ๊ตฌ๋…, xAI API ํ‚ค ๊ฒฝ๋กœ๋Š” ๊ตฌ๋ถ„๋ฉ๋‹ˆ๋‹ค. ์ „๋‹ฌ๋œ ๊ณ„์ • ์‹๋ณ„์ž๋Š” ์ต๋ช…ํ™”ํ•˜๋ฉฐ, ๊ตฌ๋… ์š”๊ธˆ์ œ๋‚˜ ๊ฒฐ์ œ ๊ณ„์ •์„ ํ™•์ธํ•  ์ˆ˜ ์—†๋Š” ๊ฒฝ์šฐ์—๋Š” ํ™•์ธ ๋ถˆ๊ฐ€๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

์ฒ˜๋ฆฌ ๋‚ด์—ญ์€ config.json ์˜†์˜ **logs.sqlite3**์— ์ €์žฅํ•˜๋ฉฐ ์ตœ๊ทผ 100,000๊ฑด์„ ๋ณด๊ด€ํ•ฉ๋‹ˆ๋‹ค. ์š”์ฒญยท์‘๋‹ต ์›๋ฌธ, OAuth ํ† ํฐ, API ํ‚ค๋Š” ๊ธฐ๋กํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์žฌ์‹œ์ž‘ ํ›„์—๋„ ๋กœ๊ทธ๋Š” ์œ ์ง€๋ฉ๋‹ˆ๋‹ค. SQLite ๋กœ๊ทธ๋Š” ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ์ข…๋ฃŒํ•œ ๋’ค ๋ฐฑ์—…ํ•˜๊ฑฐ๋‚˜ SQLite ์˜จ๋ผ์ธ ๋ฐฑ์—… ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

5. ์‚ฌ์šฉ์ž ์ง€์ • ์„ค์ • ํŒŒ์ผ๊ณผ xAI API ๋ชจ๋“œ

--config๋กœ ์„ค์น˜ํ–ˆ๋‹ค๋ฉด ์ดํ›„ ๋ช…๋ น์—์„œ๋„ ๊ฐ™์€ ์„ค์ • ํŒŒ์ผ์„ ์ง€์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜ ๊ฒฝ๋กœ๋Š” ์‹ค์ œ ์‚ฌ์šฉ ์ค‘์ธ ๊ฒฝ๋กœ๋กœ ๋ฐ”๊พธ์„ธ์š”.

secure-gateway gateway install --config ./gateway-state/config.json
secure-gateway gateway status --config ./gateway-state/config.json
secure-gateway gateway admin --config ./gateway-state/config.json
secure-gateway gateway stop --config ./gateway-state/config.json
secure-gateway gateway uninstall --config ./gateway-state/config.json

์ˆ˜๋™ ์‹คํ–‰๋„ gateway run --config ./gateway-state/config.json์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๊ด€๋ฆฌ์ž ๋กœ๊ทธ์ธ์—๋Š” ์ด ํŒŒ์ผ์˜ token์„ ์‚ฌ์šฉํ•˜๊ณ , ๋กœ๊ทธ DB๋Š” ๊ฐ™์€ ํด๋”์— ์ €์žฅ๋ฉ๋‹ˆ๋‹ค.

xAI API ๋ชจ๋“œ๋Š” ๊ตฌ๋… ๊ฒŒ์ดํŠธ์›จ์ด์™€ ๋ณ„๋„๋กœ ์„ค์ •ยท์‹คํ–‰ํ•˜๋ฉฐ ๋ณ„๋„ API ์š”๊ธˆ์ด ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์„ค์น˜๋Š” Grok / xAI ์•ˆ๋‚ด๋ฅผ ๋”ฐ๋ฅด๊ณ , ์‹คํ–‰์—๋Š” gateway api-run, ์ œ๊ฑฐ์—๋Š” gateway api-uninstall์„ ์‚ฌ์šฉํ•˜์„ธ์š”. ๊ธฐ๋ณธ ์„ค์ •์€ ~/.secure-gateway/xai-api/config.json, ๊ธฐ๋ณธ ํฌํŠธ๋Š” 38118์ž…๋‹ˆ๋‹ค. ๊ด€๋ฆฌ์ž ํ™”๋ฉด์€ ๋™์ผํ•œ ๋ช…๋ น์œผ๋กœ ํ•ด๋‹น ์„ค์ • ํŒŒ์ผ์„ ์ง€์ •ํ•ด ์—ฝ๋‹ˆ๋‹ค.

secure-gateway gateway admin --config /path/to/xai-api/config.json

6. ์ข…๋ฃŒยท์„ค์ • ํ•ด์ œยทํŒจํ‚ค์ง€ ์‚ญ์ œ

์›ํ•˜๋Š” ์ž‘์—…

๋ฐฉ๋ฒ•

๋‚จ๋Š” ํ•ญ๋ชฉ

๊ด€๋ฆฌ์ž ํ™”๋ฉด ๋กœ๊ทธ์•„์›ƒ

ํ™”๋ฉด์˜ ๋กœ๊ทธ์•„์›ƒ

๊ฒŒ์ดํŠธ์›จ์ด๋Š” ๊ณ„์† ์‹คํ–‰๋˜๊ณ  DB ๋กœ๊ทธ๋Š” ์œ ์ง€

ํ˜„์žฌ ๊ฒŒ์ดํŠธ์›จ์ด๋งŒ ์ข…๋ฃŒ

secure-gateway gateway stop ๋˜๋Š” ์ˆ˜๋™ ์‹คํ–‰ ํ„ฐ๋ฏธ๋„์—์„œ Ctrl+C

์—์ด์ „ํŠธ ์„ค์ •ยท์ž๋™ ์‹œ์ž‘ ๋“ฑ๋กยท๋กœ์ปฌ ๋ฐ์ดํ„ฐ ์œ ์ง€

๊ฒŒ์ดํŠธ์›จ์ด ์„ค์ • ํ•ด์ œ

secure-gateway gateway uninstall

์„ค์ • ๋ณต์› ํ›„ ๋กœ์ปฌ ์„ค์ • ํŒŒ์ผยท๋กœ๊ทธยท์„ธ์…˜ ๋ฐ์ดํ„ฐ ์œ ์ง€

์„ค์น˜ํ•œ ํŒจํ‚ค์ง€ ์‚ญ์ œ

์„ค์ • ํ•ด์ œ ํ›„ uv tool uninstall secure-gateway

์ €์žฅ์†Œ์™€ ๋กœ์ปฌ ๋ฐ์ดํ„ฐ ์œ ์ง€

stop๋งŒ ์‹คํ–‰ํ•˜๋ฉด ๋‹ค์Œ ์šด์˜์ฒด์ œ ๋กœ๊ทธ์ธ ๋•Œ ๊ฒŒ์ดํŠธ์›จ์ด๊ฐ€ ๋‹ค์‹œ ์‹œ์ž‘๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ข…๋ฃŒ๋œ ๋™์•ˆ์—๋Š” ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ์„ค์ •๋œ ์—์ด์ „ํŠธ ์š”์ฒญ์ด ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค. ์ž๋™ ์‹œ์ž‘ ๋“ฑ๋ก์„ ์ œ๊ฑฐํ•˜๊ณ  ์—์ด์ „ํŠธ์˜ ๊ธฐ์กด ์„ค์ •์œผ๋กœ ๋Œ์•„๊ฐ€๋ ค๋ฉด uninstall์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

์™„์ „ํžˆ ์‚ฌ์šฉ์„ ์ค‘๋‹จํ•  ๋•Œ์˜ ์ˆœ์„œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

secure-gateway gateway uninstall
uv tool uninstall secure-gateway

uninstall์€ ์‹คํ–‰ ์ค‘์ธ ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ์ข…๋ฃŒํ•˜๊ณ , ๋ฐฑ์—…ํ•œ ์—์ด์ „ํŠธ ์„ค์ •๊ณผ ์ž๋™ ์‹œ์ž‘ ํŒŒ์ผ์„ ์„ค์น˜ ์ „ ์ƒํƒœ๋กœ ๋ณต์›ํ•ฉ๋‹ˆ๋‹ค. ์„ฑ๊ณตํ•œ ๋’ค ์—์ด์ „ํŠธ๋ฅผ ์žฌ์‹œ์ž‘ํ•˜์„ธ์š”. ์„ค์น˜ ํ›„ ์ˆ˜์ •๋œ ํŒŒ์ผ์„ ๋ฎ์–ด์“ฐ์ง€ ์•Š๋„๋ก ์ œ๊ฑฐ๊ฐ€ ๊ฑฐ๋ถ€๋˜๋ฉด ๋จผ์ € ์„ค์ •์„ ๊ฒ€ํ† ยท๋ณ‘ํ•ฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์„ค์ • ๋ณต์›์ด ์™„๋ฃŒ๋˜๊ธฐ ์ „์— ํŒจํ‚ค์ง€๋‚˜ ๋ฐฑ์—…์„ ์‚ญ์ œํ•˜์ง€ ๋งˆ์„ธ์š”. xAI API ์„ค์ •๋„ ์‚ฌ์šฉํ–ˆ๋‹ค๋ฉด ํŒจํ‚ค์ง€๋ฅผ ์‚ญ์ œํ•˜๊ธฐ ์ „์— gateway api-uninstall๋„ ์‹คํ–‰ํ•˜์„ธ์š”.

๋ณต๊ตฌ์šฉ ์„ค์ •ยทSQLite ๋กœ๊ทธยท์•”ํ˜ธํ™” ์„ธ์…˜์€ ์ž๋™์œผ๋กœ ์‚ญ์ œํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ œ๊ฑฐ๊ฐ€ ์„ฑ๊ณตํ•˜๊ณ  ๊ฒŒ์ดํŠธ์›จ์ด๊ฐ€ ์ข…๋ฃŒ๋œ ๊ฒƒ์„ ํ™•์ธํ•œ ๋’ค, ๋ฐ์ดํ„ฐ๊นŒ์ง€ ์‚ญ์ œํ•˜๋ ค๋ฉด ํ•„์š”ํ•œ ๋กœ๊ทธ๋ฅผ ๋จผ์ € ๋ฐฑ์—…ํ•˜๊ณ  ํ•ด๋‹น ๋ฐ์ดํ„ฐ ํด๋”๋ฅผ ์ˆ˜๋™ ์‚ญ์ œํ•˜์„ธ์š”.

์„ค์น˜ ๋ฐฉ์‹

์‚ญ์ œํ•  ๋ฐ์ดํ„ฐ ํด๋”

๊ธฐ๋ณธ ๊ตฌ๋… ๊ฒŒ์ดํŠธ์›จ์ด

Windows: %USERPROFILE%\.secure-gateway\gateway / macOSยทLinux: ~/.secure-gateway/gateway

๊ธฐ๋ณธ xAI API ๊ฒŒ์ดํŠธ์›จ์ด

Windows: %USERPROFILE%\.secure-gateway\xai-api / macOSยทLinux: ~/.secure-gateway/xai-api

์‚ฌ์šฉ์ž ์ง€์ • ์„ค์ •

์ง€์ •ํ•œ config.json์˜ ๋ถ€๋ชจ ํด๋”์—์„œ SecureGateway ๋ฐ์ดํ„ฐ๋งŒ ์‚ญ์ œ

์‚ฌ์šฉ์ž ์ง€์ • ํด๋”์— ๋‹ค๋ฅธ ํŒŒ์ผ์ด ์žˆ๋‹ค๋ฉด ํด๋” ์ „์ฒด๋ฅผ ์‚ญ์ œํ•˜์ง€ ๋งˆ์„ธ์š”. ์†Œ์Šค ์ €์žฅ์†Œ๋Š” ํŒจํ‚ค์ง€ ์ œ๊ฑฐ์™€ ๋ณ„๊ฐœ์ด๋ฏ€๋กœ ๋” ์ด์ƒ ํ•„์š”ํ•˜์ง€ ์•Š์„ ๋•Œ ์ง์ ‘ ์‚ญ์ œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ž์„ธํ•œ ๋ณดํ˜ธ ๋ฒ”์œ„์™€ ์˜ค๋ฅ˜ ์ง„๋‹จ์€ ๊ฒŒ์ดํŠธ์›จ์ด ์•ˆ๋‚ด๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

Legacy optional agent hooks

uv tool install .
secure-gateway init --agent claude
secure-gateway doctor

Restart Claude Code after installation. Hooks default to the current project; use --global for user-wide registration. See local integration for supported tool fields, installation/removal and limitations.

For Codex:

secure-gateway init --agent codex
secure-gateway doctor --agent codex

Restart Codex and review/trust the installed definitions in /hooks. Project hooks require a trusted project. Codex masks tool results and restores Bash/apply_patch inputs; automatic screen restoration is unavailable. Use secure-gateway restore --agent codex --session-id <id> with masked text on UTF-8 stdin for local display. See Codex integration.

Development installation and demo

uv venv
uv pip install -e ".[dev]"
uv run python -m secure_gateway demo

Trusted local Python API

from secure_gateway import LocalPrivacyClient

# Replace echo with your provider adapter. Only its argument may leave the host.
def provider(masked_payload: str) -> str:
    return masked_payload

with LocalPrivacyClient() as client:
    result = client.request(
        "Patient John Doe received 50mg.", provider,
        sensitive_terms={"John Doe"},
    )
    print(result.unmasked_text)  # Local display only

Features

Feature

Behavior

๐ŸŒ English & Korean

Per-word multilingual handling, conservative Korean particle separation and explicit sensitive terms

๐Ÿงฉ Code-aware masking

Language-specific lexer modes for identifiers, literals and comments; numbers preserved by default

๐ŸŽญ Four surrogate strategies

Bracket, Unicode, delimited pseudoword and random hash representations

๐Ÿ” Subscription gateway

Automatic request masking, shared prompt/code aliases, local tool-argument restoration and automatic answer display; existing OAuth, no API-key fallback

๐Ÿ“Š Local admin dashboard

Token-authenticated log viewer, routing/account metadata, filters and request details; SQLite storage, no prompt/reply/credential logging

๐Ÿ”Œ Local agent hooks

Claude Code and Codex tool-text masking and local execution-argument restoration; Claude Code also supports display-only restoration

๐Ÿ” Session management

Stable per-session mappings, operation locks, idle expiry and opt-in encrypted snapshots

๐Ÿ› ๏ธ CLI & Python API

Local masking/restoration, hook diagnostics, statistics and a buffered command wrapper

Masking policies

Mode

Behavior

content_words

Mask content words and detected sensitive spans; keep functional grammar.

entities_only

Mask recognized PII, URLs, secrets, code spans, numbers and capitalized names. Korean and other case-free/non-ASCII words are masked conservatively, including ordinary nouns.

aggressive

Keep a small structural subset of articles/prepositions/conjunctions; mask auxiliaries, adverbs, pronouns and other words.

code_aware

Mask identifiers, literals and comments using the selected lexer; preserve numbers unless explicitly enabled.

English, Korean and mixed input are handled per word. Unicode names remain atomic. Korean particle splitting uses known stems and conservative rules; unknown ambiguous words stay whole. It is not a full morphological analyzer or universal person-name detector. Supply sensitive_terms for domain names, lowercase names, ambiguous names, and custom secrets. custom_preserve / CLI --preserve deliberately exempts selected words; recognized sensitive spans still take precedence. Unknown secret formats and context-dependent names may evade entities_only; inspect the payload or use broader masking. A high masking ratio does not prove absence of sensitive data.

Surrogate strategies

Strategy

Representation

bracket

[ENT_1]

unicode

โŸฆENT_1โŸง

pseudoword

Explicitly delimited pronounceable words, e.g. โŸชBrivelโ€ฆโŸซ

hash

Random 96-bit nonce, independent of the original

Pseudowords use explicit delimiters to avoid collisions with real words and adjacent tokens. Allocation is stable within a session; random strategies intentionally differ between sessions. Keep all surrogate spelling intact. Altered/unknown placeholder candidates are reported in unmatched_surrogates; strict=True rejects them. Free-form deletion or invention by a model cannot always be detected or reconstructed.

Korean restoration

Exact mask/unmask roundtrips keep written particles. For newly generated Korean responses, opt into normalize_particles=True (CLI --normalize-particles) to choose ์ด/๊ฐ€, ์€/๋Š”, ์„/๋ฅผ, ๊ณผ/์™€ and ์œผ๋กœ/๋กœ from a restored Hangul stem. Pronunciation of foreign names is not guessed.

Code-aware review representations

Code languages: python, javascript, typescript, go, rust, java, c, cpp, sql. Use explicit language in mask_code (CLI --code-language) for ambiguous snippets. Auto detection is best effort. Keywords are language-specific; builtins and shadowed builtin names are masked. Unicode identifiers, SQL comments/doubled quotes, backticks, Python f-strings and escaped newlines, C++/Rust raw strings and numeric suffixes/separators are covered by tests. Code allocations use ASCII names (smcp_ID_n and smcp_LIT_n inside literals) and, when numeric masking is enabled, random native integer constants for numbers (reserved 732846 prefix plus 12 digits), independently of the text strategy, so byte literals remain valid too. Python output is syntax-checked in tests. Output is an opaque review representation: it need not execute, type-check or preserve f-string/template interpolation behavior. Numeric types/values can change when numeric masking is enabled. This small lexer is not a complete parser for every version of every supported language.


System Architecture

flowchart LR
    Input[Trusted local input] --> Mask[Masking engine]
    Mask -->|Masked payload| Provider[AI provider callback]
    Provider -->|Surrogate response| Restore[Local restoration]
    Restore --> Display[User display]
    Vault[Local session mappings] --- Mask
    Vault --- Restore

The subscription gateway masks configured inference requests before forwarding them and restores responses before the CLI consumes them. The callback path masks its provider argument. Legacy agent hooks use a separate, partial tool-text path; they do not intercept all outgoing context. See the architecture and local integration documents.


CLI and Sessions

python -m secure_gateway mask "Alice from Google" --session-id example --session-file example.enc --json-output
python -m secure_gateway unmask "[ENT_1] from [ENT_2]" --session-id example --session-file example.enc --strict
python -m secure_gateway mask "john doe" --mode entities_only --sensitive-term "john doe"

Use the same hidden password, or SECURE_GATEWAY_SESSION_PASSWORD. CLI files use authenticated Fernet encryption, random salt, PBKDF2-HMAC-SHA256 with 600,000 iterations, atomic writes and a lock over the complete CLI read/modify/write operation. A concurrent writer fails clearly. Marked .lock files are persistent and their OS locks are released after a crash; retain these files. Only legacy empty locks require manual migration after all old writers stop. Files are opt-in; without --session-file, mappings only survive in the current process. Payload schema v2 stores allocations/counters without regenerating mappings. Legacy v1 files remain readable; unknown schema versions fail explicitly. Delete session files after use. Legacy bare pseudoword allocations retain their old ambiguity; start a new session to use the safe delimited representation for every allocation.

Session strategies are immutable; mode records the last-used policy. Creating a duplicate ID fails without changing its TTL or mappings. TTL must be positive and at most one day. The vault sweeps idle expired sessions at most one cleanup interval later (default one second), and checks expiration on access. Clear waits for active operations and invalidates retained references. Library users must use session.operation() for custom mutations; built-in engine operations use the same lock. vault.close() stops cleanup and releases all mapping references. Python cannot promise byte-level memory zeroization. Standalone PrivacySession owners manage lifetime themselves; use SessionVault for scheduled expiry.

Version 0.6 adds UTF-8 stdin and --input-file for mask/unmask, configurable MCP resource limits, and local Hook snapshot diagnostics:

secure-gateway mask --input-file private.txt --session-file example.enc --json-output
secure-gateway state status
secure-gateway state gc             # read-only preview
secure-gateway state gc --apply     # retire expired snapshots; use new conversations
secure-gateway gateway diagnostics

MCP defaults are 1,000 sessions, 100,000 mappings per session, and 16 MiB per input. serve --max-sessions, --mapping-limit, and --input-limit configure them. Gateway defaults admit 32 inference requests globally and eight per provider; JSON configuration keys are max_active_requests and max_provider_requests. See the integration guides for command limits, safe cleanup, and supported schema constraints.

masked_ratio counts masked token occurrences divided by non-whitespace/non-punctuation occurrences. Deprecated privacy_entropy_score is an alias, not information entropy. restored_occurrences counts replacements; restored_unique_tokens counts distinct allocations. restored_tokens_count remains a compatibility alias for replacement occurrences.


MCP Tools Reference

python -m secure_gateway serve supports local stdio only. HTTP/SSE transports are disabled in the CLI; directly exposing the Python server over a network requires host-provided authentication and isolation.

MCP tool

Purpose

mask_text

Mask text with a selected policy and session

mask_code

Create a code review representation using a selected language lexer

create_privacy_session

Create an isolated mapping session

get_session_stats

Return counters without original values or mapping entries

clear_privacy_session

Release the session's mapping references

Local Python unmask_text / unmask_code and CLI unmask are not registered as MCP tools, so a model cannot enumerate mappings via restoration. Resources: privacy://policies, privacy://status. Example desktop configurations are utility setups, not privacy proxies.

Migration from 0.1

Version 0.2 changes pseudoword delimiters, code identifier/number representations, mapping keys (mapping_key(original, token_type, code=...)), sentence-initial entity classification, keyword preservation, and the MCP restoration boundary. Direct store readers should use mapping values or mapping_key. Validate explicitly requested strategies; omitted strategies follow the generator.


ํ•œ๊ตญ์–ด ์•ˆ๋‚ด (Korean Overview)

0.5์—์„œ๋Š” Claude CodeยทCodex์˜ ๊ธฐ์กด ๊ตฌ๋… ๋กœ๊ทธ์ธ์„ ์œ ์ง€ํ•˜๋Š” ๋กœ์ปฌ ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. uv tool install . ์„ค์น˜ ํ›„ secure-gateway gateway install์„ ํ•œ ๋ฒˆ ์‹คํ–‰ํ•˜๊ณ  ๋‘ CLI๋ฅผ ์žฌ์‹œ์ž‘ํ•˜์„ธ์š”. ๊ทธ ๋’ค์—๋Š” ํ‰์†Œ์ฒ˜๋Ÿผ claude / codex๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์ง์ ‘ ์ž…๋ ฅยทํ…์ŠคํŠธ ์ฝ”๋“œยท๋„๊ตฌ ๊ฒฐ๊ณผ๋ฅผ ์ž๋™์œผ๋กœ ๋งˆ์Šคํ‚นํ•˜๊ณ , ๋‹ต๋ณ€๊ณผ ๋กœ์ปฌ ์‹คํ–‰ ์ธ์ž๋Š” ์ž๋™ ๋ณต์›ํ•ฉ๋‹ˆ๋‹ค. ํ•จ์ˆ˜๋ช…ยท๋ณ€์ˆ˜๋ช…ยท๋ฌธ์ž์—ดยท์ˆซ์žยท์ฃผ์„์„ ๋ณด์กดํ•˜๋Š” ์˜ˆ์™ธ๋Š” ์ถ”๊ฐ€ํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ์ž…๋ ฅ์—์„œ ์ง€์นญํ•œ ํ•จ์ˆ˜์™€ ์ฝ”๋“œ์˜ ํ•จ์ˆ˜๋Š” ๊ฐ™์€ ์น˜ํ™˜ํ‘œ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

๊ธฐ์กด ๋กœ๊ทธ์ธ ํŒŒ์ผ์€ ์ฝ๊ฑฐ๋‚˜ ๋ณต์‚ฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. CLI๊ฐ€ ๊ด€๋ฆฌํ•˜๋Š” OAuth ํ—ค๋”์™€ ๊ฐฑ์‹  ํ๋ฆ„์„ ์‚ฌ์šฉํ•˜๊ณ , API ํ‚ค ์š”์ฒญ์€ ๊ฑฐ๋ถ€ํ•˜๋ฏ€๋กœ ์œ ๋ฃŒ API๋กœ ์ž๋™ ์ „ํ™˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ƒˆ Hook์„ ๋“ฑ๋กํ•˜์ง€ ์•Š์œผ๋ฉฐ, ์šด์˜์ฒด์ œ ์‚ฌ์šฉ์ž ๋กœ๊ทธ์ธ ์‹œ ๋ฐฑ๊ทธ๋ผ์šด๋“œ๋กœ ์ž๋™ ์‹œ์ž‘ํ•˜๋„๋ก ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ์กด Hook ๋ฐฉ์‹์€ ์„ ํƒ ๊ธฐ๋Šฅ์œผ๋กœ ๋‚จ๊ฒจ ๋‘์—ˆ์Šต๋‹ˆ๋‹ค. ์„ค์น˜ยทํ•ด์ œ ๋ฐ ๋ณดํ˜ธ ๋ฒ”์œ„๋ฅผ ํ™•์ธํ•˜์„ธ์š”.

Claude Code 2.1.287ยทCodex 0.160.0์˜ ์‹ค์ œ CLI๋ฅผ ๋ชจ์˜ OAuth/๋กœ์ปฌ ์„œ๋ฒ„๋กœ ๊ฒ€์ฆํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‘ CLI ๋ชจ๋‘ ๊ธฐ์กด ๊ตฌ๋… ๋กœ๊ทธ์ธ์œผ๋กœ ์˜์–ดยทํ•œ๊ตญ์–ด ์งˆ๋ฌธ โ†’ ์‹ค์ œ ํŒŒ์ผ ์ฝ๊ธฐ โ†’ ์ฝ”๋“œ ๋งˆ์Šคํ‚น ์ „์†ก โ†’ ์ •์ƒ ๋‹ต๋ณ€ยท์ž๋™ ๋ณต์›๊นŒ์ง€ ๊ฒ€์ฆํ–ˆ์Šต๋‹ˆ๋‹ค. Claude์˜ ์‹๋ณ„ ๋ธ”๋กยท์น˜ํ™˜๋ช… ํ˜ธํ™˜ ์˜ค๋ฅ˜๋ฅผ ์ˆ˜์ •ํ–ˆ์œผ๋ฉฐ, ๊ธฐ์กด 429๋Š” ๊ตฌ๋… ํ•œ๋„ ์†Œ์ง„์ด ์•„๋‹ˆ์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฏธ์ง€ยท์›๊ฒฉ ์ฒจ๋ถ€ยท๋ฏธ์ง€์› ์š”์ฒญ์€ ์ฐจ๋‹จํ•˜๊ณ , ๊ฒŒ์ดํŠธ์›จ์ด ๋ฐ–์˜ ๋„๊ตฌ ๋„คํŠธ์›Œํฌยทํ…”๋ ˆ๋ฉ”ํŠธ๋ฆฌ๊นŒ์ง€ ๋ณดํ˜ธํ•œ๋‹ค๊ณ  ์ฃผ์žฅํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

SecureGateway๋Š” ์˜์–ดยทํ•œ๊ตญ์–ดยทํ˜ผํ•ฉ ๋ฌธ์žฅ์„ ๋กœ์ปฌ์—์„œ ๋งˆ์Šคํ‚นํ•˜๊ณ  ๋ณต์›ํ•ฉ๋‹ˆ๋‹ค. ํด๋ผ์šฐ๋“œ์— ์š”์ฒญํ•˜๊ธฐ ์ „์— LocalPrivacyClient ๋˜๋Š” ๋กœ์ปฌ API/CLI๋กœ ์›๋ฌธ์„ ๊ฐ€๋ฆฌ๊ณ , ์‘๋‹ต์€ ๋กœ์ปฌ์—์„œ๋งŒ ๋ณต์›ํ•˜์„ธ์š”. ๋ชจ๋ธ์ด ํ˜ธ์ถœํ•˜๋Š” MCP ๋„๊ตฌ์˜ ์ธ์ž๋Š” ์ด๋ฏธ ์ œ๊ณต์ž์—๊ฒŒ ์ „๋‹ฌ๋˜์–ด ์žˆ์œผ๋ฏ€๋กœ, Claude Desktop/Cursor์— ์„œ๋ฒ„๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ๋งŒ์œผ๋กœ ๊ฐœ์ธ์ •๋ณด๊ฐ€ ๋ณดํ˜ธ๋˜์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค. ๋ณต์›ํ•œ ์›๋ฌธ์„ ๋ชจ๋ธ ์ปจํ…์ŠคํŠธ์— ๋‹ค์‹œ ๋„ฃ์œผ๋ฉด ์•ˆ ๋ฉ๋‹ˆ๋‹ค. MCP ๋ณต์› ๋„๊ตฌ๋Š” ์ œ๊ฑฐํ–ˆ์œผ๋ฉฐ, ๊ธฐ๋ณธ CLI ์„œ๋ฒ„๋Š” ๋กœ์ปฌ stdio๋งŒ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

์˜์–ด ๋Œ€๋ฌธ์ž ์ด๋ฆ„๊ณผ Unicode ์ด๋ฆ„์„ ํ•˜๋‚˜์˜ ํ† ํฐ์œผ๋กœ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. ํ•œ๊ตญ์–ด ์ด๋ฆ„๊ณผ ์ผ๋ฐ˜ ๋ช…์‚ฌ๊ฐ€ ๊ตฌ๋ถ„๋˜์ง€ ์•Š๋Š” entities_only์—์„œ๋Š” ๋น„๊ธฐ๋Šฅ์–ด๋ฅผ ๋ณด์ˆ˜์ ์œผ๋กœ ๊ฐ€๋ฆฝ๋‹ˆ๋‹ค. ์กฐ์‚ฌ ๋ถ„๋ฆฌ๋Š” ์•Œ๋ ค์ง„ ์–ด๊ฐ„๊ณผ ๋ณด์ˆ˜์ ์ธ ๊ทœ์น™์„ ์‚ฌ์šฉํ•˜๋ฉฐ, ๋ชจํ˜ธํ•œ ๋ฏธ๋“ฑ๋ก ๋‹จ์–ด๋Š” ํ†ต์งธ๋กœ ๊ฐ€๋ฆฝ๋‹ˆ๋‹ค. ๋ชจ๋“  ๊ณ ์œ ๋ช…์‚ฌยท๋น„๋ฐ€๊ฐ’ ๋˜๋Š” ํ•œ๊ตญ์–ด ํ˜•ํƒœ์†Œ๋ฅผ ์™„๋ฒฝํžˆ ์ธ์‹ํ•˜๋Š” ๋„๊ตฌ๋Š” ์•„๋‹™๋‹ˆ๋‹ค. sensitive_terms / --sensitive-term์œผ๋กœ ํŠน์ • ์šฉ์–ด๋ฅผ ์ง€์ •ํ•˜๊ณ , ์•Œ ์ˆ˜ ์—†๋Š” ๋ฏผ๊ฐ์ •๋ณด์—๋Š” ๋” ๋„“์€ ๋งˆ์Šคํ‚น ์ •์ฑ…์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

์ •ํ™•ํ•œ ์™•๋ณต ๋ณต์›์—์„œ๋Š” ์ž…๋ ฅ ์กฐ์‚ฌ๋ฅผ ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋ธ์ด ์ƒˆ๋กœ ๋งŒ๋“  ๋ฌธ์žฅ์—๋Š” normalize_particles=True / --normalize-particles๋ฅผ ์„ ํƒํ•˜์—ฌ ๋ฐ›์นจ์— ๋งž๋Š” ์กฐ์‚ฌ๋ฅผ ๋ณด์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜์–ด ์ด๋ฆ„ยท์•ฝ์–ด์˜ ๋ฐœ์Œ์€ ์ถ”์ธกํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. --strict๋Š” ํƒ์ง€ํ•œ ๋ณ€ํ˜•ยท๋ฏธ๋“ฑ๋ก ํ”Œ๋ ˆ์ด์Šคํ™€๋”์˜ ๋ณต์›์„ ๊ฑฐ๋ถ€ํ•˜์ง€๋งŒ, ๋ชจ๋ธ์ด ์™„์ „ํžˆ ์‚ญ์ œํ•œ ๋‚ด์šฉ์„ ์žฌ๊ตฌ์„ฑํ•˜์ง€๋Š” ๋ชปํ•ฉ๋‹ˆ๋‹ค.

์„ธ์…˜ ์ „๋žต์€ ์ƒ์„ฑ ํ›„ ๊ณ ์ •๋˜๋ฉฐ, ์ค‘๋ณต ID ์ƒ์„ฑ์€ ์˜ค๋ฅ˜์ž…๋‹ˆ๋‹ค. ๋งŒ๋ฃŒ ์„ธ์…˜์€ ์ฃผ๊ธฐ์ ์œผ๋กœ ์ •๋ฆฌํ•˜๊ณ , ์‚ญ์ œ์™€ ์ง„ํ–‰ ์ค‘ ์ž‘์—…์„ ์ž ๊ธˆ์œผ๋กœ ์กฐ์œจํ•ฉ๋‹ˆ๋‹ค. ๋ณ„๋„ CLI ํ”„๋กœ์„ธ์Šค ๊ฐ„ ๋ณต์›์—๋Š” ๋™์ผํ•œ ์•”ํ˜ธํ™” --session-file์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ๋งˆ์Šคํ‚น ๋น„์œจ์€ ํ†ต๊ณ„์ด๋ฉฐ ๊ธฐ๋ฐ€์„ฑยท์ต๋ช…์„ฑยท๊ทœ์ œ ์ค€์ˆ˜์˜ ์ฆ๋ช…์ด ์•„๋‹™๋‹ˆ๋‹ค.


Development

python -m ruff check src tests examples
python -m mypy src
python -m pytest -W error --cov=secure_gateway --cov-report=term-missing --cov-fail-under=85

Documentation

License

Licensed under Apache License 2.0. See LICENSE for details.

Code numeric literals

Code masking preserves numeric literals by default, including their original spelling, base, exponent, separators and suffixes. This keeps indexes, loop bounds and comparison constants useful for code review. Names, strings and comments remain masked. Numeric values inside strings/comments follow their existing literal masking policy; ordinary natural-language number masking and provider protocol controls are unchanged.

To hide sensitive code numbers explicitly:

  • CLI: secure-gateway mask --mode code_aware --mask-numbers ...

  • MCP/Python: pass mask_numbers=True to mask_code, or to mask_text with mode="code_aware" (Python engine/client use MaskMode.CODE_AWARE).

  • Gateway: set "mask_numbers": true in the gateway configuration, or start gateway run --mask-numbers / gateway api-run --mask-numbers. --preserve-numbers overrides a configured opt-in. Both paths default to preservation.

Existing saved numeric aliases still restore. A literal that collides with an existing numeric alias is rejected rather than silently restored to another value; start a fresh session/conversation in that case. Literal numbers in the reserved alias range receive identity mappings so strict restoration and saved sessions remain unambiguous. Switching those particular literals to numeric masking also requires a fresh session. Turning on numeric masking changes values and does not preserve executable behavior.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Enables AI assistants to mask sensitive personal data and project directories before sending to AI, then unmask responses to restore original values using configurable swap sessions.
    7
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables agents to encrypt and sanitize sensitive data such as credentials, credit card numbers, and addresses locally before dispatching prompts to cloud LLMs, then rehydrate the masked values client-side. It runs deterministically with zero external dependencies over MCP JSON-RPC stdio, so no plaintext PII leaves the user's machine.
    7
    -
  • A
    license
    A
    quality
    C
    maintenance
    Enables local, in-memory de-identification of PII, PHI, and credentials with deterministic reversible surrogate tokens before LLM transmission, then restores originals from volatile session mappings and audits for exposures without network egress or disk writes.
    5
    47 npm
    Apache 2.0