Bug #235
closedPassword wird bei Eingabe auf Kommandozeile angezeigt
Description
Beim Ausführen von
aqbanking-cli request --aid=16 --balance --fromdate=20210401
mit einem konfigurierten paypal konto wird das Passwort abgefragt:
===== Passwort eingeben =====
Please enter the password for
Paypal user xxx@yyy.zz
Input: xxxxxxx
Dabei wird an Stelle von xxxxx das eingegebene Passwort angezeigt, was aus Sicherheitsgründen unterbleiben sollte.
Wenn jemand in Verbindung mit dem Setzen von AQBANKING_LOGLEVEL=Debug eine Logdatei von der Debugausgabe mit copy and paste erzeugt, ist das Passwort im Klartext enthalten.
Files
Updated by martin over 4 years ago
- Status changed from New to Feedback
Ich habe momentan noch keine Erklaerung dafuer: Normalerweise wird die Eingabe nur ausgegeben, wenn das entsprechende Flag "GWEN_GUI_INPUT_FLAGS_SHOW" angegeben wird, was bei PIN-Eingaben ja nicht der Fall ist. Bei anderen Paswort- oder Pineingaben wird die Eingabe tatsaechlich auch nicht ausgegeben...
Koennte ich eventuell mal die "config.h" aus dem Hauptverzeichnis sehen?
Updated by rhabacker over 3 years ago
The issue is still present in version with AqBanking-CLI: 6.5.0 Gwenhywfar: 5.9.0.0 AqBanking: 6.5.0.0
Updated by martin over 3 years ago
Ich glaube, ich weiss woher das bei Dir kommt: Du hast kein TERMIOS_H...
Falls das vorhanden ist, unterdrueckt GWEN_Gui_CGui__input() das Terminal-Echo der Eingaben ueber die Konsole, dann kommt die Ausgabe nur direkt von GWEN_Gui_CGui__input(), und das gibt fuer Passwoerter nur "*" aus.
Falls TERMIOS_H aber nicht vorhanden ist, kann das Konsolenecho nicht ausgeschaltet werden, und dadurch gibt bei Dir das Konsolenprogramm (bzw. die Linux-Konsole) Deine Eingaben aus. Das kommt dann nicht von Gwen.
Bleibt die Frage: Warum hast Du kein TERMIOS_H?
Gruss
Martin
Updated by rhabacker over 3 years ago
Das Programm läuft auf Windows, siehe dazu https://stackoverflow.com/questions/933745/what-is-the-windows-equivalent-to-the-capabilities-defined-in-sys-select-h-and-t
Updated by martin over 3 years ago
Achso, Windows...
Man muesste dazu die Funktion GWEN_Gui_CGui__input() fuer Windows ersetzen (bzw. dort Funktionen aufrufen, die das Echo aus- und wieder einschalten.
Gruss
Martin
Updated by rhabacker over 3 years ago
ja, zum Beispiel mit https://stackoverflow.com/questions/9217908/how-to-disable-echo-in-windows-console
Updated by rhabacker over 3 years ago
- File gwenhywfar-5.9.0-hide-password.patch added
Ich habe mal den angehängten Patch angewendet und gwenhywfar 5.9.0 damit compiliert. Leider bekomme ich jetzt überhaupt keine Ausgabe von aqbanking-cli mehr :-(. Selbst die --help Option gibt jetzt nichts mehr aus.
Updated by rhabacker over 3 years ago
- File deleted (
gwenhywfar-5.9.0-hide-password.patch)
Updated by rhabacker over 3 years ago
- File gwenhywfar-5.9.0-hide-password.patch added
Ich habe einen korrigierten Patch hochgeladen (es wurde noch auf CR gewartet, bevor Zeichen zurückgegeben wurden)
Updated by rhabacker over 3 years ago
- File deleted (
gwenhywfar-5.9.0-hide-password.patch)
Updated by rhabacker over 3 years ago
Updated by martin over 3 years ago
Hi,
before I apply the patch: Can either of the functions GetStdHandle() or GetConsoleMode() fail? In that case using SetConsoleMode(hStdin, oldmode) in the end might set a value not really previously retrieved.
Also, if we check at the end for "if (hStdIn)", shouldn't we also check hStd after GetStdHandle()?
Regards
Martin
Updated by rhabacker over 3 years ago
Patch did not work caused by the issue mentioned at https://stackoverflow.com/questions/46142246/getchar-with-non-canonical-mode-on-unix-and-windows
Updated by rhabacker over 3 years ago
https://stackoverflow.com/questions/46142246/getchar-with-non-canonical-mode-on-unix-and-windows
I found out that the combination of SetConsoleMode() and getchar() with or without calling _setmode() does not work as expected (no backspace support, no return detection).
Instead I got these test programs https://cplusplus.com/articles/E6vU7k9E/#WIN-e1 and https://cplusplus.com/articles/E6vU7k9E/#WIN-e2 working out of the box including backspace support.
Updated by rhabacker over 3 years ago
test programs https://cplusplus.com/articles/E6vU7k9E/#WIN-e1
From this example I created a quick and dirty replacement for the unix variant of GWEN_Gui_CGui__input() as
int GWEN_Gui_CGui__input(GWEN_UNUSED GWEN_GUI *gui,
uint32_t flags,
char *buffer,
int minLen,
int maxLen,
uint32_t guiid)
{
const char BACKSPACE=8;
const char RETURN=13;
const int show_asterisk = !(flags & GWEN_GUI_INPUT_FLAGS_SHOW);
unsigned char ch=0;
char *p = buffer;
DWORD con_mode;
DWORD dwRead;
HANDLE hIn=GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode( hIn, &con_mode );
SetConsoleMode( hIn, con_mode & ~(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT) );
while(ReadConsoleA( hIn, &ch, 1, &dwRead, NULL) && ch !=RETURN) {
if(ch==BACKSPACE) {
if(p > buffer) {
if(show_asterisk) {
putchar('\b');
putchar(' ');
putchar('\b');
}
p--;
}
} else {
*p++=ch;
if (show_asterisk)
putchar('*');
}
}
putchar('\n');
SetConsoleMode(hIn, con_mode);
return 0;
}
which also works out of the box including backspace support, but adding similar code the present function did not work. It always prints out the associated character on key press and shows all the asterisk after pressing return.
Updated by rhabacker over 3 years ago
- File 0001-Fix-bug-not-hiding-passwort-in-command-line.patch 0001-Fix-bug-not-hiding-passwort-in-command-line.patch added
Add initial windows implementation of GWEN_Gui_CGui__input().
Updated by martin over 3 years ago
- Status changed from Feedback to Closed
Thanks, committed to git.
Regards
Martin