AppInspected

Fix guides

There's an AWS access key in your website's code. Shut it off first, then find out what it did.

Last reviewed October 28, 2026 against the providers' current documentation.

The short version

In the IAM console, deactivate the key now (Users → the user → Security credentials → Access keys → Actions → Deactivate). Then look up what it did in CloudTrail's Event history, filtered by that access key, and check every Region for resources and IAM users you didn't create. Move the AWS calls your page made to a server (or to S3 presigned URLs or Amazon Cognito), and delete the old key once the app works without it. If it's a root user key, delete it: AWS recommends not having root access keys at all.

Why it matters

An AWS access key has two parts, the access key ID (AKIA… or ASIA…) and the secret access key. AWS's IAM docs say that anyone who has your access keys has the same level of access to your AWS resources that you do. Code that sends signed requests from the browser needs both parts, so when the ID is in your JavaScript the secret is almost always a few characters away. Even the ID on its own gives something away: the STS GetAccessKeyInfo call returns the AWS account the key belongs to. A key ID starting with AKIA is a long-term key for an IAM user or the root user, and it stays valid until someone deactivates or deletes it. A root user key can do anything in the account.

Fix it, in this order

  1. Find out whose key it is

    Search your code for the key ID. In the IAM console, open Users and check each user's Security credentials tab for that access key ID; the root user's keys are under your account's security credentials instead. Note what the user's policies allow (the Permissions and Access Advisor tabs): that's what anyone with the key could do.
  2. Deactivate the key

    On the user's Security credentials tab, in Access keys, choose Actions → Deactivate. AWS's docs say a deactivated key can no longer be used by API calls. Deactivate rather than delete for now: AWS's own advice for an exposed key is to disable it first, because a deactivated key can be turned back on if something important breaks, while a deleted key can't be recovered. If it's a root user key, plan to delete it, not replace it.
  3. Check what the key did

    In the CloudTrail console, open Event history, choose the AWS access key filter and paste the key ID. Event history keeps 90 days of management events, but only for one Region at a time, so switch through the Regions. It doesn't show data events such as S3 object reads, so if the key could read a bucket, check that bucket's logs too. Then look for things you didn't create in every Region, including ones you never use: EC2 instances, Lambda functions, and new IAM users or access keys.
  4. Cut off temporary credentials

    Keys starting with ASIA are temporary credentials from AWS STS, usually from an IAM role. To stop them early, open the role in IAM, go to the Revoke sessions tab and choose Revoke active sessions; IAM adds an AWSRevokeOlderSessions policy that denies every session issued before that moment. With an AKIA key, also think about temporary credentials someone may have created from it with GetSessionToken: AWS notes that rotating the user's keys doesn't end those, while attaching a deny-all policy to the user or deleting the user does.
  5. Stop calling AWS from the page

    The browser should never hold long-term AWS keys. For file uploads, have a small server endpoint (an API route, a Supabase Edge Function, a Lambda function) create an S3 presigned URL and give only that to the browser: the user can upload that one object without AWS credentials, and the URL expires. For other AWS calls, run them on the server with a role or a server-only environment variable. If the page really must call AWS directly, AWS's JavaScript SDK docs list Amazon Cognito identity pools as the recommended way to give a browser short-lived, limited credentials.
  6. Delete the old key and check AWS's notices

    Once your app works without it, delete the old key (Actions → Delete, then type the key ID to confirm). Then open the AWS Health Dashboard and your AWS Support cases: AWS says it monitors public sources such as code repositories for exposed keys, applies a quarantine policy that blocks some actions, and opens a support case to tell you. If you see resources or charges you didn't cause, answer that case or open one; don't paste the full key or any password into it.

Or ask your AI tool to do it

Paste this into Lovable, Bolt, Cursor, Claude Code or whichever tool built your app. Review what it changes before you deploy.

My website's frontend contains an AWS access key (the ID starts with AKIA or ASIA). List every place in the code that uses AWS credentials or the AWS SDK, and what each call does (S3 upload or download, SES email, Lambda, DynamoDB and so on). Remove every AWS access key ID and secret access key from client-side code and from any VITE_, NEXT_PUBLIC_, REACT_APP_ or EXPO_PUBLIC_ variable. For S3 uploads, add a server-side endpoint that requires a logged-in user, checks the file type and size, and returns a short-lived S3 presigned URL for one object key that the server chooses; the browser then uploads with that URL. Move every other AWS call into server-side endpoints that read credentials from a server-only environment or an IAM role, require an authenticated user, and rate-limit requests. Use a new IAM user or role with only the permissions these calls need. Finally, remind me to deactivate and then delete the old key in the IAM console and to check CloudTrail Event history for that key.

How this happens

It usually starts with a file upload. The fastest way to get "upload a photo to S3" working is to give the AWS SDK an access key and secret in the page, and an AI coding tool asked to fix a missing-credentials error will often do exactly that, through a VITE_AWS_SECRET_ACCESS_KEY or NEXT_PUBLIC_ variable that gets copied into the browser bundle. The key is often the one from the developer's own IAM user, or even the root user, with far more access than the upload needs.

Check that it's really fixed

After you deploy, run the free check. It reads your live site the way an attacker would and tells you if any secret key is still visible.

Topic check: Exposed API key checker

Find the other leaks before someone else does

The free check reads your home page and its scripts. The website security report goes through up to 30 pages and 40 JavaScript files, plus .env and .git files, security headers, cookies and CORS, domain and email records, and libraries with known vulnerabilities. Every finding comes with the fix for your host and a prompt for your AI tool.

$19 once, including 20 runs over 30 days so you can fix things and check again.

Get the report, $19 See an example report

Example report header: a score out of 100, findings by severity, Download PDF and Email me this report.

Questions

Is the access key ID alone dangerous?

On its own the ID can't sign requests; AWS requests also need the secret access key. But browser code that uses AWS needs both, so treat the secret as exposed too until you've searched your scripts. Even without the secret, the ID tells anyone your AWS account ID through GetAccessKeyInfo.

What's the difference between AKIA and ASIA keys?

AWS's docs say key IDs starting with AKIA are long-term credentials for an IAM user or the root user, and ASIA keys are temporary credentials created with AWS STS. A long-term key works until you deactivate or delete it; a temporary one expires, but you can end it early with Revoke active sessions on the role.

Will AWS shut the key off for me?

Not fully. AWS says that when it finds exposed credentials in public sources it applies a quarantine policy that blocks certain IAM actions that could lead to new resources or data access, but deliberately doesn't disable the key so your workloads keep running. It also doesn't say which sources it watches, so don't wait for it: deactivate the key yourself.

I removed the key from my code. Is that enough?

No. Old copies of your JavaScript stay in browser caches, CDN caches and web archives, and the key keeps working until you deactivate or delete it in IAM.

What permissions should the new credentials have?

Only what the feature needs. For uploads behind presigned URLs, the server's role only needs to put objects in that one bucket (or one folder of it). AWS's docs note that a presigned URL can only do what the identity that created it is allowed to do.

Does your check try the key?

No. The free check is passive: it finds AKIA and ASIA key IDs in your page and its JavaScript, shows them cut short, and never sends them to AWS. Only IAM and CloudTrail can tell you whether the key is active and what it did.

Sources

Related guides