Giter VIP home page Giter VIP logo

sdk's Introduction

infisical

The open-source secret management platform: Sync secrets/configs across your team/infrastructure and prevent secret leaks.

Deploy to DO

Dashboard

Introduction

Infisical is the open source secret management platform that teams use to centralize their secrets like API keys, database credentials, and configurations.

We're on a mission to make secret management more accessible to everyone, not just security teams, and that means redesigning the entire developer experience from ground up.

Features

And much more.

Getting started

Check out the Quickstart Guides

Use Infisical Cloud Deploy Infisical on premise
The fastest and most reliable way to
get started with Infisical is signing up
for free to Infisical Cloud.

View all deployment options

Run Infisical locally

To set up and run Infisical locally, make sure you have Git and Docker installed on your system. Then run the command for your system:

Linux/macOS:

git clone https://github.com/Infisical/infisical && cd "$(basename $_ .git)" && cp .env.example .env && docker-compose -f docker-compose.prod.yml up

Windows Command Prompt:

git clone https://github.com/Infisical/infisical && cd infisical && copy .env.example .env && docker-compose -f docker-compose.prod.yml up

Create an account at http://localhost:80

Scan and prevent secret leaks

On top managing secrets with Infisical, you can also scan for over 140+ secret types in your files, directories and git repositories.

To scan your full git history, run:

infisical scan --verbose

Install pre commit hook to scan each commit before you push to your repository

infisical scan install --pre-commit-hook

Lean about Infisical's code scanning feature here

Open-source vs. paid

This repo available under the MIT expat license, with the exception of the ee directory which will contain premium enterprise features requiring a Infisical license.

If you are interested in managed Infisical Cloud of self-hosted Enterprise Offering, take a look at our website or book a meeting with us:

Schedule a meeting

Security

Please do not file GitHub issues or post on our public forum for security vulnerabilities, as they are public!

Infisical takes security issues very seriously. If you have any concerns about Infisical or believe you have uncovered a vulnerability, please get in touch via the e-mail address [email protected]. In the message, try to provide a description of the issue and ideally a way of reproducing it. The security team will get back to you as soon as possible.

Note that this security address should be used only for undisclosed vulnerabilities. Please report any security problems to us before disclosing it publicly.

Contributing

Whether it's big or small, we love contributions. Check out our guide to see how to get started.

Not sure where to get started? You can:

  • Join our Slack, and ask us any questions there.
  • Join our community calls every Wednesday at 11am EST to ask any questions, provide feedback, hangout and more.

Resources

  • Docs for comprehensive documentation and guides
  • Slack for discussion with the community and Infisical team.
  • GitHub for code, issues, and pull requests
  • Twitter for fast news
  • YouTube for videos on secret management
  • Blog for secret management insights, articles, tutorials, and updates
  • Roadmap for planned features

Acknowledgements

sdk's People

Contributors

danielhougaard avatar maidul98 avatar rustaceanrob avatar vmatsiiako avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sdk's Issues

Unable to use python SDK

Hi, I'm unable to use the python sdk because I can't import the necessary classes. Here's the basic code I'm using to test this:

import os
# from infisical import ClientSettings
from infisical_client import InfisicalClient, ClientSettings

client = InfisicalClient(ClientSettings(
    client_id=os.environ.get("INFISICAL_CLIENT_ID"),
    client_secret=os.environ.get("INFISICAL_CLIENT_SECRET"),
))

test_api_key = client.createSecret(
    secret_name="TEST_API_KEY",
    secret_value="test api key",
    project_id="local-test",
    environment="dev",
)

print(f"test api key is: {test_api_key}")

Running this code generates this error:

Traceback (most recent call last):
  File "/path/to/my/project/infisical.py", line 3, in <module>
    from infisical_client import InfisicalClient, ClientSettings
  File "/path/to/my/project/.venv/lib/python3.9/site-packages/infisical_client/__init__.py", line 3, in <module>
    from .infisical_client import InfisicalClient as InfisicalClient
  File "/path/to/my/project/.venv/lib/python3.9/site-packages/infisical_client/infisical_client.py", line 3, in <module>
    from .schemas import ClientSettings, Command, SecretElement
ModuleNotFoundError: No module named 'infisical_client.schemas'

Note that the import statements I used are from your current documentation. So I changed the import statements to the following:

from infisical import ClientSettings
from infisical_client import InfisicalClient

Using those imports, the error became the following:

Traceback (most recent call last):
  File "/path/to/my/project/infisical.py", line 2, in <module>
    from infisical import ClientSettings
  File "/path/to/my/project/infisical.py", line 2, in <module>
    from infisical import ClientSettings
