airbnb / binaryalert

BinaryAlert: Serverless, Real-time & Retroactive Malware Detection.
https://binaryalert.io
Apache License 2.0
1.4k stars 187 forks source link

bug with ssh git repo cloning #124

Closed twaldear closed 6 years ago

twaldear commented 6 years ago

clone_rules.py allows for git ssh urls, but fails when trying to create the target_repo_root variable on ssh urls because it only splits on \\

to: @airbnb/binaryalert-maintainers size: small resolves #123

Background

See issue for stacktrace

Changes

Testing

I ran it locally with both https and ssh urls and confirmed they both work

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.02%) to 92.537% when pulling e23a904d3a1a620ae23dd687ff0e5af2d8e230c7 on twaldear:master into 20cac107ce8cb830dece38f57f4b11d8cef7b82f on airbnb:master.

twaldear commented 6 years ago

hey @austinbyers after going thru the unit tests i realized that my logic was slightly wrong.

an https url would produce:

https://github.com/test-user1/test-repo1 -> github.com/test-user1/test-repo1

but a ssh url would produce

git@github.com:test-user3/test-repo3 -> github.com:test-user3/test-repo3

i updated the code with a conditional to account for the : in ssh urls and pushed the updated unit test up as well