Woocommerce Securityのロゴ

Woocommerce Security

組織
wpultimatesecurity
woocommerce-security

プラグインでWooCommerceを拡張し、注文や顧客データの読み書き、またはチェックアウト、REST、Store APIにフックするときに使います。wc_cleanで入力をサニタイズし、edit_shop_ordersなどのWooCommerce権限でショップ操作を制限し、保存する決済データを最小限に抑え、出力時に顧客の個人情報をエスケープします。不適切なアクセス制御や、個人情報・注文データの漏えいを防ぎます。

Add to TypingMind

概要

公開者wpultimatesecurity
リポジトリWordPress-Security-Skills
スキル名woocommerce-security
スター
54
フォーク
3
同梱ファイル
2
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 2個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    wpultimatesecurityがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Woocommerce Security」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/wpultimatesecurity/WordPress-Security-Skills/tree/dev/skills/woocommerce-security
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wpultimatesecurity/WordPress-Security-Skills.git /tmp/WordPress-Security-Skills
mkdir -p .claude/skills
cp -r /tmp/WordPress-Security-Skills/skills/woocommerce-security .claude/skills/woocommerce-security
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでWoocommerce Securityを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にWoocommerce Securityを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Woocommerce Securityは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

WooCommerce security

When to use this skill

Use this skill whenever a plugin or theme extends WooCommerce:

  • Reading or writing orders, products, customers, or coupons via wc_get_order(), WC_Order, WC_Product, or WC_Customer.
  • Hooking checkout, cart, or order-status actions (woocommerce_checkout_*, woocommerce_order_status_*).
  • Adding custom WooCommerce REST or Store API endpoints.
  • Storing or displaying customer PII (names, emails, addresses, phone numbers).
  • Building admin order-meta boxes or custom reports.

WooCommerce has its own capabilities and data objects. Re-using generic WordPress capabilities like edit_posts for orders often grants too much or too little access, and raw customer data is PII that must be handled carefully.

Related: see the user-data-protection-privacy skill for GDPR export/erase hooks and IP anonymization, and the rest-api-security skill for endpoint patterns.

Core principles (and why they matter)

  1. Use WooCommerce capabilities. Orders need edit_shop_orders / edit_others_shop_orders; shop settings need manage_woocommerce. Do not rely on edit_posts or manage_options.
  2. Use WooCommerce CRUD objects and sanitizers. wc_get_order(), wc_clean(), wc_sanitize_textarea(), and WC_Order getters/setters apply WooCommerce-specific validation.
  3. Never store full payment data. PAN, CVV, and raw magnetic-stripe data violate PCI DSS. Use the gateway/token system; store only tokens and last-four digits if required.
  4. Treat customer data as PII. Escape names, emails, addresses, and phones on output; minimize retention; provide export/erase integration.
  5. Validate order ids before acting. A user-supplied order id must correspond to a real order and the current user must be allowed to view/edit it.
  6. REST/Store API endpoints need real permission callbacks. edit_shop_orders or read depending on the operation; never __return_true.

Step-by-step implementation

  1. Load the order/customer with wc_get_order() / wc_get_product() / new WC_Customer().
  2. Verify the user may act on it with current_user_can( 'edit_shop_order', $order_id ) or wc_current_user_has_role( 'shop_manager' ) as appropriate.
  3. Sanitize input with wc_clean(), sanitize_text_field(), absint(), etc.
  4. Use CRUD setters ($order->set_billing_email(...)) rather than raw update_post_meta().
  5. Save with $order->save().
  6. Escape output with esc_html(), esc_attr(), or wp_kses_post().

Supporting references

ReferenceLoad when
WooCommerce security checklistBefore final verification of the woocommerce security controls.
Secure WooCommerce order handlerImplementing authorized order updates through WooCommerce CRUD with sanitized input and escaped customer data.

Common AI mistakes / anti-patterns

Mistake 1 — Exposing orders without edit_shop_orders

php
// ❌ Insecure: subscribers can read any order by id.
$order = wc_get_order( $_GET['order_id'] );
echo $order->get_formatted_billing_full_name();
php
// ✅ Secure: verify the user may edit shop orders (or own the order).
$order_id = isset( $_GET['order_id'] ) ? absint( wp_unslash( $_GET['order_id'] ) ) : 0;
$order    = $order_id ? wc_get_order( $order_id ) : false;