ImportError: cannot import name 'ClientSettings' from partially initialized module 'infisical' (most likely due to a circular import) (/path/to/my/project/infisical.py)

Lastly, I changed the import statements again to the following:

from infisical import ClientSettings, InfisicalClient

And the error message remained the same:

Traceback (most recent call last):
  File "/path/to/my/project/infisical.py", line 2, in <module>
    from infisical import ClientSettings, InfisicalClient
  File "/path/to/my/project/infisical.py", line 2, in <module>
    from infisical import ClientSettings, InfisicalClient
ImportError: cannot import name 'ClientSettings' from partially initialized module 'infisical' (most likely due to a circular import) (/path/to/my/project/infisical.py)

I got these errors using both v2.0.6 and v2.0.7 of the SDK.


  • What Python version are you using? 3.9.13
  • What operating system are you getting the error on? MacOS arm64 (M1)

add .whl file to PyPI

Could you provide a .whl file for the infisical_python package?
I have so installation issues with the tar.gz that you provide....
I takes forever and at the end i get an error.

I tried different versions (2.0.5, 2.0.3) and different Python versions (3.9/3.11)

I really would try out your stuff....

Using cached infisical_python-2.0.6.tar.gz (39 kB)
Installing build dependencies: started
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: finished with status 'error'
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [7 lines of output]
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001B88A26D150>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/maturin/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001B88A2C7090>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/maturin/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001B88DA8CFD0>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/maturin/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001B88DA8DE90>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/maturin/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001B88DA8E550>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/maturin/
ERROR: Could not find a version that satisfies the requirement maturin<0.15,>=0.14 (from versions: none)
ERROR: No matching distribution found for maturin<0.15,>=0.14
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

Can't retrieve secrets with Python SDK

Running copy / past code from quick start:

if_client = InfisicalClient(ClientSettings(
    client_id = os.environ.get('INFISICAL_MACHINE_ID'),
    client_secret = os.environ.get('INFISICAL_TOKEN')
))
neo_host = if_client.getSecret(options = GetSecretOptions(
    project_id = 'Hunome',
    environment = 'dev',
    secret_name = 'HNM_NEO4J_HOST'
))

I run into the following error:

Exception                                 Traceback (most recent call last)
Cell In[29], line 6
      1 from infisical_client import InfisicalClient, ClientSettings, GetSecretOptions
      2 if_client = InfisicalClient(ClientSettings(
      3     client_id = os.environ.get('INFISICAL_MACHINE_ID'),
      4     client_secret = os.environ.get('INFISICAL_TOKEN')
      5 ))
----> 6 neo_host = if_client.getSecret(options = GetSecretOptions(
      7     project_id = 'Hunome',
      8     environment = 'dev',
      9     secret_name = 'HNM_NEO4J_HOST'
     10 ))

File ~/project_path/.venv/lib/python3.11/site-packages/infisical_client/infisical_client.py:42, in InfisicalClient.getSecret(self, options)
     41 def getSecret(self, options: GetSecretOptions) -> SecretElement:
---> 42     result = self._run_command(Command(get_secret=options))
     44     return ResponseForGetSecretResponse.from_dict(result).data.secret

File ~/project_path/.venv/lib/python3.11/site-packages/infisical_client/infisical_client.py:36, in InfisicalClient._run_command(self, command)
     33 response = json.loads(response_json)
     35 if response["success"] == False:
---> 36     raise Exception(response["errorMessage"])
     38 return response

Exception: [Bad request]: failed to find bot key

The auth (client id / secret) is fine, if I mess with that, HTTP 403 is reported. Project with the name provided as project_id (do not see any other ID for the project in web ui), environment and secret with the name exist. Was working like charm with the old SDK infisical==1.4.1.

SDK: infisical-python==2.1.6 @ Python-3.11.6 on Linux

Poetry complains about validation of RECORD file failed

I updated through Poetry to the latest stable available version of infisical-python package (2.1.9) and during the installation of the update, the following poetry warning showed up:

Warning: Validation of the RECORD file of infisical_python-2.1.9-cp311-none-win_amd64.whl failed. Please report to the maintainers of that package so they can fix their build process. Details:
In C:\Users\linux\AppData\Local\pypoetry\Cache\artifacts\55\01\a8\4ab0295bc2593e0bbaf0f6f6383adb19acb48e945ecf0d973b39975513\infisical_python-2.1.9-cp311-none-win_amd64.whl, infisical_client/schemas.py is not mentioned in RECORD

Java SDK: Unknown Issuer when accessing selfhosted Infiscal

Our developers are facing connection issues using the latest infisical SDK 2.1.3-SNAPSHOT with java 11 on windows.

Our selfhosted infisical instance uses a ssl cert from our internal CA. We've added its certificate to java and system trust store and we are sure this is functional because of other services with our own certs that can be be accessed within java.

