# Data and privacy

Each SDK sends the error, its stack trace, where it happened and runtime details. The JavaScript SDK also sends request headers and query parameters, with sensitive values redacted. Nothing is sent until an error is captured.

## What gets sent

Each SDK sends a different payload. These are real payloads from the published SDKs, shortened.

### JavaScript / TypeScript

The JavaScript SDK sends the request context too: route, method, URL, query parameters and request headers, with sensitive values redacted. The request body is sent only if you turn on `captureRequestBody`.

```
{
  "error": {
    "id": "err_mvtwfk62_bdzm6eo",
    "name": "TypeError",
    "message": "Cannot read properties of undefined (reading 'name')",
    "stack": "TypeError: Cannot read properties of undefined ...",
    "stackFrames": [
      { "file": "src/users.js", "line": 42, "column": 12, "isNodeModule": false, "isInternal": false }
    ],
    "timestamp": "2026-10-29T12:00:00.000Z",
    "route": "/api/users/123",
    "method": "GET",
    "statusCode": 500,
    "url": "/https/bugstack.ai/api/users/123?include=profile",
    "queryParams": { "include": "profile" },
    "requestHeaders": { "user-agent": "...", "authorization": "[REDACTED]", "cookie": "[REDACTED]" },
    "environment": "production",
    "projectId": "",
    "sdkVersion": "2.2.1",
    "nodeVersion": "v22.11.0",
    "metadata": { "expressVersion": "4.21.2", "autoFix": false },
    "fingerprint": "0034a425"
  }
}
```

### Python

```
{
  "apiKey": "bsk_...",
  "error": {
    "message": "'NoneType' object has no attribute 'name'",
    "stackTrace": "Traceback (most recent call last): ...",
    "file": "app/models/user.py",
    "function": "get_display_name",
    "fingerprint": "d060eff1e370d2fe"
  },
  "environment": {
    "language": "python",
    "languageVersion": "3.12.0",
    "framework": "",
    "frameworkVersion": "",
    "os": "linux",
    "sdkVersion": "1.1.0"
  },
  "timestamp": "2026-10-29T12:00:00Z",
  "request": { "route": "/users/42", "method": "GET" },
  "metadata": { "framework": "fastapi" }
}
```

### Ruby

```
{
  "apiKey": "bsk_...",
  "error": {
    "message": "undefined method 'name' for nil",
    "stackTrace": "app/models/user.rb:12:in 'get_display_name' ...",
    "file": "app/models/user.rb",
    "function": "get_display_name",
    "fingerprint": "d060eff1e370d2fe"
  },
  "environment": {
    "language": "ruby",
    "languageVersion": "3.3.0",
    "framework": "",
    "frameworkVersion": "",
    "os": "linux",
    "sdkVersion": "1.0.2"
  },
  "timestamp": "2026-10-29T12:00:00Z",
  "request": { "route": "/users/42", "method": "GET" },
  "metadata": { "framework": "rails" }
}
```

### Go

```
{
  "apiKey": "bsk_...",
  "error": {
    "message": "panic: runtime error: invalid memory address or nil pointer dereference",
    "stackTrace": "goroutine 34 [running]: ...",
    "file": "handlers/user.go",
    "function": "main.getUser",
    "fingerprint": "d060eff1e370d2fe"
  },
  "environment": {
    "language": "go",
    "languageVersion": "go1.22.0",
    "framework": "",
    "frameworkVersion": "",
    "os": "linux",
    "sdkVersion": "1.1.0"
  },
  "timestamp": "2026-10-29T12:00:00Z",
  "request": { "route": "/users/42", "method": "GET" },
  "metadata": { "framework": "net/http" }
}
```

## What is and is not sent

-   **Cookies** — never. The JavaScript SDK redacts the cookie header; the Python, Ruby and Go SDKs send no headers.
-   **Request bodies** — off by default in JavaScript (`captureRequestBody`, capped by `maxBodySize` and redacted first); never sent by Python, Ruby or Go.
-   **Request headers and query parameters** — sent by JavaScript with sensitive values redacted (below). A header such as `x-forwarded-for` can carry the client's IP address: set `captureHeaders: false` to send no headers. Python and Ruby send only the route and method; Go sends query parameters only if you pass them yourself.
-   **Error messages and stack traces** — sent as they are by every SDK. If your messages can contain personal data, change or drop the event with `before_send` (below).

