소스 검색

Escape more characters for shell stuff

As reported by Alexey Pronin, this would let people potentially pass in
URLs that can call to command execution.

While running arbitrary code is kind of our bread and butter, it makes
sense to at least play nicely and escape more characters:

- the pipe (`|`) which can be used to run subcommands
- the tab (`\t`) which the shell interprets as a space.
- the home directory (`~`) just because the expansion could behave funny
- redirection (`<` and `>`) to avoid problems with data setting up
  streams
pull/2302/head
Fred Hebert 4 년 전
부모
커밋
2e2d1a6bb1
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. +1
    -1
      src/rebar_utils.erl

+ 1
- 1
src/rebar_utils.erl 파일 보기

@ -962,7 +962,7 @@ url_append_path(Url, ExtraPath) ->
escape_chars(Str) when is_atom(Str) ->
escape_chars(atom_to_list(Str));
escape_chars(Str) ->
re:replace(Str, "([ ()?`!$&;\"\'])", "\\\\&",
re:replace(Str, "([ ()?`!$&;\"\'\|\\t|~<>])", "\\\\&",
[global, {return, list}, unicode]).
%% "escape inside these"

불러오는 중...
취소
저장