Engineering

How to Share API Keys and Passwords With a Developer Safely

December 01, 2026

How to Share API Keys and Passwords With a Developer Safely

A two-hour checkout fix is ready to start, and the developer asks for "the Stripe key". You copy it from the dashboard into WhatsApp. The fix ships on Monday. The key that can move money on your account is still in that chat, in the phone's backup, and in any AI tool the developer pasted it into while debugging.

The short answer: don't send your keys. Give the developer their own access, limited to what the task needs: a sandbox role or restricted key in Stripe, a collaborator account in Shopify, a repository role in GitHub. If something really has to be shared, send it once through an encrypted link that expires, never in chat or email. Keep keys out of the code and out of AI prompts. When the task is done, remove the access and rotate anything you shared.

Why this matters more now

GitGuardian scans public code for leaked credentials. Its State of Secrets Sprawl 2026 report found:

  • 28,649,024 new secrets (keys, tokens and passwords) in public GitHub commits in 2025, up 34% on the year before.
  • About 28% of incidents started outside code entirely, in collaboration and productivity tools such as chat.
  • Commits co-authored by Claude Code leaked secrets at about twice the baseline rate of all public GitHub commits.
  • Leaked keys stay live. Of the valid secrets it found in 2022, 64% were "still active and exploitable" four years later.

The last number is the one a business owner should remember. A leaked key works until someone rotates it. The AI figure isn't a reason to ban AI coding tools. It's a reason to set them up so they never see your keys, which we cover below.

Give access, not keys

Most platforms you'd hand to a developer have a way to let someone work on your account without your password or your main key. Here's what to use on five common ones.

Stripe

Stripe's own guidance is blunt: "Don't share keys over email, chat, or other unencrypted channels" (Stripe API keys). Instead:

  • For building and testing, invite the developer as a team member with the Sandbox Admin or Sandbox User role. Stripe says both "can't view or make changes to anything in your live account" (Stripe user roles).
  • For live work, create a restricted API key (it starts with rk_) with only the permissions the integration needs. Stripe describes it as a way to "limit the damage to your business that a fraudulent actor could cause if they obtained your key."
  • Be careful with the Developer role. Stripe notes that it "can create secret keys, which grant access to almost all API resources". If you use it, remove the person when the task is done.

Stripe also tells you to rotate keys "when team members with access to the keys leave your organization". A developer finishing a task counts.

GitHub

In an organization, give the Write role, which GitHub recommends "for contributors who actively push to your project". Don't give Admin, which includes "sensitive and destructive actions like managing security or deleting a repository" (GitHub repository roles).

One catch: on a private repository owned by a personal account, there's no read-only option. GitHub says collaborators there always get write access. If that's more than you want, move the repository into an organization first, where you choose the role.

Shopify

Use a collaborator account, not a staff login or the owner's password. Collaborators are Shopify Partners. You give them a 4-digit request code from the Security section of your Users settings, and you review and edit the permissions before accepting. Shopify says you "can't assign the Administrator store role to collaborators", collaborators don't count towards your user limit, and access expires automatically if they haven't logged in for 90 days (Shopify Help Center).

WordPress

Create a separate user for the developer instead of sharing your login. Installing plugins and editing themes are Administrator-only capabilities on a single site (WordPress roles and capabilities), so most developer work needs that role. That's exactly why it should be their own account, deleted when the work is done. For content-only work, Editor is enough.

AWS and other cloud accounts

Never share the root login. AWS says: "We strongly recommend that you don't use the root user for your everyday tasks" (AWS root user). Give the developer their own identity with least-privilege permissions, and prefer temporary credentials over long-lived access keys, as the AWS IAM best practices recommend. The same idea applies on Google Cloud and Azure.

The short version

  • Stripe: a sandbox role for testing, a restricted key for live work. Never your secret key (sk_live_).
  • GitHub: the Write role on one repository. Never Admin, and never your own account.
  • Shopify: a collaborator account. Never the owner login.
  • WordPress: a separate user, deleted afterwards. Never your own login.
  • AWS: their own identity with least privilege. Never the root user or your access keys.

