{"name":"secure-credential-setup","title":"Secure credential setup","description":"Get an API key, token or password into a secret store without the value ever appearing in the transcript: one credential at a time, one exact copy-pasteable terminal command for the user to run, then verification that it authenticates without printing it. Symptoms: where do I put this key, set up my API token, add it to .env / the keychain / the secret manager, here's my key (don't paste it back), the tool says unauthorized and no credential is configured.","compatibility":"macOS, Linux, or Windows with an approved secret store and a harmless provider authentication endpoint for verification.","allowedTools":"Read Grep Glob Bash","license":"MIT","kind":"signals","useWhen":"placing an API key, token or other credential this project needs","group":"workflow","lifecycle":"release","version":"1.0.0","author":"crissmoldovan","install":["npx skills add crissmoldovan/agent-skills --skill secure-credential-setup"],"asks":["Set up the API key for this workspace safely. Give me one exact terminal command,\nnever ask for the key in chat, wait for me to place it, then verify authentication\nwithout printing any secret metadata.","Configure two workspace credentials. Request them one at a time, store them under\nseparate neutral profiles, verify each before asking for the next, and require an\nexplicit profile in runtime code."],"commands":[],"documents":[{"path":"references/terminal-entry-patterns.md","slug":"terminal-entry-patterns","title":"Safe terminal entry patterns","body":"# Safe terminal entry patterns\n\n## Two-stage interaction\n\nThe user first pastes a command into an ordinary shell prompt. The command then\nprints a profile-specific prompt and disables terminal echo. Only after that\nprompt appears does the user paste the secret.\n\nAlways state the sequence explicitly:\n\n1. Paste the command once and press Enter.\n2. Wait until `Paste the <PROFILE> key` appears.\n3. Paste only the key and press Enter.\n4. Confirm the non-secret success sentence.\n\nThis avoids storing the setup command itself as the secret.\n\n## macOS Keychain\n\nUse a distinct service per workspace:\n\n```text\n<provider>-api-key-<profile>\n```\n\nWrite/update:\n\n```bash\ntrap 'stty echo' INT TERM EXIT; printf \"Paste the <PROFILE> API key, then press Enter: \"; stty -echo; IFS= read -r API_KEY; stty echo; trap - INT TERM EXIT; printf '\\n'; security add-generic-password -U -a \"$USER\" -s \"<provider>-api-key-<profile>\" -w \"$API_KEY\" >/dev/null; unset API_KEY; echo \"<PROFILE> key saved in macOS Keychain.\"\n```\n\nPresence check:\n\n```bash\nsecurity find-generic-password -a \"$USER\" -s \"<provider>-api-key-<profile>\" >/dev/null 2>&1\n```\n\nRetrieve only inside the consuming helper or command. Do not export globally or\nprint it.\n\n## Environment profiles\n\nFor CI, containers, or approved non-macOS secret injection:\n\n```text\n<PROVIDER>_API_KEY_<PROFILE>\n```\n\nCode must require a validated explicit profile and map it to one variable. It\nmust not try another profile as fallback.\n\n## Linux and Windows\n\nOn Linux, use `secret-tool` only when libsecret and an unlocked Secret Service\nare available:\n\n```bash\ntrap 'stty echo' INT TERM EXIT; printf \"Paste the <PROFILE> API key, then press Enter: \"; stty -echo; IFS= read -r API_KEY; stty echo; trap - INT TERM EXIT; printf '\\n'; printf %s \"$API_KEY\" | secret-tool store --label=\"<PROVIDER> <PROFILE> API key\" provider \"<provider>\" profile \"<profile>\" >/dev/null; unset API_KEY; echo \"<PROFILE> key saved in Secret Service.\"\n```\n\nPresence check without returning the value:\n\n```bash\nsecret-tool lookup provider \"<provider>\" profile \"<profile>\" >/dev/null 2>&1\n```\n\nIf no OS secret store is available, do **not** improvise a plaintext `.env`\nfallback. Ask the user which approved store to use. On Windows use Credential\nManager or an approved enterprise secret store; if no supported CLI is known,\nask rather than inventing a command.\n\nOn macOS, note that `security -w \"$API_KEY\"` briefly places the expanded value\nin the Keychain CLI process arguments. If another local user can inspect process\narguments in the threat model, use an approved native or enterprise secret-store\nUI instead of the CLI pattern.\n\n## Safe verification\n\nReport only:\n\n- destination absent/present;\n- provider HTTP status and documented non-secret error code/message;\n- selected workspace/profile;\n- whether authentication succeeded.\n\nNever print secret value, prefix, suffix, length, hash, encoded value, or a raw\nresponse that might echo credentials. If placement looks malformed, overwrite\nthe named entry instead of inspecting it.\n","bodyHtml":"<h2 id=\"safe-terminal-entry-patterns\">Safe terminal entry patterns</h2>\n<h3 id=\"two-stage-interaction\">Two-stage interaction</h3>\n<p>The user first pastes a command into an ordinary shell prompt. The command then\nprints a profile-specific prompt and disables terminal echo. Only after that\nprompt appears does the user paste the secret.</p>\n<p>Always state the sequence explicitly:</p>\n<ol>\n<li>Paste the command once and press Enter.</li>\n<li>Wait until <code>Paste the &lt;PROFILE&gt; key</code> appears.</li>\n<li>Paste only the key and press Enter.</li>\n<li>Confirm the non-secret success sentence.</li>\n</ol>\n<p>This avoids storing the setup command itself as the secret.</p>\n<h3 id=\"macos-keychain\">macOS Keychain</h3>\n<p>Use a distinct service per workspace:</p>\n<pre><code class=\"language-text\">&lt;provider&gt;-api-key-&lt;profile&gt;\n</code></pre>\n<p>Write/update:</p>\n<pre><code class=\"language-bash\">trap &#39;stty echo&#39; INT TERM EXIT; printf &quot;Paste the &lt;PROFILE&gt; API key, then press Enter: &quot;; stty -echo; IFS= read -r API_KEY; stty echo; trap - INT TERM EXIT; printf &#39;\\n&#39;; security add-generic-password -U -a &quot;$USER&quot; -s &quot;&lt;provider&gt;-api-key-&lt;profile&gt;&quot; -w &quot;$API_KEY&quot; &gt;/dev/null; unset API_KEY; echo &quot;&lt;PROFILE&gt; key saved in macOS Keychain.&quot;\n</code></pre>\n<p>Presence check:</p>\n<pre><code class=\"language-bash\">security find-generic-password -a &quot;$USER&quot; -s &quot;&lt;provider&gt;-api-key-&lt;profile&gt;&quot; &gt;/dev/null 2&gt;&amp;1\n</code></pre>\n<p>Retrieve only inside the consuming helper or command. Do not export globally or\nprint it.</p>\n<h3 id=\"environment-profiles\">Environment profiles</h3>\n<p>For CI, containers, or approved non-macOS secret injection:</p>\n<pre><code class=\"language-text\">&lt;PROVIDER&gt;_API_KEY_&lt;PROFILE&gt;\n</code></pre>\n<p>Code must require a validated explicit profile and map it to one variable. It\nmust not try another profile as fallback.</p>\n<h3 id=\"linux-and-windows\">Linux and Windows</h3>\n<p>On Linux, use <code>secret-tool</code> only when libsecret and an unlocked Secret Service\nare available:</p>\n<pre><code class=\"language-bash\">trap &#39;stty echo&#39; INT TERM EXIT; printf &quot;Paste the &lt;PROFILE&gt; API key, then press Enter: &quot;; stty -echo; IFS= read -r API_KEY; stty echo; trap - INT TERM EXIT; printf &#39;\\n&#39;; printf %s &quot;$API_KEY&quot; | secret-tool store --label=&quot;&lt;PROVIDER&gt; &lt;PROFILE&gt; API key&quot; provider &quot;&lt;provider&gt;&quot; profile &quot;&lt;profile&gt;&quot; &gt;/dev/null; unset API_KEY; echo &quot;&lt;PROFILE&gt; key saved in Secret Service.&quot;\n</code></pre>\n<p>Presence check without returning the value:</p>\n<pre><code class=\"language-bash\">secret-tool lookup provider &quot;&lt;provider&gt;&quot; profile &quot;&lt;profile&gt;&quot; &gt;/dev/null 2&gt;&amp;1\n</code></pre>\n<p>If no OS secret store is available, do <strong>not</strong> improvise a plaintext <code>.env</code>\nfallback. Ask the user which approved store to use. On Windows use Credential\nManager or an approved enterprise secret store; if no supported CLI is known,\nask rather than inventing a command.</p>\n<p>On macOS, note that <code>security -w &quot;$API_KEY&quot;</code> briefly places the expanded value\nin the Keychain CLI process arguments. If another local user can inspect process\narguments in the threat model, use an approved native or enterprise secret-store\nUI instead of the CLI pattern.</p>\n<h3 id=\"safe-verification\">Safe verification</h3>\n<p>Report only:</p>\n<ul>\n<li>destination absent/present;</li>\n<li>provider HTTP status and documented non-secret error code/message;</li>\n<li>selected workspace/profile;</li>\n<li>whether authentication succeeded.</li>\n</ul>\n<p>Never print secret value, prefix, suffix, length, hash, encoded value, or a raw\nresponse that might echo credentials. If placement looks malformed, overwrite\nthe named entry instead of inspecting it.</p>\n","words":446}],"body":"# Secure credential setup\n\nPlace API keys, tokens, and other secrets without asking the user to paste values\ninto chat. Request one credential at a time, give one exact terminal placement\ncommand, wait for completion, then verify presence and authentication without\nprinting the secret. The domain skill decides which credential and harmless API\nprobe are required; this skill owns safe placement mechanics.\n\n## When to Use\n\n- A task needs an API key, token, password, or workspace-specific credential.\n- Several accounts/workspaces require distinct credentials.\n- The user asks where to put a secret or wants a copy-pasteable command.\n- A previous setup may have stored the command or placeholder as the secret.\n\nNever request a secret in chat. Do not use this workflow to transmit credentials\nto another person, rotate/revoke keys, or scrape credentials from disk.\n\nRead [safe terminal entry patterns](references/terminal-entry-patterns.md) before\ncomposing a placement command.\n\n## Procedure\n\n1. **Identify scope first.** Name the provider, account/workspace, purpose, and\n   exact destination. Use a neutral profile identifier; never let two trust\n   boundaries share an ambiguous key.\n2. **Ask for one credential only.** Do not batch multiple secret prompts.\n3. **Give one complete command.** It must start from the normal shell prompt,\n   request hidden input after launch, write/update one named secret-store entry,\n   unset temporary state, and print only a non-secret success sentence.\n4. **Explain the two stages.** Say explicitly: paste the command once and press\n   Enter; wait for its prompt; then paste only the secret and press Enter.\n5. **Wait for confirmation.** Do not provide the next credential command yet.\n6. **Verify without disclosure.** Check entry presence and a harmless provider\n   authentication endpoint. Never print value, prefix, suffix, length, hash, or\n   encoded form.\n7. **Diagnose safely.** Distinguish absent entry, malformed placement, wrong\n   workspace, expired/revoked key, and insufficient scope. Overwrite a malformed\n   entry; do not log or inspect its value.\n8. **Repeat one profile at a time.** Each trust boundary gets a distinct variable\n   or secret-store service.\n9. **Require explicit profile selection.** Runtime code must not fall back from\n   one workspace's credential to another.\n\n## macOS Keychain\n\n```bash\ntrap 'stty echo' INT TERM EXIT; printf \"Paste the <PROFILE> API key, then press Enter: \"; stty -echo; IFS= read -r API_KEY; stty echo; trap - INT TERM EXIT; printf '\\n'; security add-generic-password -U -a \"$USER\" -s \"<provider>-api-key-<profile>\" -w \"$API_KEY\" >/dev/null; unset API_KEY; echo \"<PROFILE> key saved in macOS Keychain.\"\n```\n\nPresence check only:\n\n```bash\nsecurity find-generic-password -a \"$USER\" -s \"<provider>-api-key-<profile>\" >/dev/null 2>&1\n```\n\nUse the consuming provider's harmless authenticated read to prove validity.\nPresence alone is not success.\n\n## Usage Examples\n\n```text\nSet up the API key for this workspace safely. Give me one exact terminal command,\nnever ask for the key in chat, wait for me to place it, then verify authentication\nwithout printing any secret metadata.\n```\n\n```text\nConfigure two workspace credentials. Request them one at a time, store them under\nseparate neutral profiles, verify each before asking for the next, and require an\nexplicit profile in runtime code.\n```\n\n## Pitfalls\n\n- **Command stored as secret:** explain the two-stage paste before the command.\n- **Placeholder stored as secret:** never ask users to edit `***` inside a command.\n- **Shell history leakage:** never put a literal secret in command arguments.\n- **Presence mistaken for validity:** always run a harmless auth probe.\n- **Leaky diagnostics:** never print prefixes, lengths, hashes, or raw bodies that\n  might echo request credentials.\n- **Process-list exposure on macOS:** `security -w \"$API_KEY\"` briefly passes the\n  value to the Keychain CLI. State this limitation where other local users can\n  inspect process arguments; use an approved native/enterprise secret-store UI\n  instead when that threat model applies.\n- **Cross-workspace fallback:** authentication success does not prove the chosen\n  workspace is intended.\n- **Batching:** request and verify one credential before discussing the next.\n\n## Verification\n\n- [ ] Secret never appeared in chat, arguments, source, logs, or clipboard output.\n- [ ] Destination identifies the intended provider/profile/trust boundary.\n- [ ] User received one exact command at a time and understood the two stages.\n- [ ] Presence check emitted no secret data.\n- [ ] Harmless live authentication succeeded for each profile.\n- [ ] Runtime selection requires an explicit profile when multiple keys exist.\n- [ ] Temporary shell state was unset.\n","bodyHtml":"<h2 id=\"secure-credential-setup\">Secure credential setup</h2>\n<p>Place API keys, tokens, and other secrets without asking the user to paste values\ninto chat. Request one credential at a time, give one exact terminal placement\ncommand, wait for completion, then verify presence and authentication without\nprinting the secret. The domain skill decides which credential and harmless API\nprobe are required; this skill owns safe placement mechanics.</p>\n<h3 id=\"when-to-use\">When to Use</h3>\n<ul>\n<li>A task needs an API key, token, password, or workspace-specific credential.</li>\n<li>Several accounts/workspaces require distinct credentials.</li>\n<li>The user asks where to put a secret or wants a copy-pasteable command.</li>\n<li>A previous setup may have stored the command or placeholder as the secret.</li>\n</ul>\n<p>Never request a secret in chat. Do not use this workflow to transmit credentials\nto another person, rotate/revoke keys, or scrape credentials from disk.</p>\n<p>Read <a href=\"references/terminal-entry-patterns.md\">safe terminal entry patterns</a> before\ncomposing a placement command.</p>\n<h3 id=\"procedure\">Procedure</h3>\n<ol>\n<li><strong>Identify scope first.</strong> Name the provider, account/workspace, purpose, and\nexact destination. Use a neutral profile identifier; never let two trust\nboundaries share an ambiguous key.</li>\n<li><strong>Ask for one credential only.</strong> Do not batch multiple secret prompts.</li>\n<li><strong>Give one complete command.</strong> It must start from the normal shell prompt,\nrequest hidden input after launch, write/update one named secret-store entry,\nunset temporary state, and print only a non-secret success sentence.</li>\n<li><strong>Explain the two stages.</strong> Say explicitly: paste the command once and press\nEnter; wait for its prompt; then paste only the secret and press Enter.</li>\n<li><strong>Wait for confirmation.</strong> Do not provide the next credential command yet.</li>\n<li><strong>Verify without disclosure.</strong> Check entry presence and a harmless provider\nauthentication endpoint. Never print value, prefix, suffix, length, hash, or\nencoded form.</li>\n<li><strong>Diagnose safely.</strong> Distinguish absent entry, malformed placement, wrong\nworkspace, expired/revoked key, and insufficient scope. Overwrite a malformed\nentry; do not log or inspect its value.</li>\n<li><strong>Repeat one profile at a time.</strong> Each trust boundary gets a distinct variable\nor secret-store service.</li>\n<li><strong>Require explicit profile selection.</strong> Runtime code must not fall back from\none workspace&#39;s credential to another.</li>\n</ol>\n<h3 id=\"macos-keychain\">macOS Keychain</h3>\n<pre><code class=\"language-bash\">trap &#39;stty echo&#39; INT TERM EXIT; printf &quot;Paste the &lt;PROFILE&gt; API key, then press Enter: &quot;; stty -echo; IFS= read -r API_KEY; stty echo; trap - INT TERM EXIT; printf &#39;\\n&#39;; security add-generic-password -U -a &quot;$USER&quot; -s &quot;&lt;provider&gt;-api-key-&lt;profile&gt;&quot; -w &quot;$API_KEY&quot; &gt;/dev/null; unset API_KEY; echo &quot;&lt;PROFILE&gt; key saved in macOS Keychain.&quot;\n</code></pre>\n<p>Presence check only:</p>\n<pre><code class=\"language-bash\">security find-generic-password -a &quot;$USER&quot; -s &quot;&lt;provider&gt;-api-key-&lt;profile&gt;&quot; &gt;/dev/null 2&gt;&amp;1\n</code></pre>\n<p>Use the consuming provider&#39;s harmless authenticated read to prove validity.\nPresence alone is not success.</p>\n<h3 id=\"usage-examples\">Usage Examples</h3>\n<pre><code class=\"language-text\">Set up the API key for this workspace safely. Give me one exact terminal command,\nnever ask for the key in chat, wait for me to place it, then verify authentication\nwithout printing any secret metadata.\n</code></pre>\n<pre><code class=\"language-text\">Configure two workspace credentials. Request them one at a time, store them under\nseparate neutral profiles, verify each before asking for the next, and require an\nexplicit profile in runtime code.\n</code></pre>\n<h3 id=\"pitfalls\">Pitfalls</h3>\n<ul>\n<li><strong>Command stored as secret:</strong> explain the two-stage paste before the command.</li>\n<li><strong>Placeholder stored as secret:</strong> never ask users to edit <code>***</code> inside a command.</li>\n<li><strong>Shell history leakage:</strong> never put a literal secret in command arguments.</li>\n<li><strong>Presence mistaken for validity:</strong> always run a harmless auth probe.</li>\n<li><strong>Leaky diagnostics:</strong> never print prefixes, lengths, hashes, or raw bodies that\nmight echo request credentials.</li>\n<li><strong>Process-list exposure on macOS:</strong> <code>security -w &quot;$API_KEY&quot;</code> briefly passes the\nvalue to the Keychain CLI. State this limitation where other local users can\ninspect process arguments; use an approved native/enterprise secret-store UI\ninstead when that threat model applies.</li>\n<li><strong>Cross-workspace fallback:</strong> authentication success does not prove the chosen\nworkspace is intended.</li>\n<li><strong>Batching:</strong> request and verify one credential before discussing the next.</li>\n</ul>\n<h3 id=\"verification\">Verification</h3>\n<ul>\n<li><input disabled=\"\" type=\"checkbox\"> Secret never appeared in chat, arguments, source, logs, or clipboard output.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Destination identifies the intended provider/profile/trust boundary.</li>\n<li><input disabled=\"\" type=\"checkbox\"> User received one exact command at a time and understood the two stages.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Presence check emitted no secret data.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Harmless live authentication succeeded for each profile.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Runtime selection requires an explicit profile when multiple keys exist.</li>\n<li><input disabled=\"\" type=\"checkbox\"> Temporary shell state was unset.</li>\n</ul>\n","outline":["When to Use","Procedure","macOS Keychain","Usage Examples","Pitfalls","Verification"],"words":708}
