CRLF at Saved Raw Request

11 views
Skip to first unread message

Zaki Akhmad

unread,
May 21, 2013, 12:03:45 AM5/21/13
to zaprox...@googlegroups.com, zaproxy...@googlegroups.com
Hello,

I am using git to track my files.

When I saved one of the request as raw using ZAP, the git found this
file error:

za@(master)$ git add .
fatal: CRLF would be replaced by LF in zap/login-request.raw.

How to resolve this issue?

Regards,
--
Zaki Akhmad
OWASP Indonesia
http://www.owasp.org/index.php/Indonesia
http://www.owasp.or.id

thc202

unread,
May 21, 2013, 11:23:46 AM5/21/13
to zaprox...@googlegroups.com, zaproxy...@googlegroups.com
Hi.

That's because of your Git repository configurations, the end-of-line conversions are active and the conversion is not reversible.

It seems that you have the configuration variable "core.safecrlf" [1] set to true and the "text" or "eol" attributes set [2] (enabling the end-of-line conversions).

From the description of the configuration variable "core.safecrlf" (emphasis mine):

If true, makes git check if converting CRLF is reversible when end-of-line conversion is active. Git will verify if a command modifies a file in the work tree either directly or indirectly. For example, committing a file followed by checking out the same file should yield the original file in the work tree. If this is not the case for the current setting of core.autocrlf, git will reject the file. The variable can be set to "warn", in which case git will only warn about an irreversible conversion but continue the operation.

CRLF conversion bears a slight chance of corrupting data. When it is enabled, git will convert CRLF to LF during commit and LF to CRLF during checkout. A file that contains a mixture of LF and CRLF before the commit cannot be recreated by git. For text files this is the right thing to do: it corrects line endings such that we have only LF line endings in the repository. But for binary files that are accidentally classified as text the conversion can corrupt data.


As the HTTP header should use CRLF as the end-of-line marker you should unset the "text" attribute of the file "login-request.raw" so the content of the HTTP header (and body) is preserved (or alternatively disable the end-of-line conversions).

For more information see the Git configuration variables ("core.safecrlf", "core.eol" and "core.autocrlf") [1] and Git attributes ("text" and "eol" attributes and more specifically the entry "End-of-line conversion") [2].


[1] https://www.kernel.org/pub/software/scm/git/docs/git-config.html
[2] https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

Best regards.
Reply all
Reply to author
Forward
0 new messages