When something really has to be shared

Some things have no "give access" option: a database password on an old server, an email-sending login, a third-party service that allows one key per account. Then:

  1. Create a new credential for this task if the service allows more than one, so you can revoke it without breaking anything else.
  2. Send it through an expiring, encrypted link. A Bitwarden Send has a maximum lifespan of 31 days, after which "the Send and its contents will be completely purged", and you can cap how many times it's opened (Bitwarden Send). 1Password can share an item with someone who doesn't use 1Password, with a link that expires and that you limit to "anyone with the link or only specific people" (1Password).
  3. Write down what you shared, with whom and when, so you know exactly what to rotate later.

Your keys and AI coding tools

Many developers now give each task to an AI coding agent such as Claude Code or OpenAI's Codex. Both can read the files in your project folder without asking, by default:

  • Claude Code's documentation lists file reads as needing no approval "within the working directory" (Claude Code permissions).
  • In its standard mode, Codex "can read files, make edits, and run commands in the working directory automatically" (Codex approvals and security).

So if a .env file with live keys sits in that folder, the agent can read it. What it reads becomes part of the conversation.

What to do about it:

  • Keep live production keys off developer machines. Developers use test or sandbox keys. A person adds the production keys on the server or in the hosting dashboard.
  • In Claude Code, add deny rules such as Read(./.env) and turn on the sandbox. The documentation is honest about the limit: deny rules "don't apply to arbitrary subprocesses that read or write files indirectly, like a Python or Node script that opens files itself". That's why it recommends the sandbox for operating-system-level enforcement.
  • In Codex, keep the default workspace-write sandbox, which "keeps network access turned off unless you enable it".
  • Never paste a key into the chat to help the agent debug. Give it the variable name.

If a key has already leaked, rotate it first

GitHub's guide to removing sensitive data starts with the step most people skip: "as a first step you need to revoke and/or rotate that secret. Once the secret is revoked or rotated, it can no longer be used for access, and that may be sufficient to solve your problem" (GitHub).

In order:

  1. Create a new key at the provider.
  2. Update it on your server or in your hosting settings.
  3. Revoke the old key.
  4. Check the provider's logs for activity you don't recognise.
  5. Only then decide whether rewriting Git history is worth it. Deleting the file in a new commit doesn't remove it from earlier commits.

GitHub also gives you a free safety net. Push protection for users "is enabled by default" and "stops you from pushing secrets to public repositories on GitHub" (GitHub push protection). It doesn't cover private repositories by default: push protection for repositories is off until an administrator enables it, and it needs GitHub Secret Protection.

A checklist for your next task

  1. Write the task without any keys in it. Name the variables it needs, not their values.
  2. Give the developer their own access, at the lowest role that does the job.
  3. Use test or sandbox keys for development.
  4. If something must be shared, use an expiring encrypted link and note what you sent.
  5. Ask the developer to keep .env files and keys away from their AI tools.
  6. Add production keys to the server yourself.
  7. When the task is done, remove the access and rotate anything you shared.

Start my digital journey

Reduce risks and set a solid foundation for your larger-scale projects.

How the Spadasoft task workspace handles this

We built these rules into the Spadasoft task workspace. There, you can hire a Spadasoft engineer per task, or run your own team's tasks in a private project. Here's what it does today.

It blocks keys before they're saved

Briefs, comments, project notes and anything uploaded are checked with Gitleaks, an open-source secret scanner, before they're stored. If something looks like a credential, it isn't saved, and you see: "This looks like a credential. Remove it, rotate it if it is real, and add it in your environment settings."

Access for a hired engineer goes into a vault, not a chat

Once an engineer is assigned, you can add an access item for them. It's encrypted (AES-256-GCM), and only the assigned engineer can open it while the task is in progress. Each opening is recorded in the task history, and you can remove the item at any time. It's deleted automatically 14 days after the task is paid for or cancelled.

AI prompts come with fixed safety rules

