sideband.allowControlCharacters::
+ifdef::with-breaking-changes[]
By default, control characters that are delivered via the sideband
are masked, except ANSI color sequences. This prevents potentially
- unwanted ANSI escape sequences from being sent to the terminal. Use
- this config setting to override this behavior (the value can be
+ unwanted ANSI escape sequences from being sent to the terminal.
+endif::with-breaking-changes[]
+ifndef::with-breaking-changes[]
+ By default, no control characters delivered via the sideband
+ are masked. This is unsafe and will change in Git v3.* to only
+ allow ANSI color sequences by default, preventing potentially
+ unwanted ANSI escape sequences from being sent to the terminal.
+endif::with-breaking-changes[]
+ Use this config setting to override this behavior (the value can be
a comma-separated list of the following keywords):
+
--
ALLOW_ANSI_CURSOR_MOVEMENTS = 1<<1,
ALLOW_ANSI_ERASE = 1<<2,
ALLOW_ALL_CONTROL_CHARACTERS = 1<<3,
- ALLOW_DEFAULT_ANSI_SEQUENCES = ALLOW_ANSI_COLOR_SEQUENCES
+#ifdef WITH_BREAKING_CHANGES
+ ALLOW_DEFAULT_ANSI_SEQUENCES = ALLOW_ANSI_COLOR_SEQUENCES,
+#else
+ ALLOW_DEFAULT_ANSI_SEQUENCES = ALLOW_ALL_CONTROL_CHARACTERS,
+#endif
} allow_control_characters = ALLOW_CONTROL_SEQUENCES_UNSET;
static inline int skip_prefix_in_csv(const char *value, const char *prefix,
grep "<BOLD;RED>error<RESET>: error" decoded
'
+if test_have_prereq WITH_BREAKING_CHANGES
+then
+ TURN_ON_SANITIZING=already.turned=on
+else
+ TURN_ON_SANITIZING=sideband.allowControlCharacters=color
+fi
+
test_expect_success 'disallow (color) control sequences in sideband' '
write_script .git/color-me-surprised <<-\EOF &&
printf "error: Have you \\033[31mread\\033[m this?\\a\\n" >&2
test_config_global uploadPack.packObjectsHook ./color-me-surprised &&
test_commit need-at-least-one-commit &&
- git clone --no-local . throw-away 2>stderr &&
+ git -c $TURN_ON_SANITIZING clone --no-local . throw-away 2>stderr &&
test_decode_color <stderr >decoded &&
test_grep RED decoded &&
test_grep "\\^G" stderr &&
}'
}
-test_expect_success 'control sequences in sideband allowed by default' '
+test_expect_success 'control sequences in sideband allowed by default (in Git v3.8)' '
write_script .git/color-me-surprised <<-\EOF &&
printf "error: \\033[31mcolor\\033[m\\033[Goverwrite\\033[Gerase\\033[K\\033?25l\\n" >&2
exec "$@"
test_commit need-at-least-one-commit-at-least &&
rm -rf throw-away &&
- git clone --no-local . throw-away 2>stderr &&
+ git -c $TURN_ON_SANITIZING clone --no-local . throw-away 2>stderr &&
test_decode_color <stderr >color-decoded &&
test_decode_csi <color-decoded >decoded &&
test_grep ! "CSI \\[K" decoded &&
test_commit one-more-please &&
rm -rf throw-away &&
- git clone --no-local . throw-away 2>stderr &&
+ git -c $TURN_ON_SANITIZING clone --no-local . throw-away 2>stderr &&
test_decode_color <stderr >color-decoded &&
test_decode_csi <color-decoded >decoded &&
test_grep ! "CSI \\[K" decoded &&
test_grep "\\^\\[\\[K" decoded &&
rm -rf throw-away &&
- git -c "sideband.file://.allowControlCharacters=true" \
+ git -c sideband.allowControlCharacters=false \
+ -c "sideband.file://.allowControlCharacters=true" \
clone --no-local "file://$PWD" throw-away 2>stderr &&
test_decode_color <stderr >color-decoded &&
test_decode_csi <color-decoded >decoded &&