azure-pipelines-tasks: [REGRESSION]: Secrets cannot contain multiple lines npmAuthenticate

New issue checklist

Task name

npmAuthenticate

Breaking task version

0.241.1

Last working task version

0.238.3

Regression Description

A regression happened!

Yesterday I tryied to run my pipeline and this task failed: image

After some research I’ve found this issue on StackOverflow reporting the same problem and one user suggested that this new version was released. So I tryied to downgrande the version and the task worked:

image

StackOverflow Reference

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

macOS-latest

Relevant log output

Starting: npmAuthenticate
==============================================================================
Task         : npm authenticate (for task runners)
Description  : Don't use this task if you're also using the npm task. Provides npm credentials to an .npmrc file in your repository for the scope of the build. This enables npm task runners like gulp and Grunt to authenticate with private registries.
Version      : 0.241.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/npm-authenticate
==============================================================================
Adding authentication to the .npmrc file at /Users/runner/work/1/s/.npmrc
Adding credentials for the pkgs.dev.azure.com service connection
##[error]Error: Secrets cannot contain multiple lines
Finishing: npmAuthenticate

Full task logs with system.debug enabled

UNSUCCESSFUL RUN
 [REPLACE THIS WITH YOUR INFORMATION] 
SUCCESSFUL RUN
 [REPLACE THIS WITH YOUR INFORMATION] 

Repro steps

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 13
  • Comments: 19 (2 by maintainers)

Commits related to this issue

Most upvoted comments

update: rollback to previous task version should is ongoing.

@killerrin Temporary workaround would be to use

- task: npmAuthenticate@0.238.2

in your pipeline, though in my case I have a lot of pipelines to update 😃

I don’t know. I’m using the Npm Service connection with Personal Access Tokan (PAT) wich is a single line already… Looks like is some internal change on the commit they added a validation to match new lines caracters.

Added setSecret: Sem título

setSecret Implementation: ahá

Maybe, in my case, the Npm Service connection is generating something with new lines characters…

@janharders Unfortunately I don’t know of a way.

Your best bet might be trying to set SYSTEM_UNSAFEALLOWMULTILINESECRET environment variable to TRUE to bypass the multiline error, but it might cause unexpected behavior. I think it might “only” risk leaking your creds to stdout.

Have a look here, how it’s implemented: https://github.com/microsoft/azure-pipelines-task-lib/blob/7c0de0dba61afb899068c35d88257017bd3b4736/node/task.ts#L241

This issue has suddenly resurrected on our pipelines as well. Although in my case I’m already using the npmAuthenticate@0 task, so unfortunately I can’t downgrade as a workaround 😕

We had this issue as well on our pipelines, we have implemented the hard coded previous version to fix our pipelines for now, but I figure the next step is to make our secrets valid by removing anything that flags as multiline?

I have a repro of this issue internally as well. Feel free to reach out.