Skip to content

safe-bash audit v2: M12 - cut -c silently strips a leading BOM from any line #587

Description

@kamilio

Reference: docs/issues/safe-bash-security-audit-v2.md (Medium finding M12)

M12. cut -c silently strips a leading BOM from any line — BOM_CAPTURE fix incomplete at the command layer

text.ts:331 — per-line new TextDecoder() (ignoreBOM:false). The shell-level fix
(shell.ts:304-305, ignoreBOM:true) is intact, but command-internal decoders were left at
default. PoC: 41 0a ef bb bf 42 0acut -c 1-2 emits 41 0a 42 (mid-file BOM bytes
deleted
); cut -b is correct. Same decoder class (BOM-blind, not byte-corrupting):
search/rg.ts:24, yq/index.ts:389, file/classify.ts:80, html-to-markdown/input.ts:77.
Fix: ignoreBOM:true at text.ts:331 + audit the listed decoders.

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

    bugSomething is not working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions