Skip to content

check: a bare -----BEGIN PRIVATE KEY----- (a placeholder in docs) is reported as a private key #53

Closed

Description

@tenphi

In short

  • check's private-key pattern matches the PEM header alone, with no key after it.
  • Docs that show the header as an example or a placeholder get a false warning on every check.
  • A real key always has a base64 body after the header, so the pattern can ask for one.

What happens

SECRET_PATTERNS in src/check.ts (0.8.0 and main):

[/-----BEGIN [A-Z ]*PRIVATE KEY-----/, 'a private key'],

@cube-dev/ui-kit's PasswordInput page shows a field for a PEM key:

<PasswordInput
  label="Private key"
  multiLine
  rows={3}
  placeholder="-----BEGIN PRIVATE KEY-----"
/>

harnesspm check on the package prints:

⚠️  docs/components/fields/PasswordInput.md looks like it contains a private key

Every pack prints it. People learn to ignore the warning, which defeats it.

Reproduction

printf -- '# Key\n\n```\n-----BEGIN PRIVATE KEY-----\n```\n' > docs/key.md
npx -y @tenphi/[email protected] check .   # ⚠️ docs/key.md looks like it contains a private key

Proposal

Match the header followed by a key body, for example:

[/-----BEGIN [A-Z ]*PRIVATE KEY-----\s*[A-Za-z0-9+/=]{40,}/, 'a private key'],

A real key still matches. A header alone, or one followed by ... as a placeholder, doesn't.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions