Skip to content

One file that is not UTF-8 hides the credentials the local preflight would name #131

Backlog

Description

@ammartahamohamedy

Before a local patch is uploaded, preflight::check names any credential or .env path in it, by file and line. But git::diff refuses the whole patch first when any of it isn't UTF-8 (src/git.rs:443). The preflight never runs (src/hooks.rs:485, src/lib.rs:1212), so the refusal names only the encoding.

Nothing is uploaded either way. But in the pre-push hook, that preflight is the only thing that tells the developer a credential is in what they're pushing:

  • Under the default warn, the push proceeds with a note about encoding, and the credential reaches the remote unmentioned.
  • Under onIncomplete=block, the push stops, but the reason reads like an encoding problem, and the hook offers git push --no-verify.

One Latin-1 or Windows-1252 file anywhere in the range is enough, and those are common in older and Windows repos. proofline review has the same order.

The other two whole-patch refusals skip the preflight the same way: over 5 MiB (git.rs:437) and over 3,000 files (git.rs:440). A regenerated lockfile or a vendored folder in the same push hides a credential too.

Reproduce (offline, no sign-in)

git init -q --bare remote.git
git init -q demo && cd demo
git remote add origin ../remote.git
git commit -q --allow-empty -m base && git push -q origin HEAD:main
proofline hooks install --pre-push
echo 'TOKEN = "ghp_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"' > settings.py
printf 'caf\xe9\n' > menu.txt        # Latin-1
git add . && git commit -qm change
git push origin HEAD:main
# Proofline could not review main: the local changes include text that is not UTF-8, which Proofline cannot review
# The push proceeds without a complete review.

Without menu.txt, the same push says local patch contains a GitHub token at "settings.py":1 (new line).

Proposed fix

Keep every refusal, but have it carry the patch it refused, as lossy text (each invalid byte becomes U+FFFD, so lines and paths keep their places). Callers run the preflight on that text first. A credential is named if there is one; otherwise the original refusal stands. Still nothing is uploaded.

#121 touches the same three refusals in review_local (it adds a --path hint); the two changes would need a small merge there.

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