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

Secret referencing not working if referenced secret has overrides #2812

Open
LouisHaftmann opened this issue Nov 28, 2024 · 4 comments
Open

Comments

@LouisHaftmann
Copy link

Describe the bug

Secret referencing does not work if the referenced secret has any user overrides. (also tried with env prefix, eg dev.SECRET)

To Reproduce

Steps to reproduce the behavior:

  1. Create a secret
  2. Add override
  3. Try to reference secret in another secret
  4. See error

Expected behavior

I should be able to reference secrets with overrides.

Screenshots

image
image

@YoungMahesh
Copy link

I tested this on my side, this issue is solved.

Currently, referenced secret not found only happens if suppose staging-value is empty in referenced-secret and you are trying to reference it in the staging-value of current secret, which is correct.

@gee-forr
Copy link

Hi,

I don't think this is fixed.

I've got the same problem as @LouisHaftmann.

I have a bunch of similar variables that need to be overridden per developer... e.g

HOST: some.host.com
URL: https://some.host.com
API_URL: https://some.host.com/api

I want to do this instead:

MY_HOST: please-override-me
HOST: ${dev.MY_HOST}
URL: https://${dev.MY_HOST}
API_URL: https://${dev.MY_HOST}/api

And then have each developer individually override their MY_HOST value with something that will work on their machines. However, when a dev overrides their MY_HOST value to, e.g. my-local-server.test, the variables referencing it continue to evaluate to the original please-override-me.

When I try to update the variable that is referencing MY_HOST, I get the exact same error message as @LouisHaftmann .

@YoungMahesh - I don't understand what you mean by staging-value? Can you elaborate?

@YoungMahesh
Copy link


Screenshot from 2024-12-31 20-05-46

As shown in above screenshot, every secret have 3 environments - Development, Staging, Production.

Considering secrets in above screenshot, I can reference value from MOON.Production to SUN.Production but not to SUN.Staging or SUN.Development

Production secrets can be referenced only in Production, same goes for Development and Staging


You can choose to view or hide environments using menu options (left side of Search-bar) as shown in screenshot below:
Screenshot from 2024-12-31 20-07-28

@gee-forr
Copy link

gee-forr commented Jan 3, 2025

@YoungMahesh - Thanks for clarifying. However, I don't think that's the problem @LouisHaftmann and I are having at all. We are not having problems referencing variables across different environments. We are having problems referencing overridden variables in the same environment.

Here's how to reproduce:

  1. Create a brand new project called e.g. Test
  2. Create a secret in Development called VARIABLE_THAT_IS_OVERRIDDEN with a value of i-should-be-overridden
  3. Create another secret in Development called VARIABLE_THAT_REFS_ANOTHER with a value of ---${dev.VARIABLE_THAT_IS_OVERRIDDEN}-dev
  4. Override VARIABLE_THAT_IS_OVERRIDDEN with a value of i-am-now-overridden
  5. Run infisical secrets. Your output should look like this:
┌─────────────────────────────┬───────────────────────────────────────────┬─────────────┐
│ SECRET NAME                 │ SECRET VALUE                              │ SECRET TYPE │
├─────────────────────────────┼───────────────────────────────────────────┼─────────────┤
│ VARIABLE_THAT_IS_OVERRIDDEN │ i-am-now-overridden                       │ personal    │
│ VARIABLE_THAT_REFS_ANOTHER  │ ---i-should-be-overridden-dev-development │ shared      │
└─────────────────────────────┴───────────────────────────────────────────┴─────────────┘

NOTE that the overridden value of i-am-now-overridden is not being used by VARIABLE_THAT_REFS_ANOTHER, and it's still showing the original value.

  1. Now, go back to the infisical UI, and attempt to edit the value of VARIABLE_THAT_REFS_ANOTHER to something else, whilst still keeping the reference in the value, e.g. set it to ---${dev.VARIABLE_THAT_IS_OVERRIDDEN}-test. When you attempt to save the new value, you will get this error:

Screenshot 2025-01-03 at 13 35 52

I hope that clarifies the issue we're having. Let me know if you need any more info...

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

No branches or pull requests

3 participants