The windows setup is working well using a cert from a public CA - but due to corporate restricitions we should stick to our own certs.

It is also worth mentioning, that this only occurs on a windows setup.
Our services deployed and used on linux are working fine.

Logs:

.   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v2.3.12.RELEASE)

2024-01-30 08:44:30.456  INFO 29296 --- [           main] x.x.Application                          : Starting Application on araLap129 with PID 29296 
2024-01-30 08:44:30.458  INFO 29296 --- [           main] x.x.Application                          : The following profiles are active: local
2024-01-30 08:44:31.610  INFO 29296 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Solr repositories in DEFAULT mode.
2024-01-30 08:44:31.692  INFO 29296 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 73ms. Found 4 Solr repository interfaces.
2024-01-30 08:44:32.272  INFO 29296 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8082 (http)
2024-01-30 08:44:32.279  INFO 29296 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-01-30 08:44:32.279  INFO 29296 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.46]
2024-01-30 08:44:32.421  INFO 29296 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-01-30 08:44:32.422  INFO 29296 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1920 ms
2024-01-30 08:44:33.674  INFO 29296 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2024-01-30 08:44:33.772  INFO 29296 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2024-01-30 08:44:33.895  INFO 29296 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'taskScheduler'
2024-01-30 08:44:33.949  INFO 29296 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8082 (http) with context path ''
2024-01-30 08:44:34.510  INFO 29296 --- [           main] x.x.Application                          : Started Application in 4.369 seconds (JVM running for 5.905)
2024-01-30 08:44:34.514  INFO 29296 --- [           main] x.x..SolrReindexingCronJob               : starting solr reindexing
2024-01-30 08:44:34.606 ERROR 29296 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.RuntimeException: error sending request for url (https://secrets.db.siedle.de/api/v1/auth/universal-auth/login): error trying to connect: invalid peer certificate: UnknownIssuer
    at com.infisical.sdk.InfisicalClient.errorCheck(InfisicalClient.java:132) ~[sdk-2.1.3-20240126.225859-1.jar:na]
    at com.infisical.sdk.InfisicalClient.getSecret(InfisicalClient.java:40) ~[sdk-2.1.3-20240126.225859-1.jar:na]
    at x.x.SecretResolver.getSecret(SecretResolver.java:38) ~[classes/:na]
    [...]

2024-01-30 08:44:35.324  INFO 29296 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService 'taskScheduler'
2024-01-30 08:44:35.325  INFO 29296 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

Process finished with exit code 1

Python/SDK: Critical errors with pyo3

I have notice that when a server is running for +1 day using the infisical sdk errors will start showing up from pyo3 complaining about "No file handlers available". The only way to fix this is to restart the container running the python server.

This issue didn't happen with https://github.com/Infisical/infisical-python

Example Code (Throws error):

import time
from infisical_client import InfisicalClient, EncryptSymmetricOptions, DecryptSymmetricOptions

while True:
    #client = InfisicalClient()
    key = InfisicalClient().createSymmetricKey()
    encryptOptions = EncryptSymmetricOptions(
        key=key,
        plaintext="Infisical is awesome!"
    )

    encryptedData = InfisicalClient().encryptSymmetric(encryptOptions)

    decryptOptions = DecryptSymmetricOptions(
        ciphertext=encryptedData.ciphertext,
        iv=encryptedData.iv,
        tag=encryptedData.tag,
        key=key
    )

    decryptedString = InfisicalClient().decryptSymmetric(decryptOptions)
    print(f"Key={key}, cipher={decryptedString}")

Example Code (Works as intended):

import time
from infisical_client import InfisicalClient, EncryptSymmetricOptions, DecryptSymmetricOptions

while True:
    client = InfisicalClient()
    key = client.createSymmetricKey()
    encryptOptions = EncryptSymmetricOptions(
        key=key,
        plaintext="Infisical is awesome!"
    )

    encryptedData = client.encryptSymmetric(encryptOptions)

    decryptOptions = DecryptSymmetricOptions(
        ciphertext=encryptedData.ciphertext,
        iv=encryptedData.iv,
        tag=encryptedData.tag,
        key=key
    )

    decryptedString = client.decryptSymmetric(decryptOptions)
    print(f"Key={key}, cipher={decryptedString}")

@DanielHougaard Any ideas?

Python SDK: ModuleNotFoundError: No module named 'infisical_py'

When trying to use this new SDK, as per the official documentation, I'm getting this error.
Upon inspecting the installed package I see that there seems to be missing files inside the root directory.
Is this a known issue? Should I migrate back to the old package?

Error aws lambda function when building with Mac AppleSilicon

When trying to deploy a AWS lambda function with NodeJs (Typescript) using Infisical SDK I get the following:

✘ [ERROR] No loader is configured for ".node" files: asset-input/node_modules/@infisical/sdk-darwin-arm64/infisical.darwin-arm64.node

asset-input/node_modules/@infisical/sdk/binding.js:141:36:
  141 │             nativeBinding = require('@infisical/sdk-darwin-arm64')
      ╵    

Command ran: npx ts-node --prefer-ts-exts bin/sqs-lambda.ts

Context

"@infisical/sdk": "^2.1.8",
Apple M2
MacOs Sonoma (14.3.1)

Java SDK: Unable to load library 'infisical_c'

We tried to use your most recent SDK v2.0.6-SNAPSHOT for Java to get secrets from our selfhosted Infisical Instance.
After adding the maven package to our pom and finishing development, building on both, windows and linux, failed.

On Windows it seems like infisical_c was expected in directory win32-x86-64, but the sdk-jar only contains the folder windows-x64
On Linux the files are expected in linux-x86-64, but no folder has a matching name.

After renaming windows-x64 to win32-x86-64 for windows and ubuntu-x64 to linux-x86-64 for linux the build was successful in both systems.

Getting Started for JNA seems to be relevant here.

Logs
Windows:

Suppressed: java.lang.UnsatisfiedLinkError: The specified module could not be found.

        at com.sun.jna.Native.open(Native Method) ~[jna-5.12.1.jar:5.12.1 (b0)]
        at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:270) ~[jna-5.12.1.jar:5.12.1 (b0)]
        ... 143 common frames omitted
    Suppressed: java.io.IOException: Native library (win32-x86-64/infisical_c.dll) not found in resource path (...;workspace\.m2\repository\com\infisical\sdk\2.0.6-SNAPSHOT\sdk-2.0.6-SNAPSHOT.jar;...)