if ( ! $order || ! current_user_can( 'edit_shop_order', $order_id ) ) {
    wp_die( esc_html__( 'Invalid order.', 'my-plugin' ), 403 );
}

echo esc_html( $order->get_formatted_billing_full_name() );

Mistake 2 — Trusting $_POST order ids

php
// ❌ Insecure: any order can be updated by guessing the id.
$order = wc_get_order( $_POST['order_id'] );
$order->set_status( 'completed' );
$order->save();
php
// ✅ Secure: sanitize, load, verify capability, then act.
$order_id = isset( $_POST['order_id'] ) ? absint( wp_unslash( $_POST['order_id'] ) ) : 0;
$order    = $order_id ? wc_get_order( $order_id ) : false;

if ( ! $order || ! current_user_can( 'edit_shop_order', $order_id ) ) {
    wp_die( esc_html__( 'Forbidden.', 'my-plugin' ), 403 );
}

$order->set_status( 'completed' );
$order->save();

Mistake 3 — Storing PAN/CVV in post meta

php
// ❌ Insecure: violates PCI DSS and creates a massive breach risk.
update_post_meta( $order_id, '_card_number', $_POST['card_number'] );
update_post_meta( $order_id, '_card_cvv', $_POST['card_cvv'] );
php
// ✅ Secure: never store full card data; use gateway tokens.
// The gateway handles tokenization; your code stores only a token reference.
$order->update_meta_data( '_my_plugin_token_ref', sanitize_text_field( $token_ref ) );
$order->save();

Mistake 4 — Echoing customer PII unescaped

php
// ❌ Insecure: XSS if the customer name or address contains JavaScript.
echo '<p>' . $order->get_billing_email() . '</p>';
php
// ✅ Secure: escape on output.
echo '<p>' . esc_html( $order->get_billing_email() ) . '</p>';

Mistake 5 — Custom Store API route with open permissions

php
// ❌ Insecure: anyone can read order data.
register_rest_route( 'wc/store/v1', '/my-orders', array(
    'methods'  => 'GET',
    'callback' => 'my_plugin_store_orders',
    'permission_callback' => '__return_true',
) );
php
// ✅ Secure: require a real capability.
register_rest_route(
    'wc/store/v1',
    '/my-orders',
    array(
        'methods'             => 'GET',
        'callback'            => 'my_plugin_store_orders',
        'permission_callback' => function () {
            return current_user_can( 'edit_shop_orders' );
        },
    )
);

Correct code examples

A complete secure WooCommerce order-meta update handler is in references/secure-woocommerce-order.php.

Checklist

  • Order/customer actions use WooCommerce capabilities (edit_shop_orders, manage_woocommerce).
  • Order ids are cast to integers and validated with wc_get_order().
  • Input is sanitized with wc_clean() / sanitize_text_field() / absint().
  • CRUD objects (WC_Order, WC_Product, WC_Customer) are used instead of raw meta.
  • No full card numbers, CVV, or magnetic-stripe data are stored.
  • Customer PII is escaped on output.
  • Custom WooCommerce REST/Store API routes have real permission_callback handlers.
  • GDPR export/erase hooks are wired for custom customer data.
  • Logs and exports anonymize or redact PII.

Official references

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Woocommerce Security」では何ができますか?

プラグインでWooCommerceを拡張し、注文や顧客データの読み書き、またはチェックアウト、REST、Store APIにフックするときに使います。wc_cleanで入力をサニタイズし、edit_shop_ordersなどのWooCommerce権限でショップ操作を制限し、保存する決済データを最小限に抑え、出力時に顧客の個人情報をエスケープします。不適切なアクセス制御や、個人情報・注文データの漏えいを防ぎます。

TypingMindでWoocommerce Securityを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Woocommerce Securityはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにWoocommerce Securityをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/wpultimatesecurity/WordPress-Security-Skills/tree/dev/skills/woocommerce-securityを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Woocommerce Securityを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Woocommerce Securityで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもWoocommerce Securityを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Woocommerce Security」は無料ですか?

はい。wpultimatesecurityがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