New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 705155 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug-Regression



Sign in to add a comment

pasting text into password field doesn't work

Project Member Reported by vapier@chromium.org, Mar 24 2017

Issue description

after the changes to rework ttys, pasting early on doesn't work
https://chromium-review.googlesource.com/257080
https://chromium-review.googlesource.com/256129

both before & after, this code fires:
nassh.CommandInstance.prototype.sendString_ = function(string) {
  this.sendToPlugin_('onRead', [0, btoa(string)]);
};

but doesn't look like the plugin reacts to it the same.

probably related, but it looks like we also get for early keystrokes this warning too:
plugin log: onWriteAcknowledge: for unknown file descriptor

but the keystrokes are making it across ...
 

Comment 1 by vapier@chromium.org, Mar 28 2017

the issue is due to how the streams are being piped.  in the old plugin, we'd always write to fd 0 for /dev/stdin and for /dev/tty.  in the new plugin, /dev/stdin is 0 but /dev/tty is 101.

normal keystrokes work because when the plugin sends the JS code the read() request, it tells us which fd to respond on:
nassh.CommandInstance.prototype.onPlugin_.read = function(fd, size) {
  var stream = this.streams_.getStreamByFd(fd);

  if (!stream) {
    console.warn('Attempt to read from unknown fd: ' + fd);
    return;
  }

  stream.asyncRead(size, (b64bytes) => {
    this.sendToPlugin_('onRead', [fd, b64bytes]);
  });
};

the plugin is requesting /dev/tty which is fd 101, so that's what we send each keystroke back to.

however, when we do a paste, we don't hit this code path ... we instead hit the nassh.CommandInstance.prototype.sendString_ which has fd 0 hardcoded.  since the plugin isn't reading that fd, it gets ignored.  once we finish the handshaking, ssh reads from /dev/stdin all the time, so both code paths happen to work fine (for the most part -- it looks like we kind of desync in the i/o layers here, but maybe in practice it doesn't matter?).
Project Member

Comment 2 by bugdroid1@chromium.org, Mar 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/apps/libapps/+/dd31dd8233662170ec893afc1bb3bbda5274e779

commit dd31dd8233662170ec893afc1bb3bbda5274e779
Author: Mike Frysinger <vapier@chromium.org>
Date: Tue Mar 28 21:36:34 2017

nassh: send pasted input to the input buffer

After the tty rewrite, we can't send all input to fd 0 anymore as the
stdin and tty fds have been split.  When ssh asks for data on the tty
port, pasting it to fd 0 (stdin) means it gets queued.  Instead, send
the paste output to the new input stream so it gets routed properly.

BUG= chromium:705155 
TEST=pasted & typed into password field and it worked
TEST=pasted & typed into ssh after connecting and it worked

Change-Id: I990abea3246970a077daf1235064a8a3742030a1
Reviewed-on: https://chromium-review.googlesource.com/461558
Reviewed-by: Rob Ginda <rginda@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/dd31dd8233662170ec893afc1bb3bbda5274e779/nassh/js/nassh_command_instance.js

Comment 3 by vapier@chromium.org, Mar 28 2017

Status: Fixed (was: Available)
this is fixed in 0.8.35.6 now
Status: Verified (was: Fixed)

Sign in to add a comment