diff --git a/src/rules/noEncodedPasswords.spec.ts b/src/rules/noEncodedPasswords.spec.ts index 38c4834..f68c9f1 100644 --- a/src/rules/noEncodedPasswords.spec.ts +++ b/src/rules/noEncodedPasswords.spec.ts @@ -6,6 +6,17 @@ describe('noEncodedPasswords', () => { expect(noEncodedPasswords.test(line, 1)).toEqual([]) }) + it('should return an array with a single diagnostic when the line has a SASENC password', () => { + const line = "%put '{SASENC}'; " + expect(noEncodedPasswords.test(line, 1)).toEqual([ + { + warning: 'Line contains encoded password', + lineNumber: 1, + columnNumber: 7 + } + ]) + }) + it('should return an array with a single diagnostic when the line has an encoded password', () => { const line = "%put '{SAS001}'; " expect(noEncodedPasswords.test(line, 1)).toEqual([ diff --git a/src/rules/noEncodedPasswords.ts b/src/rules/noEncodedPasswords.ts index 7b3b68b..2d1a4f8 100644 --- a/src/rules/noEncodedPasswords.ts +++ b/src/rules/noEncodedPasswords.ts @@ -5,7 +5,7 @@ const name = 'noEncodedPasswords' const description = 'Disallow encoded passwords in SAS code.' const warning = 'Line contains encoded password' const test = (value: string, lineNumber: number) => { - const regex = new RegExp(/{sas\d{2,4}}[^;"'\s]*/, 'gi') + const regex = new RegExp(/{sas(\d{2,4}|enc)}[^;"'\s]*/, 'gi') const matches = value.match(regex) if (!matches || !matches.length) return [] return matches.map((match) => ({