You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fail(log.red('Invalid server response:\n${response.body}'));
It would probably be wise to apply some sanitizing to this output, similar to what @themisir did for message="..." in www-authenticate.
IMO, we should break message sanitizing logic into a utility function and use when printing output from a server.
In particular I think it's unreasonable to allow servers to print ANSI escape codes, and such... maybe a few newlines, but not too many. And not too long messages.
I haven't check if there is anything weird you can do here, I'm just imagining there could be...
The text was updated successfully, but these errors were encountered:
Playing around with this a bit it seems ANSI escape codes can be encoded JSON:
import'dart:convert';
voidmain() {
print('# Print test in bold:');
print('\u001b[1m test \u001b[22m');
print('');
print('# Encode as JSON:');
final j = json.encode({'msg':'\u001b[1m test \u001b[22m'});
print(j);
print('');
print('# Print decoded JSON:');
print(json.decode(j));
print('');
print('# Encode as utf8 and print decoded utf-8:');
final b = utf8.encode(j);
print(utf8.decode(b));
print('');
print('# Encode as utf8 and print decoded utf-8 and JSON:');
print(json.decode(utf8.decode(b)));
}
We probably shouldn't allow package repositories to send ANSI escape codes to the terminal.
In
http.dart
we have few function that dumps output from the package repository server to terminal:pub/lib/src/http.dart
Lines 304 to 346 in 570cb28
It would probably be wise to apply some sanitizing to this output, similar to what @themisir did for
message="..."
inwww-authenticate
.IMO, we should break message sanitizing logic into a utility function and use when printing output from a server.
In particular I think it's unreasonable to allow servers to print ANSI escape codes, and such... maybe a few newlines, but not too many. And not too long messages.
I haven't check if there is anything weird you can do here, I'm just imagining there could be...
The text was updated successfully, but these errors were encountered: