# Public output and migration to 0.3

## Decision

The user delegated technical decisions after the raw-helper conflict was
reproduced. The public package interface now masks recognised credentials;
there is no opt-in public path for returning a real database password.
No existing diagnostic, false-positive or secret-regression assertions were
changed for this migration. New public-interface regressions enforce it.

| Entry point | 0.3 behavior |
|---|---|
| Root `diagnoseDatabaseUrl` and subpath `diagnose` | Password placeholders, with recognised credentials also masked in query components and corrected URLs |
| Public `parseConnectionString` | Keeps parsed host/port metadata and `hasPassword`; non-null `rawPassword` becomes `[REDACTED]`; secret query values are masked; failed unparsed `raw` becomes `[INPUT OMITTED]` |
| Public `normaliseInput` | Normalised masked Postgres URI; `[INPUT OMITTED]` for non-Postgres text; empty input remains empty |
| Public `correctedWithPassword` | Deprecated compatibility name; returns masked `diagnose(...).corrected`, never the real password |
| Root/native build decoder and `findEvidence` | Recognised credentials masked in the matching evidence line |
| Public CORS/chunk/header/package helpers | Structured secret-labelled fields and recognised credential strings are masked; cookie header tuples and secret-header getters are protected |
| Environment audit | Never returns assignment keys, values or original lines |

The JSON contract version is unchanged: this does not rename or remove a rule
or change the contract's fields. Native helper semantics changed, which is a
breaking package change and is documented in the changelog.

## Internal processing

The database implementation must inspect raw password characters to identify
encoding errors. Its internal parser and copy routine remain covered by their
original tests. The public `database-url-doctor` export now points to
`src/public-database-url-doctor.js`, which exposes only sanitised versions of
those helpers. Internal implementation files have no public package subpath.
Other parsing helper subpaths also use output guards; native diagnostic exports retain their identity, and unmodified static source objects retain their reference identity.
Consumers must use package exports, not absolute paths into implementation files.
Package export restrictions are an API boundary, not an application sandbox.

Consumers that previously used the public copy helper to obtain a usable URL
must now construct it from their own trusted server-side configuration. A
`[REDACTED]` parsed password is metadata, not a password to use for authentication.

## Limits

Redaction uses documented credential shapes and positions, not arbitrary-secret
recognition: URL passwords, secret-named assignments/query parameters, recognised
auth/cookie headers, JWTs and known token prefixes. It can over-mask public keys
and cannot identify every arbitrary opaque string, custom header, or malformed
credential representation. See the exact list in [CONTRACT.md](CONTRACT.md#redaction).
No zero-leak rate on arbitrary real-world inputs has been established.

The environment audit provides a stronger omission boundary for pasted file
values: it returns static rule prose and line numbers instead of snippets. It
does not certify that an environment file or deployed application is secure.
No input is sent over the network by the deterministic library/CLI/MCP engine.
Installing packages and fetching official sources during verification are
separate network operations, not part of diagnosis.