## Automatic redaction

The JavaScript SDK redacts these field names wherever they appear in query parameters, headers and bodies, and you can add your own with `redactFields`:

**Redacted fields:** password, secret, token, apikey, api\_key, apiKey, authorization, auth, credential, private, credit\_card, creditcard, card\_number, cvv, ssn, social\_security

**Always-redacted headers:** authorization, cookie, set-cookie, x-api-key, x-auth-token, x-bugstack-api-key, proxy-authorization, www-authenticate

The Python, Ruby and Go SDKs do no automatic redaction: they send no headers or bodies, and you change or drop anything else with `before_send`. (The Python SDK accepts a `redact_fields` option, but the current release does not apply it.)

## Inspect or drop events with before\_send

Every SDK has a hook that sees each event before it leaves your server. Return the event, changed or not, to send it, or nothing to drop it.

### JavaScript / TypeScript

```
const { initBugStack, bugstackErrorHandler } = require("bugstack-sdk/express");

app.use(initBugStack({
  apiKey: process.env.BUGSTACK_API_KEY,
  endpoint: "https://dashboard.bugstack.ai/api/ingest/sdk",
  captureHeaders: false, // send no request headers at all
  beforeSend(error) {
    if (error.route === "/health") return null; // drop health-check errors
    return error;
  },
}));
```

### Python

```
import os
import bugstack

def before_send(event):
    if event.request and event.request.route == "/health":
        return None  # drop health-check errors
    return event

bugstack.init(
    api_key=os.environ["BUGSTACK_API_KEY"],
    endpoint="https://dashboard.bugstack.ai/api/ingest/sdk",
    before_send=before_send,
)
```

### Ruby

```
Bugstack.init(
  api_key: ENV.fetch("BUGSTACK_API_KEY"),
  endpoint: "https://dashboard.bugstack.ai/api/ingest/sdk",
  before_send: ->(event) {
    event.request && event.request[:route] == "/health" ? nil : event # drop health-check errors
  },
)
```

### Go

```
bugstack.Init(bugstack.Config{
    APIKey:   os.Getenv("BUGSTACK_API_KEY"),
    Endpoint: "https://dashboard.bugstack.ai/api/ingest/sdk",
    BeforeSend: func(e *bugstack.Event) *bugstack.Event {
        if e.Request != nil && e.Request.Route == "/health" {
            return nil // drop health-check errors
        }
        return e
    },
})
```

## Preview without sending: dry run mode

The Python, Ruby and Go SDKs log the exact payload instead of sending it when `dry_run` (`DryRun` in Go) is on. The JavaScript SDK has no dry run mode.

```
bugstack.init(api_key=os.environ["BUGSTACK_API_KEY"], endpoint="https://dashboard.bugstack.ai/api/ingest/sdk", dry_run=True)
```

## Encryption at rest

GitHub tokens and the other credentials you give Bugstack are encrypted at rest with AES-256-GCM under a platform key. SDK API keys are stored only as a SHA-256 hash. What Bugstack keeps from your repository: a map of file paths, an inventory of your packages and versions, each finding with its location, and each change it proposes (the title, the explanation, the diff and the files it writes). Source files are fetched through GitHub when a scan or a fix needs them and are not kept as a copy of your codebase.

## Your code in the verification sandbox

To prove a fix, Bugstack copies your repository into an isolated sandbox for that one fix: it installs your dependencies, runs your tests, and destroys the sandbox when the fix is done. The sandbox starts from an empty environment, so none of Bugstack’s keys reach it and it gets no secrets of yours. The network is open only to your package registries while dependencies install, and cut before the first test runs. Only the result and its logs are kept, with secrets scrubbed. See [How it works](/docs/how-it-works#sandbox) and the [security page](/security).

## Next steps

-   [How Bugstack works](/docs/how-it-works) — the full capture-to-PR pipeline
-   [JavaScript SDK installation](/docs/installation/javascript)
-   [Python SDK installation](/docs/installation/python)
-   [Ruby SDK installation](/docs/installation/ruby)
-   [Go SDK installation](/docs/installation/go)
-   [Security](/security) — encryption, isolation, and compliance