From 59851786d4b0778a530c50e795b0070d681e9edf Mon Sep 17 00:00:00 2001 From: Francesco Renzi Date: Thu, 25 May 2023 10:59:41 +0100 Subject: [PATCH] Add tests to ensure secrets are escaped --- packages/core/__tests__/core.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core/__tests__/core.test.ts b/packages/core/__tests__/core.test.ts index 5011fcc8..09bc587b 100644 --- a/packages/core/__tests__/core.test.ts +++ b/packages/core/__tests__/core.test.ts @@ -161,7 +161,11 @@ describe('@actions/core', () => { it('setSecret produces the correct command', () => { core.setSecret('secret val') - assertWriteCalls([`::add-mask::secret val${os.EOL}`]) + core.setSecret('multi\nline\r\nsecret') + assertWriteCalls([ + `::add-mask::secret val${os.EOL}`, + `::add-mask::multi%0Aline%0D%0Asecret${os.EOL}` + ]) }) it('prependPath produces the correct commands and sets the env', () => {