For your team's tasks, the workspace writes a plan prompt, an implement prompt and a review prompt for Claude Code or Codex. Every prompt includes rules such as "Leave .env files, SSH keys, cloud credentials and password stores closed. Use variable names only" and "A human applies production configuration, approvals and deployments". The implement prompt ends with a handoff report. Its last section, "Manual steps", lists what a person has to do by hand, such as adding a key in production.

Repository protection for your team

Each project can download an optional protection pack. It contains:

  • agent rules (CLAUDE.md and AGENTS.md);
  • Claude Code settings that deny reading .env files, ~/.ssh and ~/.aws, with the sandbox on;
  • Codex sandbox settings;
  • hooks that stop a prompt or tool call containing a key;
  • a pre-commit check;
  • a GitHub workflow that scans for keys and runs dependency and code checks.

A harmless test key confirms the setup works.

Alerts say what to rotate, never the key

When a key is blocked, the project owner and security contact get an email. The alert shows the key's type, its last four characters, where it was caught and when, but never the key itself. For common services it links straight to the provider's key settings: Stripe, AWS, Google Cloud, Azure, GitHub, GitLab, OpenAI and OpenRouter. If the same key turns up again after you mark it as rotated, you're told.

Spadasoft staff can't open your private projects

The only exception is one hour of read-only access that the project owner grants to a Spadasoft lead. Staff access is logged.

Hiring through the workspace

When you hire through the workspace, the price is agreed before work starts, and you pay after you approve the delivered work. The code is yours from the first commit. How pay-per-task pricing works explains the model.

What it can't do

  • Hooks run on the developer's machine, and they can be switched off there. A passed setup check covers that tool at that moment, not every machine.
  • It can't see a key someone sends on WhatsApp, or one inside a screenshot.
  • An alert can't undo a leak. If a key shows up in an agent's output, it may already be exposed. The alert tells you to rotate it, and you still have to.
  • It isn't a secrets manager. If your team shares dozens of keys across services, use one: 1Password, Bitwarden or your cloud provider's own. Our vault is for one task at a time.
  • It isn't a certification. If your contract requires a vendor with a specific security certification, ask for the audit report, from us or anyone else. A blog post isn't evidence.

FAQ

Is it safe to give a developer my API key?

It's safer not to. Create a separate key with only the permissions the task needs, such as a Stripe restricted key, or give the developer their own account on the platform. Then you can remove their access without changing anything else.

How do I give a developer access to Stripe without sharing my secret key?

Invite them as a team member with the Sandbox Admin or Sandbox User role for testing. Neither can see or change your live account. For live work, create a restricted API key with only the permissions the integration needs.

How do I give a developer access to my Shopify store?

Use a collaborator account. Share your 4-digit collaborator request code, then review and edit the permissions before accepting the request. The developer needs a Shopify Partner account, and collaborators can't be given the Administrator role.

What should I do if I accidentally pushed an API key to GitHub?

Rotate it first: create a new key, update your server, then revoke the old one. GitHub's own guidance says revoking or rotating the secret is the first step, and that once the old key no longer works, rewriting history may not be needed.

Can Claude Code or Codex read my .env file?

Yes. By default, both can read files in your project folder without asking. In Claude Code, add a deny rule such as Read(./.env) and turn on the sandbox. In Codex, keep the default sandbox. Safest of all, keep live keys off the developer's machine.

Should I remove a developer's access when the task is done?

Yes, on the day you accept the work, and rotate any key you shared. Shopify removes collaborators who haven't logged in for 90 days. Elsewhere, plan to remove access yourself.

Start my digital journey

Reduce risks and set a solid foundation for your larger-scale projects.

Book a consultation now

Subscribe

Get exclusive insights, curated resources and expert guidance.

Keep Reading

Prev Article

Pay-Per-Task Software Development: How It Works, and When Hourly Still Wins

Pay for a finished task, not for the hours behind it. How pay-per-task development works, how to write a task that can be priced, and when hourly or monthly still makes more sense.

Read Full Story