Przejdź do treści
Biblioteka skilli
Bezpieczeństwo · Automatyzacja

ibyok-migrate

/ibyok-migrate

Przenosi klucze API zapisane w kodzie lub w plikach .env do IBYOK i usuwa je z repozytorium, aby nie trafiały do historii commitów.

Repozytorium
ibyok-core ↗
Licencja
MIT
Ostatnia zmiana repozytorium
06.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 06.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Przenosi klucze API zapisane w kodzie lub w plikach .env do IBYOK i usuwa je z repozytorium, aby nie trafiały do historii commitów.

Oryginalny opis (EN)

Move API keys that are hardcoded in source or stored in .env files into IBYOK, then remove them from the repo. Use when the user wants to get secrets or API keys out of their code or .env, secure leaked keys, stop committing keys, or migrate an existing project to IBYOK.

Jak działa

  1. Hard rules
  2. 1. Inventory, by name and location only
  3. 2. User stores each key in IBYOK
  4. 3. Replace hardcoded literals with env lookups
  5. 4. Verify before removing anything
  6. 5. Remove the values from the repo
  7. 6. Finish with rotation, not history rewriting
Sekcje z nagłówków SKILL.md, w oryginale · 93 linii, 665 słów
Podgląd SKILL.md
---
name: ibyok-migrate
description: Move API keys that are hardcoded in source or stored in .env files into IBYOK, then remove them from the repo. Use when the user wants to get secrets or API keys out of their code or .env, secure leaked keys, stop committing keys, or migrate an existing project to IBYOK.
---

# Migrate a project's keys to IBYOK

The goal: no API key values in source, `.env` files, or CI config. The app gets them
at runtime from `ibyok run`. The user moves the values into IBYOK themselves. **You
never see, copy, or move a key value.**

## Hard rules

- **Do not read secret values.** Never `cat`, open, or print `.env`, `.env.local`,
  or similar files, and never print the lines that matched a secret pattern. Use
  the name-only and file-only commands below.
- **Never let `ibyok run` print env values.** See the rules in `ibyok-setup`.
- **Don't delete secrets before they are safely in IBYOK.** The user must confirm
  each key is stored and `ibyok status` must pass first.
- **Ask before rewriting git history.** Purging old commits is destructive and
  outward-facing. Rotating the key is the real fix anyway.

## 1. Inventory, by name and location only

Env files: list variable **names** only, never values:
```bash
for f in $(git ls-files -co --exclude-standard | grep -E '(^|/)\.env' ); do echo "== $f"; grep -oE '^[A-Za-z_][A-Za-z0-9_]*=' "$f" | tr -d '='; done
```

Hardcoded keys: list **files and line numbers** only, never the matched text:
```bash
git grep -nIE -c 'sk-(proj-|ant-)?[A-Za-z0-9_-]{20,}|AIza[0-9A-Za-z_-]{35}|gsk_[A-Za-z0-9]{20,}|hf_[A-Za-z0-9]{30,}|xai-[A-Za-z0-9]{20,}|r8_[A-Za-z0-9]{20,}|ghp_[A-Za-z0-9]{30,}' -- . ':!*.lock' ':!package-lock.json'
```
To work on a hit, view only the surrounding code structure. If a line contains a
literal key, describe it to the user ("line 12 of src/llm.ts assigns a literal
OpenAI key") instead of quoting it.

Which keys are actually used: search the code for `process.env.`, `os.environ`,
`os.getenv`, `ENV[`, and the provider SDK constructors.

Check whether env files were ever committed:
```bash
git log --all --oneline --name-only -- '*.env' '.env*' | head -50
```

Give the user a short table: env var name → where it's defined → used by → committed in history (yes/no).

## 2. User stores each key in IBYOK

Ask the user to add each key at https://www.ibyok.com/dashboard/keys, copying the
value from their `.env` or provider console themselves. If a key was ever committed
or shared, recommend creating a **new** key at the provider and storing that one.
The old one should be considered leaked.

Then run setup. Follow the `ibyok-setup` skill from step 1 (status → login → keys → map).

## 3. Replace hardcoded literals with env lookups

For each hardcoded key, change the code to read an env var. Use the name you mapped
in `.ibyok.json`:
```ts
// before: new OpenAI({ apiKey: "sk-..." })
new OpenAI({ apiKey: process.env.OPENAI_API_KEY })   // or just new OpenAI(): the SDK reads it by default
```
When you edit such a line, replace it entirely rather than echoing the old literal
back.

## 4. Verify before removing anything

```bash
npx -y ibyok status
npx -y ibyok run --dry-run -- <the app's start command>
```
Then have the user run the app or tests through `ibyok run` and confirm it works.

## 5. Remove the values from the repo

Only after step 4 passes and the user confirms:
- Delete the migrated `KEY=value` lines from `.env` files. Remove the whole line
  with a line-deleting edit (for example `sed -i.bak '/^OPENAI_API_KEY=/d' .env`),
  check, then delete the `.bak`. Never print the file.
- Keep or create `.env.example` with names only (`OPENAI_API_KEY=`) and a comment
  that values come from `ibyok run`.
- Make sure `.env*` (except `.env.example`) is in `.gitignore`.
- Prefix the scripts with `ibyok run --` (see `ibyok-setup` step 6).
- In CI, replace per-provider secrets with a single `IBYOK_ACCESS_TOKEN` secret and
  wrap the commands: `npx ibyok run --env staging -- npm test`.

## 6. Finish with rotation, not history rewriting

If step 1 found keys in git history or in a public repo, tell the user plainly:
**rotate those keys at the provider** (they already did if they stored new ones in
step 2), then delete the old ones. Offer history rewriting (`git filter-repo`) only
as an optional extra, and only with explicit approval.

Summarize: keys moved, files changed, scripts updated, anything the user still has to do.

Wersje

W bazie nie ma innych skilli o nazwie ibyok-migrate.

Migawka bazy z 13.11.2026 · wersja paczki 721974ddd5b7 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100ibyok-setup
    Podłącza projekt do IBYOK, tak aby klucze API dostawców trafiały do aplikacji w czasie działania poleceniem ibyok run.
  • 100ibyok-troubleshoot
    Diagnozuje błędy narzędzia ibyok: logowanie, brakujące mapowania kluczy, limity 429, tryb testowy oraz uruchomienia w CI.
  • 100secrets
    Wyszukuje zaszyte hasła, klucze API, pliki .env w commitach i wyciek tokenów, także w historii gita.
  • 100secrets-scan
    Wykrywa zaszyte poświadczenia, klucze API i tokeny w kodzie i plikach konfiguracji przed scaleniem lub przy audycie repozytorium.
  • 100secrets-detector
    Wykrywa zaszyte sekrety, klucze API i hasła w kodzie źródłowym, na przykład przed commitem.
  • 100secret-scan
    Znajduje klucze API, tokeny i hasła w plikach i historii gita oraz blokuje agentowi zapisywanie sekretów w kodzie.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.