Linux:

org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.siedle.digitalplatform.sps.util.SecretResolver]: Constructor threw exception; nested exception is java.lang.UnsatisfiedLinkError: Unable to load library 'infisical_c':
libinfisical_c.so: cannot open shared object file: No such file or directory
Native library (linux-x86-64/libinfisical_c.so) not found in resource path (.../var/workspace/?/.m2/repository/com/infisical/sdk/2.0.6-SNAPSHOT/sdk-2.0.6-SNAPSHOT.jar...)

Support For Deno

I'm working to integrate Infisical with my Supabase Edge Functions, which all run on Deno. However when I try to import the sdk (via import { InfisicalClient } from 'npm:@infisical/sdk';, I get an error that npm package '@infisical/sdk-darwin-arm64' does not exist

This is my first time working with Deno, so I'm not positive if this is a package problem or an engine problem, apologies if I should be posting this elsewhere.

Thanks!

Error trying to connect: invalid peer certificate: BadSignature

Trying to migrate from the old SDK to the new SDK (poor communication on Infisical's behalf by the way, customers weren't given a warning ahead of time and half of my website practically went offline).

Unfortunately, the new SDK is giving an error:

    dsn = infisical_client.getSecret(options=GetSecretOptions(environment="prod", project_id="<project>", secret_name="<name>")).secret_value
  File "/usr/local/lib/python3.10/dist-packages/infisical_client/infisical_client.py", line 42, in getSecret
    result = self._run_command(Command(get_secret=options))
  File "/usr/local/lib/python3.10/dist-packages/infisical_client/infisical_client.py", line 36, in _run_command
    raise Exception(response["errorMessage"])
Exception: error sending request for url (https://app.infisical.com/api/v1/auth/universal-auth/login): error trying to connect: invalid peer certificate: BadSignature

I did look this up and apparently this has happened before in a TypeScript integration problem. Doesn't appear to be something I can solve client-side at face value. I have checked the project ID is correct, the client secret and ID are correct too.

My code:

infisical_client = InfisicalClient(ClientSettings(
    client_id="<id>,
    client_secret="<secret>",
))
dsn = infisical_client.getSecret(options=GetSecretOptions(environment="prod", project_id="<something>", secret_name="<value>")).secret_value

Exactly what it says on the documentation. Am I just being silly?

getSecret with 'path' argument returns cached value for different path

Steps to reproduce:

  • create a project with two folders /path_1 and /path_2
  • add MY_SECRET to both folders, but give them different values value_1 and value_2
  • run getSecret while specifying /path_1 in the first call and /path_2 in the second call

getSecret yields the same value for both calls, sometimes value_1, sometimes value_2.

listSecrets lists correct values when specifying path.

My assumption is that keys with similar names but different values should be able to exist in different folders (paths)?

It looks like Infisical's internal cache is not taking path into account?

Please let me know if you need any additional info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.