SecretReasontypeno test imports ittype SecretReason = "private-key" | "cloud-key" | "token" | "named-secret";Why a text was taken for a secret.
A guard against a secret in a model: a model holds a reference to a secret and never the secret, and this finds the text of a desired state that looks like one. It is a guard, never a proof that no secret is present: the rule is that the model holds references only.
import { findSecretLike } from "./secret.ts";
findSecretLike({ content: "-----BEGIN PRIVATE KEY-----" }); // [{ path: "$.content", why: "private-key" }]SecretReasontypeno test imports ittype SecretReason = "private-key" | "cloud-key" | "token" | "named-secret";Why a text was taken for a secret.
SecretFindingtypeno test imports ittype SecretFinding = { readonly path: string; readonly why: SecretReason };A text of a desired state that looks like a secret, and where it is.
findSecretLikefunctionfunction findSecretLike(value: JsonValue, path?: string, key?: string): readonly SecretFinding[]Every text of a value that looks like a secret, by the path where it is: a text in a private key, a key of a cloud or a token of a code host, and any non-empty text under a key named for a secret that is not a reference to one.