serokell / coffer

Multi-backend password store with multiple frontends
4 stars 2 forks source link

[#48] Appending reset ANSI control sequences char after printing field value #50

Closed DK318 closed 2 years ago

DK318 commented 2 years ago

Description

Problem

Field contents may contain ANSI control sequences and they can affect other fields.

Solution

Wrapped field value in newtype FieldValue and created the Buildable instance for it which appends reset ANSI control sequences char to field value.

Related issue(s)

:white_check_mark: Checklist for your Pull Request

Related changes (conditional)

Stylistic guide (mandatory)

MagicRB commented 2 years ago

I would compeletely disallow ANSI sequences in field values but this looks ok i guess, only danger is that an attacker can aribtrarily affect the user's terminal, but the code itself LGTM