| Id | ADN0505, the prefix of every message |
|---|---|
recommended | error |
strict | error |
| Fixable | no |
| Needs type information | yes: a typed config (parserOptions.projectService) |
What it reports
A value marked @Sensitive (a field, any field of a @Sensitive class, or a parameter) that reaches one of adorn's own emitters: a @Log method's parameter, or a violation-message parameter. The analysis follows the value through aliases, template interpolation and destructuring. It is the same analysis adorn check runs from the CLI.
Why
adorn redacts by default, and a @Sensitive marking vetoes disclosure even when it is turned on. But JavaScript passes a primitive by value, so once customer.ssn is handed to a parameter, the link back to the @Sensitive field is gone, and the receiving parameter has to be marked too.
Examples
Reported
import { Log, Sensitive } from 'adorn';
class Customer { @Sensitive() ssn = ''; name = ''; }
class Audit { @Log() write(entry: string) { /* … */ } }
function record(c: Customer, audit: Audit) {
audit.write(c.ssn); // Customer.ssn reaches @Log
}
Accepted
import { Log, Sensitive } from 'adorn';
class Customer { @Sensitive() ssn = ''; name = ''; }
class Audit { @Log() write(@Sensitive() entry: string) { /* … */ } }
function record(c: Customer, audit: Audit) {
audit.write(c.ssn);
}
Details
Report-only, permanently: there is no fix, because the right fix (mark the receiver, or don't pass the value) is a judgement. adorn secures its own emitters, not a raw console.log, so that flow is out of scope, as is a derived value such as c.ssn.slice(-4).
To keep a finding on purpose, disable it with a reason, which justify-opt-out checks: // eslint-disable-next-line adorn/no-sensitive-to-adorn-sink -- <why>.
Messages
The text ESLint prints, read from the rule itself. {{…}} is filled in for each finding.
| Message id | Text |
|---|---|
sensitiveReachesEmitter | [ADN0505] {{source}} ({{kind}}) reaches adorn emitter {{sink}} {{via}}. adorn will render this value; mark the receiving parameter @Sensitive, or do not pass it here. |