Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set npmToken value in npmrc string even when it is not withtin encrypted object #31808

Open
RahulGautamSingh opened this issue Oct 6, 2024 · 0 comments · May be fixed by #31815
Open

Set npmToken value in npmrc string even when it is not withtin encrypted object #31808

RahulGautamSingh opened this issue Oct 6, 2024 · 0 comments · May be fixed by #31815
Assignees
Labels
manager:npm package.json files (npm/yarn/pnpm) priority-2-high Bugs impacting wide number of users or very important features type:bug Bug fix of existing functionality

Comments

@RahulGautamSingh
Copy link
Collaborator

RahulGautamSingh commented Oct 6, 2024

We moved from keeing secrets inside the encrypted object to using the Mend Developer portal for users of the Github App. But, missed to make some necessary modififcations to the logic which would use the npmToken value from the config and replace ${NPM_TOKEN} in the npmrc string with it.

For example:

{
  "npmToken": "{{ secrets.NPM_TOKEN }}",
  "npmrc": "@fortawesome:registry=https://npm.fontawesome.com\n//npm.fontawesome.com/:_authToken=${NPM_TOKEN}"
}

Expected behaviour for the above config is that npmToken value is add to the npmrc string.

But, actually the npmToken value is not added to the npmrc string. And, this causes lookup errors down the line.

Example of such cases: #31707 #31253

Reason for this:

  • decryptConfig fn handles the logic to replace ${NPM_TOKEN} in the npmrc string with value of npmToken.
  • decryptConfig only processes items in the encrypted object.
  • Since npmToken does not necessarily have to be in the encrypted object anymore, this logic fails for Github App users.

Fix:
Reuse the logic in decryptConfig and place it such that the value from npmToken replaces the ${NPM_TOKEN}. Most probably, this logic goes after the secrets have been applied to the config ie. at the end of mergeRenovateConfig fn

Originally posted by @RahulGautamSingh in #31707 (reply in thread)

@RahulGautamSingh RahulGautamSingh added type:bug Bug fix of existing functionality priority-2-high Bugs impacting wide number of users or very important features labels Oct 6, 2024
@RahulGautamSingh RahulGautamSingh self-assigned this Oct 6, 2024
@RahulGautamSingh RahulGautamSingh added the manager:npm package.json files (npm/yarn/pnpm) label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
manager:npm package.json files (npm/yarn/pnpm) priority-2-high Bugs impacting wide number of users or very important features type:bug Bug fix of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant