Cloudanix Joins AWS ISV Accelerate Program

What Is Secret Redaction in Logs and Traces? Keeping Credentials Out of Your Data

Secret redaction removes passwords, keys and tokens from logs, traces and exports before they are stored or shared. Learn why it matters and how to apply it.

Secret redaction is the practice of detecting passwords, API keys, tokens and other credentials in logs, traces, error messages and exports, and removing or masking them before the data is stored, shared or sent to another system. A redacted record might show Authorization: Bearer [REDACTED] where the raw record had a live token.

It addresses a quiet, common problem. Systems write down what they see and do, and what they see often includes secrets. A command line with a password in it, an error that prints a connection string, a debug dump of a request, a record of what an AI coding agent read from an environment file: all of these can place a working credential into a log. Logs are then copied to monitoring tools, shared with vendors and kept for years, usually with weaker protection than the vault the secret came from.

This page explains where secrets leak into logs and traces, why that is dangerous, a recent real-world incident, how redaction works, and how to build it into your systems.

Where secrets end up in logs

SourceHow secrets appear
Application logsRequest headers, query strings, request bodies or exception messages that include credentials. The weakness is catalogued as CWE-532: Insertion of Sensitive Information into Log File.
Command history and shell outputPasswords passed on the command line, or tokens printed by a tool
CI/CD build logsEnvironment variables echoed during a build, or commands that print a key
Infrastructure and cloud logsConnection strings or tokens in configuration dumps and diagnostic output
Database logsStatements with literal passwords or personal data in query text. See database audit logging.
Error trackers and APM toolsStack traces and captured variables that hold secrets
AI agent tracesA record of what an agent read and ran, which can include secrets from environment files, configuration or terminals
Support tickets and chatPasted credentials and screenshots

The OWASP Logging Cheat Sheet lists data that should not be logged directly, including access tokens, passwords and encryption keys.

Why it is dangerous

  • Logs spread widely. A secret that lives in a vault is protected. Once it is in a log, it is copied to aggregation systems, backups, dashboards and shared exports.
  • Logs are read by many people. Developers, support staff and vendors may have access to logs that nobody would allow to see the original secret.
  • They are kept for a long time. Retention policies meant for audit mean the credential can sit there for years.
  • They are shared with third parties. Observability vendors, analytics providers and AI vendors may receive log data.
  • Rotation rarely reaches them. Even after a secret is rotated, old copies may show up in an archive. If the secret was not rotated, the log keeps it alive.
  • Attackers look there. Once inside, finding credentials in logs is a standard step toward lateral movement.

A recent example: agent traces at Cursor

In November 2026, Cursor published an account of a security incident that began at one of its AI vendors, Fireworks AI. According to Cursor, an attacker obtained an access key that Cursor had issued to Fireworks, and used it to copy a read-only storage bucket. The bucket held limited coding-agent traces, mostly from 2025, from sessions where users had not enabled Privacy Mode. A small number of those traces contained credentials that had not been redacted. Starting from those credentials, the attacker reached some of Cursor’s internal software-as-a-service tools, and later placed a malicious copy of the Claude Code extension on its marketplace for about 11 hours. Cursor says fewer than 0.01% of customers had API credentials exposed.

The lesson is general. A trace is a faithful record of what an agent saw, so it holds whatever secrets the agent touched. When such records are shared, the secrets go with them. We cover the full incident in A vendor’s exposed key put a fake Claude Code extension in Cursor’s marketplace.

How redaction works

Detection methods

  • Pattern matching. Many credentials have recognizable formats, such as a fixed prefix and length. Cloud access keys, source control tokens and AI provider keys can be matched with regular expressions.
  • Keyword and field-based rules. Fields named password, secret, token, authorization or api_key are masked regardless of value.
  • Entropy analysis. Long, random-looking strings are more likely to be secrets than ordinary text. This catches unknown formats and also produces false positives.
  • Verification. Some tools test whether a detected secret actually works, which reduces noise. Do this carefully, so the check does not itself create risk.
  • Structured logging with a deny list. If logs are structured (for example JSON), sensitive fields can be dropped by name before output.

