Detect explicit Authorization header credentials with precise token spans.
BEARER_TOKEN was added in Core 0.4.1.
BEARER_TOKEN is enabled by default for text and structured string scans. It recognizes explicit HTTP Authorization headers and quoted JSON header entries. Header names and the Bearer scheme are ASCII case-insensitive.
The finding covers only the token, excluding the header name, scheme, whitespace, and quotes. Byte, code point, and JavaScript UTF-16 offsets use the existing finding contract. Provenance is datafog-core/bearer-token; confidence is omitted. Node.js and browser WASM use the same configuration with scanAndTransform; Rust uses scan_and_transform with parsed configuration.
Accepted forms
A raw Authorization: Bearer TOKEN line, optionally indented with spaces or tabs. The value must end at a line boundary or end of input, with optional trailing spaces or tabs.
A quoted JSON entry such as {"Authorization": "Bearer TOKEN"}. A standalone "Authorization": "Bearer TOKEN" fragment is also recognized. The key must begin an object or follow a comma, allowing JSON whitespace.
One or more ASCII spaces must separate Bearer from its token. Tabs in that position are rejected. Spaces and tabs around the colon are accepted for copied header representations.The token follows the alphabet in RFC 6750 section 2.1: ASCII letters, digits, -, ., _, ~, +, and /, optionally followed by terminal = characters. At least one non-padding character is required. There is no arbitrary minimum length, Base64 decoding, signature verification, network request, or credential-validity check. A period belongs to the token and is retained.
Boundaries and selection
Bare Bearer TOKEN prose, random token-shaped strings, Proxy-Authorization, and X-Authorization are excluded. Malformed values with invalid characters, interior padding, extra words, Unicode token characters, missing quotes, or JSON escapes are rejected as a whole; no token prefix is returned. JSON escape sequences are not decoded.Structured scans also recognize string values whose immediate field key is exactly Authorization, ignoring ASCII case: for example, {"headers":{"Authorization":"Bearer TOKEN"}}. The same header-value parser runs in Rust and returns token-only offsets local to the string, so redaction leaves Bearer intact. This explicit field context does not extend to arrays under that key, prefixed keys such as X-Authorization, or sibling fields. Bare scan("Bearer TOKEN") remains unrecognized.
A token can also qualify as JWT or another credential entity. Scan results retain overlapping findings. Select BEARER_TOKEN in a transformation configuration to redact the complete token regardless of overlap. Supported masking, removal, allowlists, pseudonymization, and tokenization use the existing transformation rules.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"datafog","description":"Local file protection with datafog MCP and privacy SDKs with datafog core","colors":{"primary":"#A83226","light":"#FF7A1A","dark":"#C0362C"},"logo":{"light":"https://mintcdn.com/data-fog/c_gYqIyRG2e6pQHL/images/datafog-wordmark-light.svg?fit=max\u0026auto=format\u0026n=c_gYqIyRG2e6pQHL\u0026q=85\u0026s=42268b386b96762a93277a16809d5060","dark":"https://mintcdn.com/data-fog/c_gYqIyRG2e6pQHL/images/datafog-wordmark.svg?fit=max\u0026auto=format\u0026n=c_gYqIyRG2e6pQHL\u0026q=85\u0026s=b6555b4e26dabacfb597678915a04591","href":"https://datafog.ai"},"favicon":"https://mintcdn.com/data-fog/c_gYqIyRG2e6pQHL/favicon.svg?fit=max\u0026auto=format\u0026n=c_gYqIyRG2e6pQHL\u0026q=85\u0026s=c7047c2f037202d4fb3e32fbc8c71125","appearance":{"default":"system","strict":false},"background":{"color":{"light":"#EEF0EF","dark":"#0E1316"}},"navbar":{"links":[{"href":"https://datafog.ai","label":"datafog home"}]},"seo":{"metatags":{"og:image":"https://docs.datafog.ai/images/og-docs.png","twitter:image":"https://docs.datafog.ai/images/og-docs.png","twitter:card":"summary_large_image","theme-color":"#0E1316","og:image:width":"1200","og:image:height":"630","og:image:type":"image/png","og:image:alt":"datafog documentation — Guides for MCP and Core SDK.","twitter:image:alt":"datafog documentation — Guides for MCP and Core SDK.","og:site_name":"datafog documentation"}},"fonts":{"heading":{"family":"Geist","weight":300,"source":"fonts/geist-latin.woff2","format":"woff2"},"body":{"family":"Geist","weight":400,"source":"fonts/geist-latin.woff2","format":"woff2"}},"styling":{"codeblocks":{"theme":"github-dark"},"latex":false},"navigation":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/DataFog"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"data-fog","hasAudioNarration":false,"actualSubdomain":"data-fog","customDomains":["docs.datafog.ai"],"gitSource":{"type":"github","owner":"datafog","repo":"datafog-core","deployBranch":"main","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6af90baf642a716c8d8a5d7d","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"Core SDK","count":44},{"language":"default","tag":"Reference","count":19},{"language":"default","tag":"Project","count":14},{"language":"default","tag":"Releases","count":13},{"language":"default","tag":"Detection coverage","count":12},{"language":"default","tag":"SDK reference","count":7},{"language":"default","tag":"Guides","count":6},{"language":"default","tag":"Get started","count":4},{"language":"default","tag":"MCP","count":4},{"language":"default","tag":"Research","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":"@font-face{font-family:'Geist';src:url('/fonts/geist-latin.woff2') format('woff2');font-style:normal;font-weight:100 900;font-display:swap}@font-face{font-family:'Geist Mono';src:url('/fonts/geist-mono-latin.woff2') format('woff2');font-style:normal;font-weight:100 900;font-display:swap}:root{--df-ground: #EEF0EF;--df-surface: #FFFFFF;--df-ink: #0E1316;--df-secondary: #46505A;--df-border: #D2D8D7;--df-link: #A83226;--df-inline-code: #E1E6E4;--df-orange: #C0362C;--df-signal: #FF7A1A;--df-night: #0E1316;--df-fog: #A7B2B1}.dark{--df-ground: #0E1316;--df-surface: #1A2226;--df-ink: #EEF0EF;--df-secondary: #A7B2B1;--df-border: #46505A;--df-link: #FF7A1A;--df-inline-code: #1A2226}body{color:var(--df-ink);background:var(--df-ground);-webkit-font-smoothing:antialiased}#navbar,#sidebar,#mobile-nav{background:var(--df-ground);border-color:var(--df-border)}#page-title,.mdx-content h1,.mdx-content h2,.mdx-content h3{color:var(--df-ink);font-family:'Geist', sans-serif;font-weight:300;letter-spacing:-.03em;text-wrap:balance}#page-title,.mdx-content h1{font-weight:200;letter-spacing:-.04em;line-height:1.12}.mdx-content{color:var(--df-secondary);line-height:1.65}.mdx-content strong{color:var(--df-ink)}.eyebrow{color:var(--df-link);font:400 12px 'Geist Mono', monospace;text-transform:uppercase;letter-spacing:.1em}.card{background:var(--df-surface);border:1px solid var(--df-border);border-radius:18px;box-shadow:none}.card:hover{border-color:var(--df-link)}.mdx-content a:not(.card){color:var(--df-link);text-decoration:underline;text-underline-offset:4px}.mdx-content a:not(.card):hover{text-decoration-thickness:2px}code,pre,kbd,samp{font-family:'Geist Mono', monospace!important}.mdx-content :not(pre)>code{background:var(--df-inline-code);color:var(--df-ink);border-radius:4px}.code-block,.code-group{background:var(--df-night)!important;border-color:#46505A!important;border-radius:12px;color:#EEF0EF}.code-block pre,.code-group pre{background:transparent!important}.code-block code{background:transparent;color:#EEF0EF}.code-group [role=\"tab\"]{color:var(--df-fog)}.code-group [role=\"tab\"][aria-selected=\"true\"]{color:var(--df-signal)}#search-bar-entry,#search-bar-entry-mobile{background:var(--df-surface);border:1px solid var(--df-border);border-radius:999px;color:var(--df-secondary)}:where(a,button,input,summary):focus-visible{outline:2px solid var(--df-link);outline-offset:4px}::selection{background:var(--df-orange);color:#FFFFFF}.callout[data-callout-type=\"note\"]{background:var(--df-surface);border-color:var(--df-border);border-radius:18px}.callout[data-callout-type=\"note\"] [data-component-part=\"callout-content\"]{color:var(--df-secondary)}.callout[data-callout-type=\"note\"] svg{color:var(--df-link)}.df-token{display:inline-block;background:var(--df-orange);color:#FFFFFF;border-radius:999px;padding:0 .55em;font:.85em/1.6 'Geist Mono', monospace}"}],"page":{"pagePath":"reference/bearer-token","slug":"/reference/bearer-token","pageMetadata":{"title":"Bearer tokens","description":"Detect explicit Authorization header credentials with precise token spans.","href":"/reference/bearer-token"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Detect explicit Authorization header credentials with precise token spans.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);return _jsxs(_Fragment,{children:[_jsxs(Note,{children:[_jsx(_components.code,{children:`BEARER_TOKEN`}),` was added in Core 0.4.1.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`BEARER_TOKEN`}),` is enabled by default for text and structured string scans. It recognizes explicit HTTP Authorization headers and quoted JSON header entries. Header names and the `,_jsx(_components.code,{children:`Bearer`}),` scheme are ASCII case-insensitive.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-dark github-dark`,style:{backgroundColor:`#24292e`,\"--shiki-dark-bg\":`#24292e`,color:`#e1e4e8`,\"--shiki-dark\":`#e1e4e8`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`from`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` datafog_core `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`import`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` scan_and_transform, scan_and_transform_structured`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`text `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'Authorization: Bearer example-token'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`result `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` scan_and_transform(text, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` \"transform\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: {`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"default\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: {`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"strategy\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: `}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"redact\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`}, `}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"entities\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: [`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"BEARER_TOKEN\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`]}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`})`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`assert`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` result.text `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`==`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:` 'Authorization: Bearer [BEARER_TOKEN]'`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The finding covers only the token, excluding the header name, scheme, whitespace, and quotes. Byte, code point, and JavaScript UTF-16 offsets use the existing finding contract. Provenance is `,_jsx(_components.code,{children:`datafog-core/bearer-token`}),`; confidence is omitted. Node.js and browser WASM use the same configuration with `,_jsx(_components.code,{children:`scanAndTransform`}),`; Rust uses `,_jsx(_components.code,{children:`scan_and_transform`}),` with parsed configuration.`]}),`\n`,_jsx(Heading,{level:`2`,id:`accepted-forms`,children:`Accepted forms`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`A raw `,_jsx(_components.code,{children:`Authorization: Bearer TOKEN`}),` line, optionally indented with spaces or tabs. The value must end at a line boundary or end of input, with optional trailing spaces or tabs.`]}),`\n`,_jsxs(_components.li,{children:[`A quoted JSON entry such as `,_jsx(_components.code,{children:`{\"Authorization\": \"Bearer TOKEN\"}`}),`. A standalone `,_jsx(_components.code,{children:`\"Authorization\": \"Bearer TOKEN\"`}),` fragment is also recognized. The key must begin an object or follow a comma, allowing JSON whitespace.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`One or more ASCII spaces must separate `,_jsx(_components.code,{children:`Bearer`}),` from its token. Tabs in that position are rejected. Spaces and tabs around the colon are accepted for copied header representations.`]}),`\n`,_jsxs(_components.p,{children:[`The token follows the alphabet in `,_jsx(_components.a,{href:`https://www.rfc-editor.org/rfc/rfc6750#section-2.1`,children:`RFC 6750 section 2.1`}),`: ASCII letters, digits, `,_jsx(_components.code,{children:`-`}),`, `,_jsx(_components.code,{children:`.`}),`, `,_jsx(_components.code,{children:`_`}),`, `,_jsx(_components.code,{children:`~`}),`, `,_jsx(_components.code,{children:`+`}),`, and `,_jsx(_components.code,{children:`/`}),`, optionally followed by terminal `,_jsx(_components.code,{children:`=`}),` characters. At least one non-padding character is required. There is no arbitrary minimum length, Base64 decoding, signature verification, network request, or credential-validity check. A period belongs to the token and is retained.`]}),`\n`,_jsx(Heading,{level:`2`,id:`boundaries-and-selection`,children:`Boundaries and selection`}),`\n`,_jsxs(_components.p,{children:[`Bare `,_jsx(_components.code,{children:`Bearer TOKEN`}),` prose, random token-shaped strings, `,_jsx(_components.code,{children:`Proxy-Authorization`}),`, and `,_jsx(_components.code,{children:`X-Authorization`}),` are excluded. Malformed values with invalid characters, interior padding, extra words, Unicode token characters, missing quotes, or JSON escapes are rejected as a whole; no token prefix is returned. JSON escape sequences are not decoded.`]}),`\n`,_jsxs(_components.p,{children:[`Structured scans also recognize string values whose immediate field key is exactly `,_jsx(_components.code,{children:`Authorization`}),`, ignoring ASCII case: for example, `,_jsx(_components.code,{children:`{\"headers\":{\"Authorization\":\"Bearer TOKEN\"}}`}),`. The same header-value parser runs in Rust and returns token-only offsets local to the string, so redaction leaves `,_jsx(_components.code,{children:`Bearer `}),` intact. This explicit field context does not extend to arrays under that key, prefixed keys such as `,_jsx(_components.code,{children:`X-Authorization`}),`, or sibling fields. Bare `,_jsx(_components.code,{children:`scan(\"Bearer TOKEN\")`}),` remains unrecognized.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-dark github-dark`,style:{backgroundColor:`#24292e`,\"--shiki-dark-bg\":`#24292e`,color:`#e1e4e8`,\"--shiki-dark\":`#e1e4e8`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`result `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` scan_and_transform_structured(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` {`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"headers\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: {`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"Authorization\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: `}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"Bearer example-token\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`}},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` {`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"transform\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: {`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"default\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: {`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"strategy\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: `}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"redact\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`}, `}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"entities\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: [`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"BEARER_TOKEN\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`]}}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`assert`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` result.data `}),_jsx(_components.span,{style:{color:`#F97583`,\"--shiki-dark\":`#F97583`},children:`==`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:` {`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"headers\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: {`}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"Authorization\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`: `}),_jsx(_components.span,{style:{color:`#9ECBFF`,\"--shiki-dark\":`#9ECBFF`},children:`\"Bearer [BEARER_TOKEN]\"`}),_jsx(_components.span,{style:{color:`#E1E4E8`,\"--shiki-dark\":`#E1E4E8`},children:`}}`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`A token can also qualify as `,_jsx(_components.code,{children:`JWT`}),` or another credential entity. Scan results retain overlapping findings. Select `,_jsx(_components.code,{children:`BEARER_TOKEN`}),` in a transformation configuration to redact the complete token regardless of overlap. Supported masking, removal, allowlists, pseudonymization, and tokenization use the existing transformation rules.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":{"theme":"github-dark"},"config":{},"pageMetadata":{"title":"Bearer tokens","description":"Detect explicit Authorization header credentials with precise token spans.","href":"/reference/bearer-token"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Accepted forms","slug":"accepted-forms","depth":2,"children":[]},{"title":"Boundaries and selection","slug":"boundaries-and-selection","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"data-fog","siteName":"datafog","title":"Bearer tokens - datafog","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-12T22:33:55.393Z","originalFileLocation":"reference/bearer-token.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Detect explicit Authorization header credentials with precise token spans.\">\u003cmeta data-mint-head name=\"application-name\" content=\"datafog\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Bearer tokens - datafog\">\u003cmeta data-mint-head property=\"og:description\" content=\"Detect explicit Authorization header credentials with precise token spans.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"datafog documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.datafog.ai/reference/bearer-token\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://docs.datafog.ai/images/og-docs.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Bearer tokens - datafog\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Detect explicit Authorization header credentials with precise token spans.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://docs.datafog.ai/images/og-docs.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/data-fog/0BxL0tPiC_05TBLu/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"datafog\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#A83226\">\u003cmeta data-mint-head name=\"theme-color\" content=\"#0E1316\">\u003cmeta data-mint-head name=\"og:image:type\" content=\"image/png\">\u003cmeta data-mint-head name=\"og:image:alt\" content=\"datafog documentation — Guides for MCP and Core SDK.\">\u003cmeta data-mint-head name=\"twitter:image:alt\" content=\"datafog documentation — Guides for MCP and Core SDK.\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.datafog.ai/reference/bearer-token\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/reference/bearer-token.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.datafog.ai/#organization\",\"name\":\"datafog\",\"url\":\"https://docs.datafog.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/data-fog/c_gYqIyRG2e6pQHL/images/datafog-wordmark-light.svg?fit=max\u0026auto=format\u0026n=c_gYqIyRG2e6pQHL\u0026q=85\u0026s=42268b386b96762a93277a16809d5060\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.datafog.ai#website\",\"name\":\"datafog\",\"url\":\"https://docs.datafog.ai\",\"publisher\":{\"@id\":\"https://docs.datafog.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.datafog.ai/reference/bearer-token#webpage\",\"url\":\"https://docs.datafog.ai/reference/bearer-token\",\"name\":\"Bearer tokens\",\"description\":\"Detect explicit Authorization header credentials with precise token spans.\",\"dateModified\":\"2026-10-12T22:33:55.393Z\",\"isPartOf\":{\"@id\":\"https://docs.datafog.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.datafog.ai/reference/bearer-token#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.datafog.ai/reference/bearer-token#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Reference\",\"item\":\"https://docs.datafog.ai/reference/rust\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Detection coverage\",\"item\":\"https://docs.datafog.ai/reference/german-entities\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Bearer tokens\",\"item\":\"https://docs.datafog.ai/reference/bearer-token\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.datafog.ai/reference/bearer-token#article\",\"headline\":\"Bearer tokens\",\"name\":\"Bearer tokens\",\"description\":\"Detect explicit Authorization header credentials with precise token spans.\",\"url\":\"https://docs.datafog.ai/reference/bearer-token\",\"mainEntityOfPage\":{\"@id\":\"https://docs.datafog.ai/reference/bearer-token#webpage\"},\"image\":\"https://docs.datafog.ai/images/og-docs.png\",\"dateModified\":\"2026-10-12T22:33:55.393Z\",\"publisher\":{\"@id\":\"https://docs.datafog.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.datafog.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"datafog\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"datafog\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/reference/bearer-token.md","siteName":"datafog","nav":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/DataFog"}]},"tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":""}]},{"tab":"MCP","pages":[{"title":"MCP","href":"/mcp/quickstart"}]},{"tab":"Core SDK","groups":[{"group":"Get started","pages":[{"sidebarTitle":"Overview","title":"datafog core","icon":"shield-halved","href":"/core"},{"title":"Installation","icon":"download","href":"/get-started/installation"},{"title":"Quickstart","icon":"play","href":"/get-started/quickstart"}]},{"group":"Core concepts","pages":[{"title":"Findings and text ranges","icon":"location-crosshairs","href":"/concepts/findings-and-ranges"},{"title":"Privacy transformations","icon":"wand-magic-sparkles","href":"/concepts/privacy-transformations"}]},{"group":"Guides","pages":[{"title":"Migrate from datafog Python","icon":"arrow-right-arrow-left","href":"/guides/migrating-from-datafog-python"},{"title":"Configure transformations","icon":"sliders","href":"/guides/configuration"},{"title":"Email boundaries in source files","href":"/guides/email-boundaries"},{"title":"Pseudonymization","icon":"key","href":"/guides/pseudonymization"},{"title":"Tokenization and restoration","icon":"rotate","href":"/guides/tokenization-and-restoration"},{"title":"Discover and protect person fields","icon":"user-shield","href":"/guides/person-discovery"}]},{"group":"Reference","pages":[{"group":"SDK reference","expanded":false,"pages":[{"title":"Rust","icon":"gear","href":"/reference/rust"},{"title":"Python","icon":"python","href":"/reference/python"},{"title":"Node.js","icon":"node-js","href":"/reference/node"},{"title":"Browser / WASM","icon":"globe","href":"/reference/browser-wasm"},{"title":"Errors","icon":"triangle-exclamation","href":"/reference/errors"},{"title":"Runtime capabilities","href":"/reference/capabilities"},{"title":"Compatibility policy","href":"/reference/compatibility"}]},{"group":"Detection coverage","expanded":false,"pages":[{"title":"German entities","icon":"fingerprint","href":"/reference/german-entities"},{"title":"JWT","description":"Recognize compact JSON Web Tokens and transform their full spans.","href":"/reference/jwt"},{"title":"Bearer tokens","href":"/reference/bearer-token"},{"title":"Private keys","description":"Detect and transform complete PEM private-key blocks across all runtimes.","href":"/reference/private-keys"},{"title":"API keys","href":"/reference/api-keys"},{"title":"UUID identifiers","icon":"fingerprint","href":"/reference/uuid"},{"title":"US routing numbers","href":"/reference/us-routing-number"},{"title":"Labelled account numbers","href":"/reference/account-number"},{"title":"Labelled street addresses","href":"/reference/street-address"},{"title":"Embedded name and address detection","href":"/reference/embedded-cnn"},{"title":"National Provider Identifiers","href":"/reference/npi"},{"title":"Credential URIs","href":"/reference/credential-uri"}]}]},{"group":"Project","pages":[{"group":"Releases","expanded":false,"pages":[{"title":"1.0.0","icon":"tag","href":"/releases/1-0-0"},{"title":"0.5.0 beta.3","icon":"tag","href":"/releases/0-5-0-beta-3"},{"title":"0.5.0 beta.2","icon":"tag","href":"/releases/0-5-0-beta-2"},{"title":"0.5.0 beta.1","icon":"tag","href":"/releases/0-5-0-beta-1"},{"title":"0.4.5 beta.4","icon":"tag","href":"/releases/0-4-5-beta-4"},{"title":"0.4.5 beta.3","icon":"tag","href":"/releases/0-4-5-beta-3"},{"title":"0.4.4","icon":"tag","href":"/releases/0-4-4"},{"title":"0.4.3","icon":"tag","href":"/releases/0-4-3"},{"title":"0.4.2","icon":"tag","href":"/releases/0-4-2"},{"title":"0.4.1","icon":"tag","href":"/releases/0-4-1"},{"title":"0.4.0","icon":"tag","href":"/releases/0-4-0"},{"title":"0.3.1","icon":"tag","href":"/releases/0-3-1"},{"title":"0.3.0","icon":"tag","href":"/releases/0-3-0"}]},{"group":"Contributing","expanded":false,"pages":[{"title":"Development","icon":"code","href":"/development"}]}]}]},{"tab":"Research","pages":[{"title":"Research","href":"/research/local-pii-model"}]}]},"basePath":"","title":"Bearer tokens - datafog","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":[],"chunks":[]}