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

AirbyteLib: Add basic secrets management #34822

Merged
merged 9 commits into from
Feb 6, 2024
Merged

Conversation

aaronsteers
Copy link
Collaborator

@aaronsteers aaronsteers commented Feb 4, 2024

This adds a new get_secret() option which retrieves from the following sources, in priority order:

  1. Env variables
  2. Google Colab (if applicable)
  3. User prompt (masked)

This approach allows the same code to run identically, even if the secrets are provided in different ways. For instance, in Colab, a secret might be automatically detected and imported, whereas running locally, the same code will import from an environment variable or otherwise will prompt a user in a masked prompt.

Example from the new run_github.py example script:

import airbyte_lib as ab


GITHUB_TOKEN = ab.get_secret("GITHUB_PERSONAL_ACCESS_TOKEN")


source = ab.get_connector("source-github")
source.set_config({
    "repositories": ["airbytehq/airbyte"],
    "credentials": {
        "personal_access_token": GITHUB_TOKEN
    }
})
source.check()

Copy link

vercel bot commented Feb 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 6, 2024 8:29am

@aaronsteers aaronsteers marked this pull request as ready for review February 5, 2024 01:21
Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

The functionality looks good to me, but the "prompt" source for secrets is incompatible with the live view - like with the normal system prompt, the message to enter the secret flashes shortly, then disappears.

#34782 helps as long as you are in a REPL, but in case you run a python script via python my_script.py, the problem still persists.

Do you plan to implement the auto-loading functionality as described in the tech spec in a follow-up PR?

@aaronsteers
Copy link
Collaborator Author

@flash1293 - Thanks for this review.

Re:

Do you plan to implement the auto-loading functionality as described in the tech spec in a follow-up PR?

Yes. This increment was previously unplanned, but added based on some observations of usage from early testers, and can be incrementally expanded to auto-pull into a setting 'slot' based on name convention.

@aaronsteers aaronsteers merged commit 540b9d4 into master Feb 6, 2024
19 checks passed
@aaronsteers aaronsteers deleted the aj/airbyte-lib/secrets branch February 6, 2024 08:36
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 21, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
jatinyadav-cc pushed a commit to ollionorg/datapipes-airbyte that referenced this pull request Feb 26, 2024
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

Successfully merging this pull request may close these issues.

2 participants