pci-dss-compliance
クレジットカード情報を安全に取り扱うためのPCI DSSに準拠し、対象範囲の特定から必要なセキュリティ対策、自己問診(SAQ)の選択までを支援することで、ECサイト構築や決済処理の安全性を高めるSkill。
📜 元の英語説明(参考)
Achieve PCI DSS compliance for handling payment card data — scoping, controls, and SAQ selection. Use when storing, processing, or transmitting payment card data, building e-commerce security, or achieving payment processing compliance.
🇯🇵 日本人クリエイター向け解説
クレジットカード情報を安全に取り扱うためのPCI DSSに準拠し、対象範囲の特定から必要なセキュリティ対策、自己問診(SAQ)の選択までを支援することで、ECサイト構築や決済処理の安全性を高めるSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o pci-dss-compliance.zip https://jpskill.com/download/15240.zip && unzip -o pci-dss-compliance.zip && rm pci-dss-compliance.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15240.zip -OutFile "$d\pci-dss-compliance.zip"; Expand-Archive "$d\pci-dss-compliance.zip" -DestinationPath $d -Force; ri "$d\pci-dss-compliance.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
pci-dss-compliance.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
pci-dss-complianceフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
PCI DSS 準拠
概要
PCI DSS (Payment Card Industry Data Security Standard) v4.0 は、カード会員データ (CHD) を保存、処理、または送信するすべての組織に適用されます。PCI Security Standards Council によって維持されており、6 つの目標にわたる 12 の要件があります。非準拠の場合、5,000~100,000 ドル/月の罰金や、カード処理権限の喪失につながる可能性があります。
主要な用語
- CHD (Cardholder Data): PAN、カード会員名、有効期限、サービスコード
- SAD (Sensitive Authentication Data): フル磁気ストライプ、CVV/CVC、PIN — 認証後に SAD を保存してはいけません
- CDE (Cardholder Data Environment): CHD を保存、処理、または送信するシステム
- PAN (Primary Account Number): 16 桁のカード番号
スコープ: CDE を最小限に抑える
最も効果的なコンプライアンス戦略は、スコープを縮小することです。つまり、CDE 内のシステムの数を最小限に抑えることです。
Stripe/Braintree を使用して CDE を完全に回避する
// ✅ PCI DSS スコープ: SAQ A (最小限)
// カードデータがサーバーに触れることはありません — Stripe.js によって処理されます
import { loadStripe } from '@stripe/stripe-js';
import { Elements, CardElement, useStripe, useElements } from '@stripe/react-stripe-stripe-js';
const stripePromise = loadStripe('pk_live_...');
function PaymentForm() {
const stripe = useStripe();
const elements = useElements();
const handleSubmit = async (event) => {
event.preventDefault();
// カードデータは直接 Stripe に送られます — サーバーには送られません
const { paymentMethod, error } = await stripe.createPaymentMethod({
type: 'card',
card: elements.getElement(CardElement),
});
if (!error) {
// paymentMethod.id のみをサーバーに送信します
await fetch('/api/payments', {
method: 'POST',
body: JSON.stringify({ paymentMethodId: paymentMethod.id, amount: 2999 })
});
}
};
}
# ✅ サーバー側: トークン/支払い方法 ID のみを受信 — カードデータは受信しません
import stripe
stripe.api_key = "sk_live_..."
def charge_customer(payment_method_id: str, amount_cents: int, currency: str = "usd"):
"""トークンを使用して支払いを処理します。CDE はカードデータに触れません。"""
intent = stripe.PaymentIntent.create(
amount=amount_cents,
currency=currency,
payment_method=payment_method_id,
confirm=True,
automatic_payment_methods={"enabled": True, "allow_redirects": "never"}
)
return intent
SAQ 選択ガイド
| SAQ Type | 誰が使用するか | スコープ |
|---|---|---|
| SAQ A | 完全にアウトソースされた支払いページ (Stripe Checkout、PayPal hosted) を使用するカード非提示加盟店 | 最小限 — 約 22 の要件 |
| SAQ A-EP | JS ベースの支払いフォーム (Stripe Elements、Braintree.js) を使用する E コマース | 中程度 — 約 191 の要件 |
| SAQ B | スタンドアロン端末を使用し、電子的な保存を行わない加盟店 | ハードウェア端末 |
| SAQ B-IP | IP 接続された端末を使用する加盟店 | IP 端末 |
| SAQ C | インターネットに接続された支払いアプリを持つ加盟店 | 約 139 の要件 |
| SAQ D | その他すべての加盟店およびサービスプロバイダー | すべての 12 の要件 |
経験則: Stripe Checkout (ホストされたページ) を使用する場合、SAQ A の資格があります。Stripe Elements (Stripe.js を使用したカスタムフォーム) を使用する場合、SAQ A-EP の資格があります。
PCI DSS v4.0 — 12 の要件
Req 1: ネットワークセキュリティコントロール
# ファイアウォールルール — CDE への必要なトラフィックのみを許可します
# デフォルトですべてのトラフィックをブロックし、必要なもののみを許可します
location /api/payments {
allow 10.0.0.0/8; # 内部サービス
deny all;
}
Req 2: 安全な構成
- デプロイ前にすべてのデフォルトパスワードを変更します
- 不要なサービス、プロトコル、デーモンを削除します
- すべてのシステムコンポーネントとその目的を文書化します
Req 3: 保存されたアカウントデータを保護する
# ❌ SAD (CVV、フル磁気ストライプ、PIN) を保存してはいけません
# ❌ 暗号化されていない PAN を保存してはいけません
# ✅ 必要に応じて、マスクされた PAN のみを保存します
def mask_pan(pan: str) -> str:
"""PCI DSS に従って PAN をマスクします — 最初の 6 桁と最後の 4 桁のみを表示します。"""
if len(pan) < 13:
raise ValueError("無効な PAN の長さ")
return pan[:6] + "*" * (len(pan) - 10) + pan[-4:]
# 例: 4111111111111111 → 411111******1111
# ✅ または、代わりに支払い処理業者からのトークンを保存します
# token = "tok_1234567890" — Stripe の保管庫内の実際のカードにマッピングされます
Req 4: 転送中のカード会員データを保護する
import ssl
import requests
# CHD を含むすべての接続には、常に TLS 1.2 以降を使用してください
session = requests.Session()
session.mount('https://', requests.adapters.HTTPAdapter())
# SSL 証明書を検証します — 本番環境では絶対に無効にしないでください
response = session.get(
'https://api.stripe.com/v1/charges',
verify=True, # 本番環境では絶対に False に設定しないでください
headers={'Authorization': f'Bearer {stripe_key}'}
)
Req 5: 悪意のあるソフトウェアからシステムを保護する
- すべてのシステムにウイルス対策/EDR をデプロイします
- ウイルス対策定義を最新の状態に保ちます
- すべてのシステムで定期的なスキャンを実行します
Req 6: 安全なシステムを開発および維持する
# 安全なコーディング — 支払いコンテキストでのインジェクションを防止します
# ❌ カードデータを絶対にログに記録しないでください
import logging
def process_payment(card_number: str, amount: int):
# 間違い: logging.info(f"カード {card_number} を処理しています")
logging.info(f"金額 {amount} の支払いを処理しています") # ✅ ログに CHD はありません
# PAN 形式を検証します (Luhn アルゴリズム)
def luhn_check(pan: str) -> bool:
"""Luhn アルゴリズムで PAN を検証します — 形式検証のみに使用します。"""
digits = [int(d) for d in pan.replace(" ", "").replace("-", "")]
odd_digits = digits[-1::-2]
even_digits = digits[-2::-2]
total = sum(odd_digits)
for d in even_digits:
total += sum(divmod(d * 2, 10))
return total % 10 == 0
Req 7: ビジネスニーズによるアクセスを制限する
# ロールベースのアクセス — 請求/財務ロールのみが支払い記録にアクセスできます
PAYMENT_ACCESS_ROLES = {"billing_admin", "finance_manager", "cfo"}
def require_payment_access(func):
def wrapper(request, *args, **kwargs):
if request.user.role not in PAYMENT_ACCESS_ROLES:
(原文はここで切り詰められています) 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
PCI DSS Compliance
Overview
PCI DSS (Payment Card Industry Data Security Standard) v4.0 applies to any organization that stores, processes, or transmits cardholder data (CHD). Maintained by the PCI Security Standards Council, it has 12 requirements across 6 goals. Non-compliance can result in fines of $5,000–$100,000/month and loss of card processing privileges.
Key Terms
- CHD (Cardholder Data): PAN, cardholder name, expiration date, service code
- SAD (Sensitive Authentication Data): Full magnetic stripe, CVV/CVC, PIN — NEVER store SAD post-authorization
- CDE (Cardholder Data Environment): Systems that store, process, or transmit CHD
- PAN (Primary Account Number): The 16-digit card number
Scoping: Minimize the CDE
The most effective compliance strategy is reducing scope — minimize the number of systems in the CDE.
Use Stripe/Braintree to Avoid CDE Entirely
// ✅ PCI DSS scope: SAQ A (minimal)
// Card data never touches your server — handled by Stripe.js
import { loadStripe } from '@stripe/stripe-js';
import { Elements, CardElement, useStripe, useElements } from '@stripe/react-stripe-js';
const stripePromise = loadStripe('pk_live_...');
function PaymentForm() {
const stripe = useStripe();
const elements = useElements();
const handleSubmit = async (event) => {
event.preventDefault();
// Card data goes directly to Stripe — never to your server
const { paymentMethod, error } = await stripe.createPaymentMethod({
type: 'card',
card: elements.getElement(CardElement),
});
if (!error) {
// Send only paymentMethod.id to your server
await fetch('/api/payments', {
method: 'POST',
body: JSON.stringify({ paymentMethodId: paymentMethod.id, amount: 2999 })
});
}
};
}
# ✅ Server-side: receives only token/payment method ID — not card data
import stripe
stripe.api_key = "sk_live_..."
def charge_customer(payment_method_id: str, amount_cents: int, currency: str = "usd"):
"""Process payment using token. CDE never touches card data."""
intent = stripe.PaymentIntent.create(
amount=amount_cents,
currency=currency,
payment_method=payment_method_id,
confirm=True,
automatic_payment_methods={"enabled": True, "allow_redirects": "never"}
)
return intent
SAQ Selection Guide
| SAQ Type | Who Uses It | Scope |
|---|---|---|
| SAQ A | Card-not-present merchants using fully outsourced payment pages (Stripe Checkout, PayPal hosted) | Minimal — ~22 requirements |
| SAQ A-EP | E-commerce with JS-based payment forms (Stripe Elements, Braintree.js) | Medium — ~191 requirements |
| SAQ B | Merchants using standalone terminals, no electronic storage | Hardware terminals |
| SAQ B-IP | Merchants using IP-connected terminals | IP terminals |
| SAQ C | Merchants with payment app connected to internet | ~139 requirements |
| SAQ D | All other merchants and service providers | All 12 requirements |
Rule of thumb: If you use Stripe Checkout (hosted page), you qualify for SAQ A. If you use Stripe Elements (custom form with Stripe.js), you qualify for SAQ A-EP.
PCI DSS v4.0 — 12 Requirements
Req 1: Network Security Controls
# Firewall rules — only allow necessary traffic to CDE
# Block all traffic by default, allow only what's needed
location /api/payments {
allow 10.0.0.0/8; # Internal services
deny all;
}
Req 2: Secure Configurations
- Change all default passwords before deployment
- Remove unnecessary services, protocols, daemons
- Document all system components and their purpose
Req 3: Protect Stored Account Data
# ❌ NEVER store SAD (CVV, full magnetic stripe, PIN)
# ❌ NEVER store unencrypted PANs
# ✅ Store only masked PAN if needed
def mask_pan(pan: str) -> str:
"""Mask PAN per PCI DSS — show first 6 and last 4 only."""
if len(pan) < 13:
raise ValueError("Invalid PAN length")
return pan[:6] + "*" * (len(pan) - 10) + pan[-4:]
# Example: 4111111111111111 → 411111******1111
# ✅ Or store token from payment processor instead
# token = "tok_1234567890" — maps to real card in Stripe's vault
Req 4: Protect Cardholder Data in Transit
import ssl
import requests
# Always use TLS 1.2+ for any connection involving CHD
session = requests.Session()
session.mount('https://', requests.adapters.HTTPAdapter())
# Verify SSL certificates — never disable in production
response = session.get(
'https://api.stripe.com/v1/charges',
verify=True, # Never set to False in production
headers={'Authorization': f'Bearer {stripe_key}'}
)
Req 5: Protect Systems from Malicious Software
- Deploy antivirus/EDR on all systems
- Keep antivirus definitions current
- Run periodic scans on all systems
Req 6: Develop and Maintain Secure Systems
# Secure coding — prevent injection in payment contexts
# ❌ Never log card data
import logging
def process_payment(card_number: str, amount: int):
# WRONG: logging.info(f"Processing card {card_number}")
logging.info(f"Processing payment for amount {amount}") # ✅ No CHD in logs
# Validate PAN format (Luhn algorithm)
def luhn_check(pan: str) -> bool:
"""Validate PAN with Luhn algorithm — use for format validation only."""
digits = [int(d) for d in pan.replace(" ", "").replace("-", "")]
odd_digits = digits[-1::-2]
even_digits = digits[-2::-2]
total = sum(odd_digits)
for d in even_digits:
total += sum(divmod(d * 2, 10))
return total % 10 == 0
Req 7: Restrict Access by Business Need
# Role-based access — only billing/finance roles access payment records
PAYMENT_ACCESS_ROLES = {"billing_admin", "finance_manager", "cfo"}
def require_payment_access(func):
def wrapper(request, *args, **kwargs):
if request.user.role not in PAYMENT_ACCESS_ROLES:
raise PermissionError("Payment data access denied")
return func(request, *args, **kwargs)
return wrapper
Req 8: Identify Users and Authenticate Access
- Unique user IDs (no shared accounts)
- MFA required for all CDE access
- Passwords: minimum 12 characters, complexity required
- Session lockout after 15 minutes of inactivity
Req 9: Restrict Physical Access
- Visitor log for data center
- Badge access control
- Secure destruction of media containing CHD
Req 10: Log and Monitor All Access
# Log all access to cardholder data
def log_chd_access(user_id, action, last4, amount=None):
"""Compliance log for Req 10 — never log full PAN."""
entry = {
"timestamp": datetime.utcnow().isoformat(),
"user_id": user_id,
"action": action, # "view" | "charge" | "refund"
"card_last4": last4, # ✅ Only last 4 digits
"amount": amount,
"event_type": "chd_access"
}
audit_logger.info(json.dumps(entry))
Log retention: Minimum 12 months, with 3 months immediately available for analysis.
Req 11: Test Security Systems
# Quarterly vulnerability scanning (approved scanning vendor required)
# Annual penetration testing
# Internal scan with nmap
nmap -sV --script vuln -oX vuln-scan-$(date +%Y%m%d).xml 10.0.1.0/24
# Run OWASP ZAP against payment pages
docker run -t owasp/zap2docker-stable zap-baseline.py \
-t https://yoursite.com/checkout \
-r zap-report-$(date +%Y%m%d).html
Req 12: Support Information Security with Policies
- Written information security policy
- Annual risk assessment
- Incident response plan
- Employee security training
Tokenization Architecture
Customer → Stripe.js → Stripe Servers → Token returned to your app
↓
Card data never
touches your server
↓
Your Server → Receives token only → Stores token in DB
↓
Payment needed → Send token to Stripe API → Stripe processes → Result
Compliance Checklist
- [ ] SAQ type selected and validated
- [ ] CDE scoped and documented with network diagram
- [ ] Payment processor BAA/agreement signed
- [ ] No SAD stored post-authorization (no CVV, no full stripe)
- [ ] PANs masked or tokenized in storage
- [ ] Card data never appears in logs
- [ ] TLS 1.2+ enforced on all connections
- [ ] MFA enabled for all CDE access
- [ ] Quarterly vulnerability scans scheduled
- [ ] Annual penetration test planned
- [ ] Incident response plan includes card data breach procedure
- [ ] Log retention: 12 months minimum