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

Scope wildcards in user environment variables not working #13474

Closed
szab100 opened this issue Sep 30, 2022 · 4 comments
Closed

Scope wildcards in user environment variables not working #13474

szab100 opened this issue Sep 30, 2022 · 4 comments
Labels
feature: environment variables meta: stale This issue/PR is stale and will be closed soon team: webapp Issue belongs to the WebApp team type: bug Something isn't working

Comments

@szab100
Copy link
Contributor

szab100 commented Sep 30, 2022

Bug description

It seems that using wildcards (*) in the scopes of user env variables are not working, env vars are only visible in workspaces if the scope is either / or fully qualified (entirely matching the workspace context's owner/repository).

Steps to reproduce

(Self-Hosted: 2022.08.0)

  1. Create an environment variable using * in the repository name, eg "myproject*", which should match "myproject-X", "myprojectXY", etc.
  2. Verify that the newly added env var is NOT accessible from workspaces where the context repo url does match the given pattern.
  3. Verify that the newly added env var is accessible, if you change the scope to the fully qualified owner/repository scope, without wildcards in the repository name (wildcards in the git-org / owner part seems to be working fine).

Workspace affected

No response

Expected behavior

  1. The wildcard matching in repository names should be fixed.

Example repository

No response

Anything else?

  1. The current scope pattern does not seem to take the git provider into account, so the scope of git-org-name/repo-name is matching both the repository github.mycompany.com/git-org-name/repo-name and github.com/git-org-name/repo-name. This is a potentially exploitable security vulnerability, so supporting an optional (backward compatible) additional provider prefix would be preferred, eg all of the following should be valid scopes:

    github.mycompany.com/git-org-name/repo-name ==> should match only github.mycompany.com provider
    git-org-name/repo-name ==> should match any provider
    github.com/git-org-name/repo-name ==> should match only github.com provider

  2. Env variables do not seem to readable by IDE processes. There are several IDE extensions that support taking secrets & other values from OS environment variables, so Gitpod should set the project- and user-specific env variables before spawning the IDE processes.

@szab100 szab100 added the type: bug Something isn't working label Sep 30, 2022
@axonasif axonasif added feature: environment variables team: webapp Issue belongs to the WebApp team labels Sep 30, 2022
@axonasif
Copy link
Member

Related #12877

@axonasif
Copy link
Member

axonasif commented Sep 30, 2022

Env variables do not seem to readable by IDE processes. There are several IDE extensions that support taking secrets & other values from OS environment variables, so Gitpod should set the project- and user-specific env variables before spawning the IDE processes.

Hi @szab100, do you mean the variables from https://gitpod.io/variables? if so, how and where are you trying to use them or pass them to an extension if you are? Also, could you share the extension that you tested with? AFAIK, it should work.

@stale
Copy link

stale bot commented Jan 2, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@szab100
Copy link
Contributor Author

szab100 commented Jun 16, 2023

Env variables do not seem to readable by IDE processes. There are several IDE extensions that support taking secrets & other values from OS environment variables, so Gitpod should set the project- and user-specific env variables before spawning the IDE processes.

Hi @szab100, do you mean the variables from https://gitpod.io/variables? if so, how and where are you trying to use them or pass them to an extension if you are? Also, could you share the extension that you tested with? AFAIK, it should work.

Hey @axonasif, this was reported quite a while ago, but I just tried to recollect my thoughts. And yes, this is about the user-configured env variables. The original issue was that if the scope was set to git-org/* and opened a git-org/projectA git repo, I could not actually see the env var set in the workspace, only when the scope was either */* (global) OR when a fully matching git-org/projectA scope was set, at least on self-hosted. This may be fixed since then.

And yes, the additional note on the IDE extensions was that even when I set env vars to either global or fully matching repo scope, the env vars were visible in SSH and terminals started from the IDEs, but a VSCode extension that was expecting those env vars could not see the env vars I configured (don't remember which extension). I thought this was because the IDE process may not have been spawned from a context where the user env vars were already set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: environment variables meta: stale This issue/PR is stale and will be closed soon team: webapp Issue belongs to the WebApp team type: bug Something isn't working
Projects
Status: In Validation
Development

No branches or pull requests

2 participants