Bug #235
geschlossenPassword wird bei Eingabe auf Kommandozeile angezeigt
Von rhabacker vor mehr als 4 Jahren hinzugefügt. Vor fast 3 Jahren aktualisiert.
Beschreibung
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.
Dateien
config.h.txt (9,66 KB) config.h.txt | rhabacker, 07.07.2021 08:23 | ||
gwenhywfar-5.9.0-hide-password.patch (864 Bytes) gwenhywfar-5.9.0-hide-password.patch | rhabacker, 10.08.2022 17:49 | ||
0001-Fix-bug-not-hiding-passwort-in-command-line.patch (3,05 KB) 0001-Fix-bug-not-hiding-passwort-in-command-line.patch | rhabacker, 15.08.2022 23:30 |
Von martin vor etwa 4 Jahren aktualisiert
- Status wurde von New zu Feedback geändert
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?
Von rhabacker vor etwa 4 Jahren aktualisiert
- Datei config.h.txt config.h.txt wurde hinzugefügt
ist angehängt
Von rhabacker vor fast 3 Jahren aktualisiert
The issue is still present in version with AqBanking-CLI: 6.5.0 Gwenhywfar: 5.9.0.0 AqBanking: 6.5.0.0
Von martin vor fast 3 Jahren aktualisiert
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
Von rhabacker vor fast 3 Jahren aktualisiert
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
Von martin vor fast 3 Jahren aktualisiert
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
Von rhabacker vor fast 3 Jahren aktualisiert
ja, zum Beispiel mit https://stackoverflow.com/questions/9217908/how-to-disable-echo-in-windows-console
Von rhabacker vor fast 3 Jahren aktualisiert
- Datei gwenhywfar-5.9.0-hide-password.patch wurde hinzugefügt
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.
Von rhabacker vor fast 3 Jahren aktualisiert
- Datei
gwenhywfar-5.9.0-hide-password.patchwurde gelöscht
Von rhabacker vor fast 3 Jahren aktualisiert
- Datei gwenhywfar-5.9.0-hide-password.patch wurde hinzugefügt
Ich habe einen korrigierten Patch hochgeladen (es wurde noch auf CR gewartet, bevor Zeichen zurückgegeben wurden)
Von rhabacker vor fast 3 Jahren aktualisiert
- Datei
gwenhywfar-5.9.0-hide-password.patchwurde gelöscht
Von rhabacker vor fast 3 Jahren aktualisiert
- Datei gwenhywfar-5.9.0-hide-password.patch gwenhywfar-5.9.0-hide-password.patch wurde hinzugefügt
Von martin vor fast 3 Jahren aktualisiert
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
Von rhabacker vor fast 3 Jahren aktualisiert
Patch did not work caused by the issue mentioned at https://stackoverflow.com/questions/46142246/getchar-with-non-canonical-mode-on-unix-and-windows
Von rhabacker vor fast 3 Jahren aktualisiert
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.
Von rhabacker vor fast 3 Jahren aktualisiert
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.
Von rhabacker vor fast 3 Jahren aktualisiert
- Datei 0001-Fix-bug-not-hiding-passwort-in-command-line.patch 0001-Fix-bug-not-hiding-passwort-in-command-line.patch wurde hinzugefügt
Add initial windows implementation of GWEN_Gui_CGui__input().
Von martin vor fast 3 Jahren aktualisiert
- Status wurde von Feedback zu Closed geändert
Thanks, committed to git.
Regards
Martin