What to do with a match

ActionResultUse when
Drop the fieldThe value is not recordedYou never need it
Mask (****)Shows that something was thereDebugging needs to know a value existed
Partially mask (last four characters)Helps matching and supportIdentifiers such as card numbers
Hash or tokenizeAllows correlation without exposing the valueYou need to join records on the value
Block and alertStops the data from leavingThe destination is untrusted

Redaction should be irreversible in the stored record. Keeping the original somewhere “just in case” defeats the purpose.

Where to apply redaction

Put it as close to the source as you can, and add layers.

  1. At the source. Fix the code that logs secrets. Use logging libraries with built-in filters, and do not log whole request objects.
  2. At collection. Add redaction rules in the log shipper or agent, so data is cleaned before it leaves the host.
  3. At the pipeline. Apply rules in the central log pipeline or telemetry processor.
  4. At export and sharing. Scan anything you send to a vendor, ticket or partner.
  5. At rest. Periodically scan stored logs and archives for secrets that got through.

A layered approach matters because no single rule catches everything.

Practical steps

Step 1: Find what you already have

Scan existing logs, traces and exports for secrets. Open-source tools can scan files and directories, not only repositories:

# Scan a directory of exported logs without git history
gitleaks detect --no-git --source ./exported-logs --report-path leaks.json

# Scan files and keep only secrets that actually authenticate
trufflehog filesystem ./exported-logs --only-verified

Treat every hit as a live credential until proven otherwise, and rotate it. See secret rotation.

Step 2: Fix the sources

Search your code for places that log entire objects, headers or request bodies. A quick starting point:

# Look for logging calls that might include credentials
grep -rnE "log(ger)?\.(info|debug|error|warn).*(password|secret|token|authorization|api[_-]?key)" src/

Replace them with logging that omits or masks the sensitive fields. Run static analysis that flags this weakness. See static source code analysis.

Step 3: Add redaction in the pipeline

Most log and telemetry pipelines support processing rules. A generic example of the idea, written as pseudo-configuration:

# Illustrative only: syntax differs by tool
processors:
  - name: redact-secrets
    match_fields: ["password", "secret", "token", "authorization", "api_key"]
    action: mask
  - name: redact-patterns
    patterns:
      - "AKIA[0-9A-Z]{16}"          # AWS access key ID format
      - "sk-[A-Za-z0-9]{20,}"       # common AI provider key prefix
      - "ghp_[A-Za-z0-9]{36}"       # GitHub personal access token format
    action: replace
    replacement: "[REDACTED]"

Check the real syntax for your tool, and test the rules against sample data. Pattern lists need maintenance as formats change.

Step 4: Protect what you share with third parties

Before logs, traces or datasets leave your environment, scan and redact them. Apply the same standard to vendors that train models or analyze data on your behalf. Ask each vendor how they redact secrets, how long they keep data, what keys they hold for your storage, and how quickly they will tell you about exposure. See third-party risk management and our vendor security questions.

Step 5: Limit who can read logs and how long they live

Treat logs as sensitive data. Restrict access, keep retention to what policy requires, and store them away from the systems they describe. See database audit logging for protecting audit records.

Step 6: Make secrets worth less when they leak

Redaction reduces leaks, and it will never be perfect. Limit the damage of the ones that get through:

  • Prefer short-lived credentials that expire in minutes or hours, so a secret found in an old log no longer works.
  • Scope credentials narrowly. See least privilege.
  • Remove standing access. See zero standing privilege.
  • Restrict where credentials can be used from.

AI agents and redaction

AI coding agents create a new source of exposed secrets. They read files, run commands and inspect environments as part of their work, and their sessions are often recorded for debugging or model improvement. Three practices help:

How Cloudanix helps

