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

azuredevops_serviceendpoint_npm not triggering a change in plan when a new access_token is provided (if the first 71 characters are the same) #692

Closed
liyaoz opened this issue Jan 18, 2023 · 5 comments
Labels

Comments

@liyaoz
Copy link

liyaoz commented Jan 18, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and Azure DevOps Provider) Version

Latest as of 18/01/2023: Terraform v1.3.7, AzDO provider v0.3

Affected Resource(s)

  • azuredevops_serviceendpoint_npm
  • potentially other azuredevops_serviceendpoint as well.

Terraform Configuration Files

resource "azuredevops_serviceendpoint_npm" "artifactory_npm" { 
  project_id            = "xxxxxx"
  service_endpoint_name = "Artifactory-NPM"
  description           = "NPM service endpoint to artifactory"
  url                   = "https://does.not.matter/"
  access_token          = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXXXXXXXXXXXXXXXXXXXXXX" 
  # -> replace 'X' with anything, remove or add more does not trigger a change in plan
}

Debug Output

Expected Behavior

Terraform plan changes the service connection when a new 'access_token' is supplied

Actual Behavior

> terraform plan
azuredevops_serviceendpoint_npm.artifactory_npm: Refreshing state...

No changes. Your infrastructure matches the configuration.

The Jfrog Artifactory produces an 809 characters access token, and the first 71 characters, unfortunately, does not change for a same user. This causes the service connection to stop working.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@davidcorrigan714
Copy link
Contributor

davidcorrigan714 commented Jan 19, 2023

Just hit this too interestingly enough. Trying to figure out where that 71 character limit is coming from. I'm working on adding the JFrog v2 connections and really thought I had messed something up when testing our rotation logic.

@davidcorrigan714
Copy link
Contributor

Here's the culprit: golang/go#36546

@davidcorrigan714
Copy link
Contributor

I'm switching to Argon2 on our fork. We'll be using Artifatory JWTs with a bunch of service connection types so really they all need to switch. Only downside should be that anyone updating the provider will see all their secrets detect a change and update on the first run. Looks like bcrypt has some constant prefixes to its hashes so I suppose with a bit more work the transition could be improved. I'm planning to submit a PR for the Artifactory v2 connections next week, not sure if the hashing stuff should be in that or Microsoft wants to take on updating that.

@xuzhang3
Copy link
Collaborator

xuzhang3 commented Feb 2, 2023

This is a bug cause by the hash function used to encrypt the access_token

@davidcorrigan714
Copy link
Contributor

The length limitation is going to affect a number of other service connections for us. Namely all generic, Artifactory and Docker Registry connections since we use them with Artifactory that has long JWTs as passwords.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants