Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow CrOS Terminal to access GSC #712

Merged
merged 1 commit into from Aug 9, 2022
Merged

Allow CrOS Terminal to access GSC #712

merged 1 commit into from Aug 9, 2022

Conversation

vapier
Copy link
Contributor

@vapier vapier commented Jul 27, 2022

No description provided.

@vapier
Copy link
Contributor Author

vapier commented Jul 27, 2022

i haven't tested this directly, but seems like it should work ?

@emaxx-google
Copy link
Collaborator

emaxx-google commented Jul 27, 2022

i haven't tested this directly, but seems like it should work ?

Let me take a closer look, since the code might not expect the "chrome-untrusted://" scheme. Also the manifest.json might need an "externally_connectable" entry in order to allow these messages (but I don't know off the top of my head whether "chrome-untrusted://" sender is treated like a web page by Chrome Extensions API).

@vapier
Copy link
Contributor Author

vapier commented Jul 27, 2022

i would expect chrome-untrusted:// would be treated the same as chrome-extension://, but who knows

if you have a CrOS device, you should be able to test this now with the Terminal app in R103 in stable

@emaxx-google
Copy link
Collaborator

i would expect chrome-untrusted:// would be treated the same as chrome-extension://, but who knows

if you have a CrOS device, you should be able to test this now with the Terminal app in R103 in stable

Will try later today or tomorrow. Alternatively, if you already have a setup then you can grab the Smart Card Connector built by bots on this PR (the "smart_card_connector_app-pnacl-Debug-app.zip" file on the "Checks" tab is the most convenient, as when loading it manually it'll get the same ExtensionID as the product one: "khpfeaanjngmcnplbdlpegiifgpfgdco").

@vapier
Copy link
Contributor Author

vapier commented Jul 27, 2022

grab the Smart Card Connector built by bots on this PR (the "smart_card_connector_app-pnacl-Debug-app.zip" file on the "Checks" tab is the most convenient

when i click the Checks tab in this PR, i don't see any Files. i see the CLA & CI GH action.

i see in the CI logs it saying it's uploading that zip as an artifact, but i don't see any links to artifacts. i've never used GH to build things, so i don't know what UI i'm supposed to see.

@emaxx-google
Copy link
Collaborator

emaxx-google commented Jul 27, 2022

grab the Smart Card Connector built by bots on this PR (the "smart_card_connector_app-pnacl-Debug-app.zip" file on the "Checks" tab is the most convenient

when i click the Checks tab in this PR, i don't see any Files. i see the CLA & CI GH action.

i see in the CI logs it saying it's uploading that zip as an artifact, but i don't see any links to artifacts. i've never used GH to build things, so i don't know what UI i'm supposed to see.

It's at the bottom of the "CI" page, in the "Artifacts" section (I just checked and it's visible even in Incognito, although files are not downloadable without authentication). In case it still doesn't work, I've reuploaded the file on Google Drive and shared it with you.

@vapier
Copy link
Contributor Author

vapier commented Jul 27, 2022

ok, i see the files at the bottom now

loading the app unpacked doesn't help. Terminal still can't talk to it.

i tried hacking the main manifest & reloading to include:

"externally_connectable": {
    "matches": [
      "chrome-untrusted://terminal/html/terminal_ssh.html"
    ]
  }

but that didn't help either. i don't know how Secure Shell is allowed to communicate with it either though.

@emaxx-google
Copy link
Collaborator

emaxx-google commented Aug 8, 2022

ok, i see the files at the bottom now

loading the app unpacked doesn't help. Terminal still can't talk to it.

i tried hacking the main manifest & reloading to include:

"externally_connectable": {
    "matches": [
      "chrome-untrusted://terminal/html/terminal_ssh.html"
    ]
  }

but that didn't help either. i don't know how Secure Shell is allowed to communicate with it either though.

I've got to testing it, and somehow this patch worked for me. I was able to connect to a remote machine using a Yubikey; without the patch, the Terminal was failing to connect. Are you sure you did the manual test correctly?

As for this:

i don't know how Secure Shell is allowed to communicate with it either though

It's because by default (when externally_connectable is omitted in the manifest), any extension ID is allowed. But as soon as we add it explicitly like in your example, we have to explicitly allow all extensions: "ids": ["*"]. That's the only thing in your code I modified locally.

@vapier
Copy link
Contributor Author

vapier commented Aug 8, 2022

if it works for you, feel free to ignore my testing results. i never use this app myself :).

@emaxx-google
Copy link
Collaborator

emaxx-google commented Aug 8, 2022

Could you update the pull request to add this into manifest.json.template?

  "externally_connectable": {
    "ids": ["*"],
    "matches": [
      "chrome-untrusted://terminal/html/terminal_ssh.html"
    ]
  }

@vapier
Copy link
Contributor Author

vapier commented Aug 8, 2022

does it need to be scoped to a specific page? or can we allow any terminal page?

@emaxx-google
Copy link
Collaborator

does it need to be scoped to a specific page? or can we allow any terminal page?

Any terminal page sgtm too. And I've tested this to work fine:

  "externally_connectable": {
    "ids": ["*"],
    "matches": [
      "chrome-untrusted://terminal/*"
    ]
  },

@vapier
Copy link
Contributor Author

vapier commented Aug 9, 2022

OK, updated now. lmk if i messed something up.

Copy link
Collaborator

@emaxx-google emaxx-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@emaxx-google emaxx-google merged commit 39965c8 into GoogleChromeLabs:main Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants