All posts

Security

Protect API keys before you share your prototype

Keep service credentials out of browser code, screenshots and repositories, and define practical limits for a public demo.

HackHoster Team · · 4 min read

Smoked glass channels joining through a copper connector and charcoal ring
Illustration: HackHoster (AI-assisted), original artwork

At a glance

  • Keep service secrets on the server or in a managed secret store.
  • Limit credentials to the permissions the prototype actually needs.
  • Treat logs, recordings and repository history as possible exposure paths.
  • Revoke exposed credentials and review usage before sharing again.

Practical guidance from HackHoster. Sources and illustration credits accompany the article. Publishing standards and corrections.

Before you share a prototype, trace every service credential from its source to the place it is used. Keep secrets out of browser bundles, public repositories, demo recordings and ordinary logs. A small application can still create a real bill or expose an account if its credentials are copied into a place visitors can inspect.

This guide is a practical preparation exercise, not a complete security review. Different providers have different credential types and controls. A public client configuration value is not automatically a secret, and an environment variable is not automatically private. Read the documentation for the exact service and deployment framework you use.

Conceptual illustration of separate components connected into a reliable path
Illustration: HackHoster (AI-assisted), original artwork

Map the credential boundary

List the services your application calls and the permissions each call requires. Mark which calls happen in the browser and which happen on the server. If a credential allows paid model requests or privileged database access, ask how it could remain unavailable to someone who downloads the client application.

A common prototype architecture puts a limited server endpoint between the browser and the privileged service. That endpoint still needs its own input checks, access decisions and spending controls. Moving a key to the server removes one exposure path; it does not make an unrestricted public proxy safe to operate.

Use only the access you need

Create a credential limited to the prototype's purpose when the provider supports that option. Separate development from the account used for unrelated work. Avoid giving the application management privileges when it only needs to perform a narrow request. Check whether a resource, domain or project restriction is available.

Write down who can rotate or revoke the credential and where it is configured. The point is to make recovery possible during a busy build. A teammate should not need to search old chat messages for the person who created a key. Do not put the actual secret in that operational note.

Keep examples useful without real values

Provide an example configuration file containing names and harmless placeholders. Explain how a developer obtains their own credentials and which variables remain server-only. Test the setup using a fresh copy of the repository. This catches an instruction that works only because your machine has an undocumented local file.

Review the framework's rules for variables exposed to the browser. Naming conventions can deliberately publish values during a build. Also check static exports, generated files and source maps. The fact that a variable was read from an environment file during development does not tell you where its value appears in the deployed application.

Do not paste a real credential into an issue, screenshot or sample file to make setup easier. Explain the step and use a placeholder instead.

Inspect the less obvious exposure paths

Look at the terminal output and error messages you plan to show during the demo. Request headers, provider responses and configuration dumps may contain sensitive information. Log enough context to diagnose failures without recording full credentials or unnecessary user input. OWASP's logging guidance is a useful reference for deciding what to leave out.

Review the recording frame as carefully as the application. Browser tabs, a visible environment file or a copied curl command can expose details that were never committed. If a teammate will present, agree on a clean demonstration environment. A small rehearsal can reveal these accidental disclosures before the video is uploaded.

Put boundaries around public use

Define a reasonable request size, supported operation and usage limit for the demo. Reject inputs that the prototype does not handle. Think about repeated clicks, automated requests and long-running operations. Choose limits based on your provider costs and intended demonstration rather than assuming visitors will use the application exactly once.

Decide what happens when the limit is reached. A clear unavailable state is better than silently falling back to a more expensive operation. If you keep a recorded or sample mode, label it accurately. People should be able to distinguish a live service result from a prepared example without inspecting the source.

Rehearse recovery before you need it

If a credential is exposed, stop treating removal from the latest file as sufficient. Revoke or rotate the affected value through the provider and review its usage. Repository history, logs and copies may still contain the old value. Follow the provider's incident guidance for any additional account-specific steps.

Finish with a short sharing checklist: secrets stored appropriately, browser output inspected, example files clean, limits tested and a responsible person identified. Include the project's access requirements in the README. For a stronger demonstration, also test service failure and recovery using the API reliability guide.

A short exercise to try

Make one person responsible for the final credential check, even if everyone contributed integrations. Have that person inspect the deployed client output, sample configuration, visible logs and final recording. They should report which checks were completed without copying secret values into the report. Keep a provider console link and the credential owner in a private operational note. This makes the responsibility concrete and reduces the chance that every teammate assumes another person already checked the same exposure path.

Use the current challenge brief to choose a workflow for these checks, and confirm the published deadline before preparing your final submission.

Sources

Protect API keys before you share your prototype · HackHoster