Fix on a CRLF file holding a multi-line secret is always rejected
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 78/100
Piste de recherche
Read internal/agent/fixer.go around loadOriginals, restoreSecrets, and hideKnownSecrets, then compare its input handling with the model view in internal/agent/tools/tools.go and internal/walk/walk.go. Update internal/agent/fixer_test.go to build that view in production order and cover CRLF multi-line secrets and a UTF-8 BOM. Done means the marker is accepted, secret bytes and CRLF endings are preserved, and the BOM remains.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
Every fix that touches a CRLF file containing a multi-line secret (for example a PEM block) is rejected, because the redaction marker the model saw was hashed over the LF form and the fixer looks it up over the CRLF form.
Where
internal/agent/fixer.go:108(loadOriginalsreads the raw bytes)internal/agent/fixer.go:142-158(restoreSecrets)internal/agent/tools/tools.go:365-378(model view:walk.ReadTextthenredact.KeepLinesIn)internal/walk/walk.go:387(ReadTextstrips the BOM and turns CRLF into LF)internal/agent/fixer_test.go:486(test builds the view in the opposite order)
Details
The model reads a file through Registry.text: walk.ReadText (strips a UTF-8 BOM, turns every CRLF into LF) and only then redact.KeepLinesIn. The marker for a secret that spans lines therefore carries the hash of the LF form of the value. loadOriginals reads the same file raw and restoreSecrets computes redact.MatchesIn(file, orig) on the CRLF bytes. The value there holds \r\n, so its hash is different, the marker in the model's content never matches, and the check fires: "it holds a redaction marker that stands for no secret in the file". The code clearly means to support this case (the eol handling), and TestRestoreSecretsKeepsAMultiLineKeyInACRLFFile passes only because it redacts the CRLF text first and converts line endings second, the reverse of production.
Same root cause, smaller symptom: ReadText strips the BOM and loadOriginals puts back line endings only, so a fix to a file that starts with a BOM silently removes the BOM and the patch shows line 1 as changed.
Impact
On a checkout with CRLF line endings (the default on Windows with core.autocrlf=true), every fix and every debug fix that touches a file holding a multi-line secret is rejected on every attempt when the model keeps the marker, as the fixer prompt tells it to. The run spends all max_attempts model conversations and reports that no patch passed verification.
Steps to reproduce
- Create
app.pywith CRLF endings holding a triple-quoted PEM private key block and one more line of code. - Take the model view as production does:
redact.KeepLinesIn("app.py", walk.ReadText(abs)), and change the other line. - Pass the result to
loadOriginals(root, {"app.py": content}): it returns the "redaction marker that stands for no secret" error. - Repeat with LF endings: it succeeds.
Suggested fix
In restoreSecrets (and hideKnownSecrets), compute the matches on the view the model had: normalize orig the way walk.ReadText does, take markers and values from that text, and map each value back to its raw form (LF to the file's line ending) before substituting. Put the BOM back when the original had one. Change the test to build the view as production does (KeepLinesIn over the ReadText-normalized text).
Acceptance criteria
- A fix to a CRLF file with a multi-line secret is accepted when the model keeps the marker
- The written file keeps its CRLF endings and the secret bytes unchanged
- A fix to a file with a UTF-8 BOM keeps the BOM
- The test builds the model view in production order
Getting started
- Relevant files: internal/agent/fixer.go, internal/agent/fixer_test.go, internal/agent/tools/tools.go, internal/walk/walk.go
- How to run tests:
make test-short(Unix) or.\make.ps1 test-short(Windows PowerShell);make lintbefore you call it done - Related docs: CONTRIBUTING.md, docs/ARCHITECTURE.md
Filed by repo-audit/full-audit at 50e92ec. Severity: medium. Effort: S. audit-key: bug|internal/agent/fixer.go|restoreSecrets
- Langage dominant
- Go
- Étoiles
- 0
- Forks
- 1
- Merge moyen
- 8 h 14 min
- PR mergées (30 j)
- 3
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Fournit un Dockerfile ou un fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de TMHSDigital/Spackle
-
ci good first issue severity: low
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
TMHSDigital/Spackle#206 ·
Les mainteneurs répondent en général sous 1 jour
-
ci severity: low
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
TMHSDigital/Spackle#205 ·
Les mainteneurs répondent en général sous 1 jour
-
bug good first issue severity: low
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
TMHSDigital/Spackle#199 ·
Les mainteneurs répondent en général sous 1 jour
-
bug good first issue severity: low
Difficulté 2/5 1-3 heures Accessibilité débutants 87/100
TMHSDigital/Spackle#195 ·
Les mainteneurs répondent en général sous 1 jour
-
documentation good first issue severity: medium
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
TMHSDigital/Spackle#188 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de TMHSDigital/Spackle
Issues similaires
-
deskclose human-decided leaves the legacy decision-needed label and applies no human-decidedOuvertebug effort:s impact:med raised-by:worker risk:low to:worker
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
medici-finance/assay#8120 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
factory:subtask
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
agent-substrate/substrate#4308 ·
Les mainteneurs répondent en général sous 2 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
celestiaorg/celestia-app#8877 ·
Les mainteneurs répondent en général sous 1 jour
-
sweep
Difficulté 1/5 Moins d'une heure Accessibilité débutants 84/100
bketelsen/truenas-mcp#112 ·
Les mainteneurs répondent en général sous 1 jour