# JetBrainsプラグイン

## 概要

JetBrains IDEは、世界中の開発者に広く利用されている強力な統合開発環境で、さまざまなプログラミング言語やフレームワークでのアプリケーション開発に活用されています。Java、Python、JavaScriptなど、どの対応言語で開発する場合でも、コーディングからデバッグ、デプロイまでを包括的に支援する機能を備えています。

Keeper Securityプラグインを導入すると、JetBrains IDE上でKeeperボルトと連携できるようになり、開発ワークフローにおけるシークレット管理をより簡単かつ安全に行えます。このプラグインを利用することで、開発者はハードコードされたシークレットをボルト参照に置き換え、機密情報を明らかにすることなく、認証情報を注入したコマンドを実行できます。

## 機能

* **シークレット管理**: JetBrains IDEからKeeperボルトを使用してシークレットの保存・取得・生成が可能
* **安全な実行**: .envファイルを処理し、Keeperボルトから注入されたシークレットを使用してコマンドを実行
* **フォルダ管理**: Keeperボルトフォルダを選択・管理し、シークレットを整理して保存
* **レコード操作**: 新しいレコードの作成、既存レコードの更新、フィールド参照の取得
* **クロスプラットフォーム対応**: Windows、macOS、Linux

## 要件

* **KeeperコマンダーCLI**
  * システムにインストールおよび認証されている必要があります
  * [Keeperコマンダーインストール手順](/jp/keeperpam/commander-cli/commander-installation-setup.md)を参照の上ダウンロード
  * [永続ログイン](/jp/keeperpam/commander-cli/commander-installation-setup/logging-in.md#persistent-login-sessions-stay-logged-in)または[生体認証ログイン](/jp/keeperpam/commander-cli/commander-installation-setup/logging-in.md#logging-in-with-biometric-authentication)で認証
* **Keeper Securityアカウント**: ボルトアクセスを含む有効なサブスクリプション

## システム要件

* **JetBrains IDE**: バージョン2021.1以降 (IntelliJ IDEA、PyCharm、WebStorm、PhpStorm、RubyMine、CLion、GoLand対応)
* **Java**: バージョン11以降
* **Python**: バージョン3.6以降 (KeeperコマンダーCLIに必要)

## セットアップ

### **インストール (JetBrains Marketplaceを使用)**

1. JetBrains IDEを開く
2. **\[File]** → **\[Settings]** → **\[Plugins]** (macOSの場合は **\[IntelliJ IDEA]** → **\[Preferences]** → **\[Plugins]**)
3. 「Keeper Security」を検索
4. **\[Install]** をクリックしてIDEを再起動

## 認証

KeeperコマンダーCLIを通じて、次の2つの方法で認証を行えます。

1. 生体認証ログイン

```
# Keeperにログイン
keeper shell

# 生体認証を登録
biometric register

# 指示に従って生体認証を設定
```

2. 永続ログイン

```
# Keeperにログイン
keeper shell

# デバイスを永続ログイン用に登録
this-device register

# 永続ログインを有効化
this-device persistent-login on

# 設定を確認
this-device
```

### プラグイン認証の確認

1. 任意のJetBrains IDEを開く
2. **\[Tools]** → **\[Keeper Vault]** → **\[Check Keeper Authorization]**
3. 認証ステータスが「成功」と表示されることを確認

## 使用方法

すべてのKeeper操作は次の方法で利用できます。

* メインメニュー: **\[Tools]** → **\[Keeper Vault]** → **\[Action]**
* コンテキストメニュー: エディタ内で右クリック → **\[Action]**

### 使用できるコマンド

| コマンド                           | 説明                                   | 使用例・目的                        |
| ------------------------------ | ------------------------------------ | ----------------------------- |
| **Check Keeper Authorization** | Keeper CLIのインストールと認証状態を確認します         | 接続問題のトラブルシューティングや設定確認に使用      |
| **Get Keeper Secret**          | ボルト内の既存シークレットを参照として挿入します             | 保存済みシークレットを値を表示せずに取得          |
| **Add Keeper Record**          | 選択したテキストをボルト内のシークレットとして保存し、参照に置き換えます | ハードコードされたシークレットをKeeper参照に置き換え |
| **Update Keeper Record**       | 選択したテキストで既存のボルトレコードを更新します            | 参照を維持したまま既存シークレットの内容を更新       |
| **Generate Keeper Secret**     | 安全なパスワードを生成してボルトに保存します               | 新しい安全な認証情報を自動で作成              |
| **Get Keeper Folder**          | 新規レコードを整理するためのボルトフォルダを選択します          | 特定のフォルダにシークレットを整理して保存         |
| **Run Keeper Securely**        | `.env` ファイルからシークレットを注入してコマンドを実行します   | 実行時にボルトシークレットを利用してアプリを安全に実行   |

## 基本的なシークレット管理

1. 既存シークレットの取得

```
# シークレット参照を挿入したい位置にカーソルを置く
database_password = |

# 使用手順: Tools → Keeper Vault → Get Keeper Secret
# ボルトからレコードとフィールドを選択
# 実行結果:
database_password = keeper://abc123def456/field/password
```

2. 新規シークレットの追加

```
// シークレット文字列を選択
const apiKey = "sk-1234567890abcdef";

// 使用: 右クリック → Add Keeper Record
// タイトルとフィールド名を入力
// 結果:
const apiKey = keeper://new-record-uid/field/api_key;
```

3. 安全なパスワードの生成

```
# カーソルを置く
admin_password: |

# 使用: Tools → Keeper Vault → Generate Keeper Secret
# レコード情報を入力
# 結果:
admin_password: keeper://generated-record-uid/field/password
```

***

## セキュアコマンド実行

#### 環境ファイル設定

`.env` ファイルにKeeper参照を含めます。

```
DATABASE_URL=keeper://db-record-uid/field/connection_string
API_KEY=keeper://api-record-uid/field/key
SECRET_KEY=keeper://app-record-uid/field/secret
JWT_SECRET=keeper://auth-record-uid/field/jwt_key
```

**シークレットを注入してコマンドを実行**

1. プロジェクト内で右クリック → **\[Run Keeper Securely]**
2. `.env` ファイルを選択または確認
3. 実行するコマンドを入力 (例: `python3 app.py`)
4. プラグインがシークレットを取得し、環境変数を注入したターミナルを生成

```bash
# プラグインは実際の値を使用してコマンドを実行します
python3 app.py
# 環境変数の内容
# DATABASE_URL=postgresql://user:pass@host:5432/db
# API_KEY=ak_live_1234567890abcdef
# SECRET_KEY=super-secret-key-value
# JWT_SECRET=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
```

## **完全なワークフローの例**

```
# 1. ハードコードされたシークレットを使用した状態 (非推奨)
import os
import requests

DB_PASSWORD = "hardcoded_password_123"
API_TOKEN = "secret_api_token_xyz"

# 2. ボルト参照に置き換え
# 使用方法: 各シークレットに対して Add Keeper Record を実行
DB_PASSWORD = keeper://db-creds-uid/field/password
API_TOKEN = keeper://api-creds-uid/field/token

# 3. 安全な実行用に .env ファイルを作成
# .env の内容
# DB_PASSWORD=keeper://db-creds-uid/field/password
# API_TOKEN=keeper://api-creds-uid/field/token

# 4. アプリケーションを安全に実行
# 使用方法: Run Keeper Securely で "python3 my_app.py" を実行

```

## アクションリファレンス

#### Check Keeper Authorization

Keeper CLIのインストールおよび認証状態を確認します。

**使用方法**: **\[Tools]** → **\[Keeper Vault]** → **\[Check Keeper Authorization]**

**目的**: 接続の問題をトラブルシューティングし、設定を確認する

#### Get Keeper Secret

ボルト内の既存シークレットを参照として取得します。

**使用方法**: カーソルを合わせてから **\[Tools]** → **\[Keeper Vault]** → **\[Get Keeper Secret]**

**プロパティ**

* **入力**: エディタ内のカーソル位置
* **出力**: カーソル位置にKeeper参照を挿入
* **形式**: `keeper://record-uid/field/field-name`

#### Add Keeper Record

選択したテキストから新しいボルトレコードを作成し、参照に置き換えます。

**使用方法**: テキストを選択し、右クリック → **\[Add Keeper Record]**

**プロパティ**

* **入力**: シークレットを含む選択テキスト
* **出力**: 選択テキストをKeeper参照に置き換え
* **入力項目**: レコードタイトル、フィールド名

#### Update Keeper Record

選択したテキストを使用して既存のボルトレコードを更新します。

**使用方法**: テキストを選択し、右クリック → **\[Update Keeper Record]**

**プロパティ**

* **入力**: 更新後のシークレットを含む選択テキスト
* **出力**: テキストを既存のレコード参照に置き換え
* **選択**: 更新対象のレコードとフィールドを選択

#### Generate Keeper Secret

安全なパスワードを生成してボルトに保存します。

**使用方法**: カーソルを合わせてから **\[Tools]** → **\[Keeper Vault]** → **\[Generate Keeper Secret]**

**プロパティ**

* **入力**: カーソル位置
* **出力**: 生成された安全なパスワード参照
* **設定**: 強力なパスワードを自動生成

#### Get Keeper Folder

新しいレコードを整理するためのボルトフォルダを選択します。

**使用方法**: **\[Tools]** → **\[Keeper Vault]** → **\[Get Keeper Folder]**

**プロパティ**

* **目的**: 新規レコードのデフォルト保存先フォルダを設定
* **適用範囲**: 現在のワークスペースまたはプロジェクト
* **永続性**: 選択内容はIDEセッション間で保持されます

#### Run Keeper Securely

`.env` ファイルからシークレットを注入してコマンドを実行します。

**使用方法**: プロジェクト内で右クリック → **\[Run Keeper Securely]**

**ngプロパティ**

* **入力**: Keeper参照を含む `.env` ファイル
* **処理内容**: ボルトから実際のシークレット値を取得
* **出力**: 環境変数が注入されたターミナル
* **セキュリティ**: IDEやファイルシステム上でシークレット値を表示しません

***

## 対応プラットフォーム

* **Linux**: Ubuntu 18.04+、CentOS 7+、RHEL 7+、Debian 9+、Fedora 30+
* **macOS**: 10.14以降 (Mojave以上)
* **Windows**: Windows 10+、Windows Server 2016+

***

### 要件

**JetBrains IDE**

* IntelliJ IDEA 2021.1+
* PyCharm 2021.1+
* WebStorm 2021.1+
* PhpStorm 2021.1+
* RubyMine 2021.1+
* CLion 2021.1+
* GoLand 2021.1+
* DataGrip 2021.1+
* Rider 2021.1+

### 依存関係

* Java Runtime: 11以上 (JetBrains IDEに含まれる)
* Python: 3.6以上 (KeeperコマンダーCLI用)
* pip: 最新バージョン (CLIインストール用)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/jp/keeperpam/secrets-manager/integrations/jetbrains-plugin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