Cloudanix works at both ends: stopping secrets from entering logs and repositories, and reducing the value of the ones that leak.

  • Catching secrets early. Code Security scans pull requests and full git history for hardcoded credentials and can fail a pull request that introduces one. See secret-aware PR quality gates and the secrets detection use case.
  • Stopping them at the developer’s machine. The Coding Agent Firewall adds on-host data loss prevention, so secrets and personal data are blocked before an AI agent sends them out, including secrets an agent writes into commands and files.
  • Credentials that expire. Coding Agent JIT uses an MCP server to create, scope and destroy credentials for agents such as Claude Code, Cursor and Kiro, with a human in the loop for sensitive requests. Agentic JIT does the same for pipelines and services. A credential that has already expired is worth little in an old trace.
  • Knowing which identities exist. Non-human identity visibility and CIEM list keys and service accounts across your clouds and what each can reach, so you know what to rotate after a leak.

The boundary: Cloudanix does not redact the logs of your applications or observability tools. That redaction belongs in your logging libraries and pipelines. It cannot recover a secret that has already been shared with a vendor, which needs to be rotated.

Further reading

Frequently asked questions

What is secret redaction?

It is detecting and removing or masking passwords, keys and tokens in logs, traces and exports before they are stored or shared.

Why do secrets end up in logs?

Systems record what they process. Command lines, request headers, error messages, debug dumps and AI agent sessions can all contain credentials, and logging code often records them without anyone intending it.

Is masking enough, or should I remove the value?

If you never need the value, drop it. Masking is useful when debugging needs to know a value was present. Either way, the stored record should not allow recovery of the original.

What should I do if I find a secret in a log?

Treat it as compromised. Rotate it, review access logs for its use from the earliest plausible date, remove it from the log and its copies, and fix the code or pipeline that put it there.

How do AI agent traces change the picture?

Traces record what an agent read and did, so they include secrets from files and terminals the agent touched. Sharing traces with a vendor shares those secrets, as the Cursor incident showed. Redact before sharing, and give agents short-lived credentials.

People Also Read

What Our Users Are Saying

Customer Reviews

Cloudanix is trusted by security leaders worldwide to deliver proactive, reliable, and cutting-edge cloud security.

One day, I changed the password of a root account, and my CTO called me within less than a minute to confirm if I did so. I was not expecting a reaction this quick. He told me Cloudanix alerted him of this password change and that he wanted to confirm as it was a critical security notification. I couldn't believe it!

Ritesh Agarwal
Ritesh Agarwal
CEO, Airgap Networks

Compliance is one way of staying secure, but what I want is the ability to go deeper and attain 'true security.' Cloudanix provides us the capability to do so.

Vishal Madan
Vishal Madan
Head of Engineering, iMocha

Cloudanix is building for the future of the cloud, which makes the product all the more desirable.

Ritesh Agarwal
Ritesh Agarwal
CEO, Airgap Networks

Cloudanix gave us the visibility we were missing. Being able to move from permanent access to a robust Just-In-Time (JIT) workflow has fundamentally changed our security posture without slowing down our engineering velocity.

Pavan Kumar Lekkala
Pavan Kumar Lekkala
SRE Lead, HugoHub

We are excited to leverage Cloudanix's comprehensive multi-cloud DevSecOps solution to secure our production workloads on AWS. Cloudanix has demonstrated that it can solve many challenges that DevSecOps teams face while continually adding new features such as SOC2 compliance and drift detection.

Satish Mohan
Satish Mohan
Co-founder & CTO, Airgap Networks

Managing third-party partner access was once a major concern for our security posture. With Cloudanix JIT Cloud, we've effectively achieved zero third-party risk. We can now grant access confidently, knowing that it is temporary, audited, and automatically revoked, resulting in a 100% reduction in our privileged access exposure.

Okesh Badhiye
Okesh Badhiye
Head of Technical Engineering, Finfinity

The snooze feature and responsible alerts have helped us save time and prioritize what to tackle first.

Satish Mohan
Satish Mohan
Co-founder & CTO, Airgap Networks

Implementing Cloudanix JIT internally allowed us to practice what we preach. By eliminating permanent access to our own clouds and databases, we've neutralized the risk of standing privileges, ensuring our own 'keys to the kingdom' are never left exposed.

