Skip to content

Conversation

junorouse
Copy link

@junorouse junorouse commented Feb 19, 2020

Hello, I add a mitigation for log injection. It prevents that malicious user to do a log injection.

Before

$ curl --request "POST" "http://127.0.0.1:3000/%0a[GIN]%20..%20blahblah"

-->

[GIN] 2020/02/19 - 15:35:08 | 401 |     712.772µs |       127.0.0.1 | POST     /
[GIN] .. blahblah

After

$ curl --request "POST" "http://127.0.0.1:3000/%0a[GIN]%20..%20blahblah"

-->

[GIN] 2020/02/19 - 15:36:56 | 401 |     814.381µs |       127.0.0.1 | POST     "/\n[GIN] .. blahblah"

Thanks.

References

https://www.geeksforgeeks.org/log-injection/
https://golang.org/pkg/fmt/

@junorouse junorouse requested a review from appleboy February 19, 2020 06:52
@appleboy appleboy added this to the 1.6 milestone Feb 21, 2020
@appleboy appleboy requested a review from thinkerou February 21, 2020 06:55
Copy link
Member

@thinkerou thinkerou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thinkerou
Copy link
Member

why pending? @appleboy do you know?

@appleboy
Copy link
Member

@thinkerou I don't know. Maybe we should push a new commit to trigger Travis again.

thinkerou added a commit that referenced this pull request Feb 26, 2020
@thinkerou
Copy link
Member

@appleboy ok please review #2265 , thanks @junorouse again.

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

Successfully merging this pull request may close these issues.

3 participants