← 返回
安全合规 中文

Keychain Access

macOS Keychain helpers (list/get/set/delete) via the security CLI. Trigger this skill when the user needs to inspect, store, update, or remove generic passwo...
通过 security 命令行工具操作 macOS 钥匙串,支持列出、获取、设置和删除通用密码条目。
ppopen
安全合规 clawhub v1.0.0 1 版本 99833.6 Key: 无需
★ 0
Stars
📥 600
下载
💾 5
安装
1
版本
#latest

概述

Keychain Access Skill

Manage macOS Keychain items in a safe, scriptable way. Use the bundled keychain-access/keychain-access.sh helper for all operations: it wraps security calls, enforces confirmations for updates and deletions, masks secrets unless explicitly requested, and supports dry-run previews.

Safety Constraints

  • Never print secrets unless the user explicitly asks to reveal them (--raw). Routine get calls only report metadata with the password hidden.
  • Ask the user to confirm before modifying or deleting existing entries. The script prompts by default and accepts --yes to skip the prompt for automation.
  • Support a --dry-run mode so agents can preview the security command without touching the Keychain.
  • Supply secrets via --password-stdin, --password-env, or the hidden interactive prompt. The legacy --password option leaves values in shell history and process listings (the helper warns when it's used), so prefer the safer inputs; --password-env VAR reads the var and unsets it immediately to keep the secret out of the environment.
  • Operate on a specific keychain when provided (--keychain); otherwise, the default search list is used. Avoid leaking system passwords by defaulting to explicit service/account filters.

Supported Operations

  1. list – Summaries of matching entries.

```bash

./skills/keychain-access/keychain-access.sh list \

[--keychain /path/to/keychain] [--service NAME] [--account NAME]

```

  • Scans the chosen keychain via security dump-keychain and prints service/account/label rows.
  • Filters can target a specific service or account (substring match).
  • Use --dry-run to review the security dump-keychain invocation without running it.
  1. get – Display metadata for a generic password.

```bash

./skills/keychain-access/keychain-access.sh get \

--service SERVICE --account ACCOUNT [--keychain PATH] [--raw] [--dry-run]

```

  • Requires both --service and --account to avoid ambiguity.
  • Password output is masked by default; add --raw only when the user explicitly needs the secret value.
  • Returns command diagnostics even if the password is hidden (e.g., matching record, keychain path).
  • Use --dry-run to review the security find-generic-password invocation without reaching into the keychain.
  1. set – Create or update a generic password entry.

```bash

printf '' | ./skills/keychain-access/keychain-access.sh set --service SERVICE --account ACCOUNT --password-stdin [--keychain PATH] [--yes] [--dry-run]

```

  • Supply the password via --password-stdin, --password-env VAR, or the hidden interactive prompt that runs when stdin is a terminal and no source is provided. The legacy --password flag still works but is insecure because its value appears in shell history and process listings, so the helper prints a warning if it is used.
  • --password-env VAR reads the named env var, unsets it immediately after reading, and keeps the secret out of the command line and environment dumps.
  • When a matching service/account already exists, the helper announces the pending update and prompts for confirmation before overwriting (use --yes to skip the prompt once you have authorized the change).
  • --dry-run prints the security add-generic-password ... invocation with the password redacted and exits before checking for an existing entry or prompting.
  1. delete – Remove a matching generic password.

```bash

./skills/keychain-access/keychain-access.sh delete \

--service SERVICE --account ACCOUNT [--keychain PATH] [--yes] [--dry-run]

```

  • Always prompts before deletion; --yes bypasses the prompt if the user already authorized removing the credential.
  • The helper verifies the entry exists before asking for confirmation.
  • Combine with --dry-run to preview the security delete-generic-password invocation while keeping the keychain untouched; the helper exits before verifying the entry or prompting.

Request Examples

  • "Store a new API token for terraform under account ci-bot." → run set for that service/account, pipe into --password-stdin (or set TERRAFORM_TOKEN and pass --password-env TERRAFORM_TOKEN), then confirm the update if prompted.
  • "Show everything stored for smtp credentials." → run list --service smtp and then get with --raw only if the user explicitly needs to read the password.
  • "Rotate the password for deploy-bot and remove the old entry." → use set with --service deploy and --account deploy-bot, supply the new secret through one of the safe input options, allow the helper to prompt for confirmation, then delete the old credential with confirmation when the rotation is complete.
  • "Preview the delete command for the app key without running it." → use delete --service app-key --account release-bot --dry-run.

Testing Transcript (safe context)

# Prepare a disposable keychain (password = <KEYCHAIN_PASSWORD>)
security create-keychain -p <KEYCHAIN_PASSWORD> /tmp/keychain-access-test.keychain
security unlock-keychain -p <KEYCHAIN_PASSWORD> /tmp/keychain-access-test.keychain

# 1) List entries (empty keychain)
./skills/keychain-access/keychain-access.sh list   --keychain /tmp/keychain-access-test.keychain
# Output:
No matching entries found.

# 2) Set a credential (confirms before update)
printf '<SERVICE_SECRET>' | ./skills/keychain-access/keychain-access.sh set   --service test-service --account test-user   --password-stdin --keychain /tmp/keychain-access-test.keychain --yes
# Output:
Stored credential for 'test-service' / 'test-user'.

# 3) Get the credential (masked by default, raw only when asked)
./skills/keychain-access/keychain-access.sh get   --service test-service --account test-user   --keychain /tmp/keychain-access-test.keychain --raw
# Output:
password: "<SERVICE_SECRET>"
keychain: "/private/tmp/keychain-access-test.keychain"
version: 256
class: "genp"
attributes:
    0x00000007 <blob>="test-service"
    0x00000008 <blob>=<NULL>
    "acct"<blob>="test-user"
    ... (remaining metadata omitted for brevity)

# 4) Delete the credential (prompts confirmation)
./skills/keychain-access/keychain-access.sh delete   --service test-service --account test-user   --keychain /tmp/keychain-access-test.keychain --yes
# Output:
Deleted credential for 'test-service' / 'test-user'.

# Cleanup
security delete-keychain /tmp/keychain-access-test.keychain

Include this transcript in reports so the main agent knows the commands and their expected output shape.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 23:09 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,212 📥 266,360
productivity

Cron Scheduler

ppopen
管理 macOS/Linux 的 cron 任务——列出、添加、移除、备份及调度定时任务。
★ 0 📥 1,482
security-compliance

OpenClaw Backup

alex3alex
备份与恢复 OpenClaw 数据。适用于创建备份、设置自动备份计划、从备份恢复或管理备份轮转。处理 ~/.openclaw 目录归档并包含适当的排除规则。
★ 89 📥 30,599