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

chore: remove env file usage from tests #3960

Merged
merged 8 commits into from
Feb 16, 2024
Merged

chore: remove env file usage from tests #3960

merged 8 commits into from
Feb 16, 2024

Conversation

vindard
Copy link
Contributor

@vindard vindard commented Feb 9, 2024

Description

Follow-up task would be to cleanup other places the env files are referenced and then to delete them.

TODO:

  • Look for a way to not have duplicated environment variables inlined in Tiltfile and BUCK files

@vindard vindard marked this pull request as draft February 9, 2024 03:37
@github-actions github-actions bot added the core label Feb 9, 2024
@vindard vindard changed the base branch from add-buck-test-filters to main February 9, 2024 13:15
@vindard vindard changed the base branch from main to add-buck-test-filters February 9, 2024 13:15
@vindard vindard force-pushed the add-buck-test-filters branch from 708cdf4 to 36e80d9 Compare February 11, 2024 16:21
@vindard vindard changed the base branch from add-buck-test-filters to main February 14, 2024 02:52
@vindard vindard requested a review from bodymindarts February 14, 2024 02:53
"env_file": attrs.option(
attrs.string(),
doc = """File name and relative path for env variables required.""",
"app_env": attrs.dict(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have build_env (for things like next build) and env (for test-runner like jest) attributes in other places. I chose to go with app_env (for application code) here but open to alternatives

@vindard vindard marked this pull request as ready for review February 14, 2024 02:56
@GaloyMoney GaloyMoney deleted a comment from gitguardian bot Feb 14, 2024
@GaloyMoney GaloyMoney deleted a comment from gitguardian bot Feb 14, 2024
@GaloyMoney GaloyMoney deleted a comment from gitguardian bot Feb 14, 2024
config_file = "test/unit/jest.config.js",
env_file = ".env",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env_json = "//dev:api-env"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context: these variables are pretty much dev environment related so nesting at the dev/ dir level makes sense

@vindard vindard marked this pull request as draft February 15, 2024 13:44
@vindard vindard marked this pull request as ready for review February 15, 2024 17:35
@GaloyMoney GaloyMoney deleted a comment from gitguardian bot Feb 15, 2024
@GaloyMoney GaloyMoney deleted a comment from gitguardian bot Feb 15, 2024
@vindard vindard requested a review from dolcalmi February 16, 2024 15:13
@vindard vindard requested a review from bodymindarts February 16, 2024 15:13
Copy link

gitguardian bot commented Feb 16, 2024

⚠️ GitGuardian has uncovered 6 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
7652397 Triggered Generic High Entropy Secret ee19170 core/api/BUCK View secret
7652397 Triggered Generic High Entropy Secret c987f79 dev/env.json View secret
7652397 Triggered Generic High Entropy Secret c987f79 dev/Tiltfile View secret
7652397 Triggered Generic High Entropy Secret 0c3f0e3 core/api/BUCK View secret
7652397 Triggered Generic High Entropy Secret 0c3f0e3 dev/env.json View secret
7652397 Triggered Generic High Entropy Secret 19400b9 dev/core-bundle/serve-env.json View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

run_cmd_args.add(ctx.attrs.env_json_target)
if hasattr(ctx.attrs, 'env_json'):
run_cmd_args.add("--env-json")
run_cmd_args.add(cmd_args(ctx.attrs.env_json))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to double wrap in cmd_args... in the code I showed you it was required to 'merge' the path (there were 2 arguments).

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

Successfully merging this pull request may close these issues.

2 participants