Girish Manghnani
Girish Manghnani
Managing Partner, Tech Inspira

The problem with permissions is a lot of times, the gaps are left open due to oversights from inside the organization itself. With Cloudanix's CIEM, we get a complete view of user permissions and access. This enables us to update the permissions, reducing the attack surface.

Nilesh Pethani
Nilesh Pethani
Application Architect, iMocha

In the world of Fintech, trust is our currency. Cloudanix provided the frictionless visibility we needed to secure our EKS workloads across AWS, ensuring we stay audit-ready for SOC2 and GDPR without slowing down our engineering velocity.

Amol Naik
Amol Naik
Head of Security & Infrastructure, HugoHub

Cloudanix delivered value within 5 minutes of onboarding. Continuous monitoring, timely detection, and excellent documentation helped us attain a great cloud security posture.

Divyanshu Shukla
Senior DevSecOps, Meesho

Technology strategies and business strategies are in a state of constant change which includes centralization and decentralization of responsibilities. Regardless of strategic shift, we still have intellectual property to protect. Cloudanix are critical partners for us in our public cloud security posture across our three cloud providers.

Jerry Locke
Jerry Locke
Senior Director Global Solutions Engineering, Eversana

Cloudanix has been amazing. They opened up a common Slack channel with us — and it feels like we are talking to our own team and getting things done with Cloud security. The support team is always available, friendly, helpful, and ready to go out of their way.

Satish Mohan
Satish Mohan
CTO, Airgap Networks

Beyond just access management, Cloudanix CSPM has given us a unified view of our AWS environment. The real-time alerting and anomaly detection allow us to prevent any untoward activity before it happens, which is critical for a marketplace connecting 50+ financial institutions.

Okesh Badhiye
Okesh Badhiye
Head of Technical Engineering, Finfinity

For a Fintech company, data is our most valuable — and most sensitive — asset. Cloudanix DAM hasn't just improved our visibility; it has given us control. The ability to mask data and prevent unauthorized queries in real-time is a game-changer for our compliance and customer trust.

Jiten Gala
Jiten Gala
President Engineering and Product, Kapittx

Our clients, especially in the Middle East financial sector, demand absolute accountability. Cloudanix JIT Cloud has been a competitive differentiator for us, allowing us to provide secure, governed access to customer accounts that meet their strictest audit and compliance requirements.

Girish Manghnani
Girish Manghnani
Managing Partner, Tech Inspira

Cloudanix is always on my team's lips because of its exceptional support. Be it a small or big query, Cloudanix has gone above and beyond to resolve them. This one's a keeper for us.

Sujit Karpe
Sujit Karpe
CTO, iMocha

For a long-lasting partnership, great support goes a long way. Cloudanix has delivered exceptional support whenever required. Their edge is their team is always ready to go beyond to solve any issues that we have. This speaks volumes about the culture at Cloudanix.

Akash Maheshwari
Akash Maheshwari
Co-founder, MoveInSync

Beyond the technology, Cloudanix feels like an extension of our own team. Their willingness to stand up a dedicated Middle East tenant for us and provide exceptional support at a sensible price makes them a long-term partner for Hugosave.

Surya Tamada
Surya Tamada
CTO, HugoHub

The real-time notifications that Cloudanix provides are a real lifesaver. Their adaptive notifications ensure that my team stays productive and doesn't get interrupted all the time.

Digvijay Singh
Staff Security Engineer, Meesho

The whole point in technological evolution is to help improve the world we live in. We must protect that and to do so requires an effective and efficient security strategy. The Cloudanix team helped make our public cloud security posture management strategy a reality. The symbiotic relationship we have allows for a continuous feedback loop which is how business should operate.

Larry Wheat
Larry Wheat
Staff Solutions Engineer, Eversana

Ready to see your graph?

Connect a cloud account in under 30 minutes. See every finding rooted in identity, asset, and blast radius — with a fix path attached.

Book a Demo