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

Implement safety for ANSI escape sequences #3054

Open
awvalenti opened this issue Jul 30, 2024 · 1 comment
Open

Implement safety for ANSI escape sequences #3054

awvalenti opened this issue Jul 30, 2024 · 1 comment
Labels
feature-request New feature or request

Comments

@awvalenti
Copy link

awvalenti commented Jul 30, 2024

Basically, cat is an unsafe way to display text. cat -v is safer.

According to README, I believe bat doesn't implement this security feature. Unlike cat, bat is only used for human-readable output. For that reason, this may be a good feature. Possibly it could simply replace stuff like <Esc>x with ^[x.

Details:
https://unix.stackexchange.com/questions/780938/is-it-still-unsafe-to-cat-an-arbitrary-file

@awvalenti awvalenti added the feature-request New feature or request label Jul 30, 2024
@eth-p
Copy link
Collaborator

eth-p commented Jul 31, 2024

Just a small tip: although this isn't supported right now, bat -A/--show-all can be used to achieve something similar.

The -A option will replace invisible characters with symbols like and , and Unicode characters will be represented in escape sequence notation (e.g. \u{2500}) instead of being printed directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants