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

Runtime permissons request text could be hidden using iTerm custom escape codes #9666

Open
Tracked by #11936
GoldsteinE opened this issue Mar 3, 2021 · 5 comments
Open
Tracked by #11936
Labels
bug Something isn't working cli related to cli/ dir high priority permissions related to --allow-* flags

Comments

@GoldsteinE
Copy link

Script to reproduce:

console.log("\x1b[38;2;255;0;0mPlease, enter 'g' now");
console.log("\x1b]1337;SetColors=fg=fff\x1b\\\x1b]1337;SetColors=bg=fff\x1b\\");
await Deno.permissions.request({ name: "env" });

When running this on iTerm, the only thing visible on the screen is Please, enter 'g' now (and also emoji), and it's not clear that script is actually asking for permissions.

@lucacasonato lucacasonato added bug Something isn't working cli related to cli/ dir permissions related to --allow-* flags labels Mar 3, 2021
@lucacasonato lucacasonato added this to the 1.10.0 milestone Mar 12, 2021
@satyarohith
Copy link
Member

How can it be solved?

@GoldsteinE
Copy link
Author

Setting explicit text color would work, but may be kinda ugly. If we know that we're on iTerm, it's quite simple to reset these settings, but this would require terminal detection. OSC 4 on iTerm reports bg/fg colors, so it's possible to just check that they're not the same / too similar.

It also could be considered a problem with iTerm: maybe iTerm could show confirmation window on changing profile colors.

@bartlomieju bartlomieju modified the milestones: 1.10.0, 1.14.0 Aug 12, 2021
@ry ry mentioned this issue Sep 7, 2021
4 tasks
@bartlomieju bartlomieju modified the milestones: 1.14.0, 1.15.0 Sep 14, 2021
@lucacasonato lucacasonato removed this from the 1.15.0 milestone Oct 11, 2021
@cd-work
Copy link
Contributor

cd-work commented Jul 27, 2022

I think the prompting for permissions on the CLI has some broader problems than just proprietary iTerm escape sequences.

Even scrolling regions (CSI r) and cursor motion (CSI H) can easily move the prompt to the top of the screen, which is trivial to miss when you're at the bottom and just hammering away at your keyboard.

@GoldsteinE
Copy link
Author

I think the general issue is that STDIN can’t be trusted. It can be fabricated or user can be fooled with hiding the prompt one way or another. Script controlling STDOUT has limited control over STDIN which can be potentially used to get more permissions.

@bartlomieju
Copy link
Member

I just tested provided example on latest Deno (1.30.3) and this is what I get:
Screenshot 2023-02-09 at 14 16 31

While the screen has turned white and there's "Please, enter 'g' now", the permission prompt is still somewhat visible (at least the emoji). I guess we should put some escape sequences to reset the color before printing the permission prompt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli related to cli/ dir high priority permissions related to --allow-* flags
Projects
None yet
Development

No branches or pull requests

5 participants