diff --git a/.env.example b/.env.example index 2025622dc..169e6db0d 100644 --- a/.env.example +++ b/.env.example @@ -1,21 +1,19 @@ # Keys -# Required keys for platform encryption/decryption ops -PRIVATE_KEY=replace_with_nacl_sk -PUBLIC_KEY=replace_with_nacl_pk -ENCRYPTION_KEY=replace_with_lengthy_secure_hex +# Required key for platform encryption/decryption ops +ENCRYPTION_KEY=6c1fe4e407b8911c104518103505b218 # JWT # Required secrets to sign JWT tokens -JWT_SIGNUP_SECRET=replace_with_lengthy_secure_hex -JWT_REFRESH_SECRET=replace_with_lengthy_secure_hex -JWT_AUTH_SECRET=replace_with_lengthy_secure_hex +JWT_SIGNUP_SECRET=3679e04ca949f914c03332aaaeba805a +JWT_REFRESH_SECRET=5f2f3c8f0159068dc2bbb3a652a716ff +JWT_AUTH_SECRET=4be6ba5602e0fa0ac6ac05c3cd4d247f +JWT_SERVICE_SECRET=f32f716d70a42c5703f4656015e76200 # JWT lifetime # Optional lifetimes for JWT tokens expressed in seconds or a string # describing a time span (e.g. 60, "2 days", "10h", "7d") JWT_AUTH_LIFETIME= JWT_REFRESH_LIFETIME= -JWT_SERVICE_SECRET= JWT_SIGNUP_LIFETIME= # Optional lifetimes for OTP expressed in seconds @@ -33,21 +31,28 @@ MONGO_PASSWORD=example # Website URL # Required - SITE_URL=http://localhost:8080 # Mail/SMTP -# Required to send emails -# By default, SMTP_HOST is set to smtp.gmail.com -SMTP_HOST=smtp.gmail.com -SMTP_NAME=Team -SMTP_USERNAME=team@infisical.com -SMTP_PASSWORD= +SMTP_HOST= # required +SMTP_USERNAME= # required +SMTP_PASSWORD= # required +SMTP_PORT=587 +SMTP_SECURE=false +SMTP_FROM_ADDRESS= # required +SMTP_FROM_NAME=Infisical # Integration # Optional only if integration is used -OAUTH_CLIENT_SECRET_HEROKU= -OAUTH_TOKEN_URL_HEROKU= +CLIENT_ID_HEROKU= +CLIENT_ID_VERCEL= +CLIENT_ID_NETLIFY= +CLIENT_ID_GITHUB= +CLIENT_SECRET_HEROKU= +CLIENT_SECRET_VERCEL= +CLIENT_SECRET_NETLIFY= +CLIENT_SECRET_GITHUB= +CLIENT_SLUG_VERCEL= # Sentry (optional) for monitoring errors SENTRY_DSN= diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..7a3d61558 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +node_modules +built +healthcheck.js diff --git a/.github/images/star-infisical.gif b/.github/images/star-infisical.gif index bb0752cb7..6d0789969 100644 Binary files a/.github/images/star-infisical.gif and b/.github/images/star-infisical.gif differ diff --git a/.github/resources/docker-compose.be-test.yml b/.github/resources/docker-compose.be-test.yml new file mode 100644 index 000000000..6efdd87f6 --- /dev/null +++ b/.github/resources/docker-compose.be-test.yml @@ -0,0 +1,30 @@ +version: '3' + +services: + backend: + container_name: infisical-backend-test + restart: unless-stopped + depends_on: + - mongo + image: infisical/backend:test + command: npm run start + environment: + - NODE_ENV=production + - MONGO_URL=mongodb://test:example@mongo:27017/?authSource=admin + - MONGO_USERNAME=test + - MONGO_PASSWORD=example + networks: + - infisical-test + + mongo: + container_name: infisical-mongo-test + image: mongo + restart: always + environment: + - MONGO_INITDB_ROOT_USERNAME=test + - MONGO_INITDB_ROOT_PASSWORD=example + networks: + - infisical-test + +networks: + infisical-test: diff --git a/.github/resources/healthcheck.sh b/.github/resources/healthcheck.sh new file mode 100755 index 000000000..bc28e3607 --- /dev/null +++ b/.github/resources/healthcheck.sh @@ -0,0 +1,26 @@ +# Name of the target container to check +container_name="$1" +# Timeout in seconds. Default: 60 +timeout=$((${2:-60})); + +if [ -z $container_name ]; then + echo "No container name specified"; + exit 1; +fi + +echo "Container: $container_name"; +echo "Timeout: $timeout sec"; + +try=0; +is_healthy="false"; +while [ $is_healthy != "true" ]; +do + try=$(($try + 1)); + printf "โ "; + is_healthy=$(docker inspect --format='{{json .State.Health}}' $container_name | jq '.Status == "healthy"'); + sleep 1; + if [[ $try -eq $timeout ]]; then + echo " Container was not ready within timeout"; + exit 1; + fi +done diff --git a/.github/workflows/be-test-report.yml b/.github/workflows/be-test-report.yml new file mode 100644 index 000000000..bd57b377e --- /dev/null +++ b/.github/workflows/be-test-report.yml @@ -0,0 +1,41 @@ +name: "Backend Test Report" + +on: + workflow_run: + workflows: ["Check Backend Pull Request"] + types: + - completed + +jobs: + be-report: + name: Backend test report + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: ๐ Download test results + id: download-artifact + uses: dawidd6/action-download-artifact@v2 + with: + name: be-test-results + path: backend + workflow: check-be-pull-request.yml + workflow_conclusion: success + - name: ๐ Publish test results + uses: dorny/test-reporter@v1 + with: + name: Test Results + path: reports/jest-*.xml + reporter: jest-junit + working-directory: backend + - name: ๐ Publish coverage + uses: ArtiomTr/jest-coverage-report-action@v2 + id: coverage + with: + output: comment, report-markdown + coverage-file: coverage/report.json + github-token: ${{ secrets.GITHUB_TOKEN }} + working-directory: backend + - uses: marocchino/sticky-pull-request-comment@v2 + with: + message: ${{ steps.coverage.outputs.report }} diff --git a/.github/workflows/check-be-pull-request.yml b/.github/workflows/check-be-pull-request.yml new file mode 100644 index 000000000..8022a25bc --- /dev/null +++ b/.github/workflows/check-be-pull-request.yml @@ -0,0 +1,42 @@ +name: "Check Backend Pull Request" + +on: + pull_request: + types: [opened, synchronize] + paths: + - "backend/**" + - "!backend/README.md" + - "!backend/.*" + - "backend/.eslintrc.js" + +jobs: + check-be-pr: + name: Check + runs-on: ubuntu-latest + + steps: + - name: โ๏ธ Checkout source + uses: actions/checkout@v3 + - name: ๐ง Setup Node 16 + uses: actions/setup-node@v3 + with: + node-version: "16" + cache: "npm" + cache-dependency-path: backend/package-lock.json + - name: ๐ฆ Install dependencies + run: npm ci --only-production --ignore-scripts + working-directory: backend + - name: ๐งช Run tests + run: npm run test:ci + working-directory: backend + - name: ๐ Upload test results + uses: actions/upload-artifact@v3 + if: always() + with: + name: be-test-results + path: | + ./backend/reports + ./backend/coverage + - name: ๐๏ธ Run build + run: npm run build + working-directory: backend diff --git a/.github/workflows/check-fe-pull-request.yml b/.github/workflows/check-fe-pull-request.yml new file mode 100644 index 000000000..b91e6f060 --- /dev/null +++ b/.github/workflows/check-fe-pull-request.yml @@ -0,0 +1,41 @@ +name: Check Frontend Pull Request + +on: + pull_request: + types: [ opened, synchronize ] + paths: + - 'frontend/**' + - '!frontend/README.md' + - '!frontend/.*' + - 'frontend/.eslintrc.js' + + +jobs: + + check-fe-pr: + name: Check + runs-on: ubuntu-latest + + steps: + - + name: โ๏ธ Checkout source + uses: actions/checkout@v3 + - + name: ๐ง Setup Node 16 + uses: actions/setup-node@v3 + with: + node-version: '16' + cache: 'npm' + cache-dependency-path: frontend/package-lock.json + - + name: ๐ฆ Install dependencies + run: npm ci --only-production --ignore-scripts + working-directory: frontend + # - + # name: ๐งช Run tests + # run: npm run test:ci + # working-directory: frontend + - + name: ๐๏ธ Run build + run: npm run build + working-directory: frontend diff --git a/.github/workflows/close_inactive_issues.yml b/.github/workflows/close_inactive_issues.yml deleted file mode 100644 index 315c9e929..000000000 --- a/.github/workflows/close_inactive_issues.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Close inactive issues -on: - schedule: - - cron: "30 1 * * *" - -jobs: - close-issues: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - uses: actions/stale@v4 - with: - days-before-issue-stale: 30 - days-before-issue-close: 14 - stale-issue-label: "stale" - stale-issue-message: "This issue is stale because it has been open for 30 days with no activity." - close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." - days-before-pr-stale: -1 - days-before-pr-close: -1 - repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 770fa7e83..1e836a178 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -3,35 +3,84 @@ name: Push to Docker Hub on: [workflow_dispatch] jobs: - docker: + backend-image: + name: Build backend image runs-on: ubuntu-latest + steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up QEMU + - name: โ๏ธ Checkout source + uses: actions/checkout@v3 + - name: ๐ง Set up QEMU uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx + - name: ๐ง Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - - name: Login to Docker Hub + - name: ๐ Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push backend + - name: ๐ฆ Build backend and export to Docker + uses: docker/build-push-action@v3 + with: + load: true + context: backend + tags: infisical/backend:test + - name: โป Spawn backend container and dependencies + run: | + docker compose -f .github/resources/docker-compose.be-test.yml up --wait --quiet-pull + - name: ๐งช Test backend image + run: | + ./.github/resources/healthcheck.sh infisical-backend-test + - name: โป Shut down backend container and dependencies + run: | + docker compose -f .github/resources/docker-compose.be-test.yml down + - name: ๐๏ธ Build backend and push uses: docker/build-push-action@v3 with: push: true context: backend - tags: infisical/backend:test - - - name: Build and push frontend + tags: infisical/backend:latest + platforms: linux/amd64,linux/arm64 + + frontend-image: + name: Build frontend image + runs-on: ubuntu-latest + + steps: + - name: โ๏ธ Checkout source + uses: actions/checkout@v3 + - name: ๐ง Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: ๐ง Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: ๐ Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: ๐ฆ Build frontend and export to Docker + uses: docker/build-push-action@v3 + with: + load: true + context: frontend + tags: infisical/frontend:test + build-args: | + POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }} + - name: โป Spawn frontend container + run: | + docker run -d --rm --name infisical-frontend-test infisical/frontend:test + - name: ๐งช Test frontend image + run: | + ./.github/resources/healthcheck.sh infisical-frontend-test + - name: โป Shut down frontend container + run: | + docker stop infisical-frontend-test + - name: ๐๏ธ Build frontend and push uses: docker/build-push-action@v3 with: push: true - file: frontend/Dockerfile.dev context: frontend - tags: infisical/frontend:test + tags: infisical/frontend:latest + platforms: linux/amd64,linux/arm64 + build-args: | + POSTHOG_API_KEY=${{ secrets.PUBLIC_POSTHOG_API_KEY }} diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index 695b0ea24..c5fd9034f 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -13,7 +13,7 @@ permissions: jobs: goreleaser: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 with: @@ -24,6 +24,15 @@ jobs: go-version: '>=1.19.3' cache: true cache-dependency-path: cli/go.sum + - name: libssl1.1 => libssl1.0-dev for OSXCross + run: | + echo 'deb http://security.ubuntu.com/ubuntu bionic-security main' | sudo tee -a /etc/apt/sources.list + sudo apt update && apt-cache policy libssl1.0-dev + sudo apt-get install libssl1.0-dev + - name: OSXCross for CGO Support + run: | + mkdir ../../osxcross + git clone https://github.com/plentico/osxcross-target.git ../../osxcross/target - uses: goreleaser/goreleaser-action@v2 with: distribution: goreleaser diff --git a/.github/workflows/release_docker_k8_operator.yaml b/.github/workflows/release_docker_k8_operator.yaml new file mode 100644 index 000000000..788d414b6 --- /dev/null +++ b/.github/workflows/release_docker_k8_operator.yaml @@ -0,0 +1,29 @@ +name: Release Docker image for K8 operator +on: [workflow_dispatch] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: ๐ง Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: ๐ง Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: ๐ Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: k8-operator + push: true + platforms: linux/amd64,linux/arm64 + tags: infisical/kubernetes-operator:latest \ No newline at end of file diff --git a/.gitignore b/.gitignore index f32a51384..6c4414313 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,9 @@ node_modules .env # testing -/coverage +coverage +reports +junit.xml # next.js /.next/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml index e83973397..5e94e0de6 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -7,12 +7,23 @@ # # you may remove this if you don't need go generate # - cd cli && go generate ./... builds: - - env: - - CGO_ENABLED=0 + - id: darwin-build binary: infisical - id: infisical + env: + - CGO_ENABLED=1 + - CC=/home/runner/work/osxcross/target/bin/o64-clang + - CXX=/home/runner/work/osxcross/target/bin/o64-clang++ goos: - darwin + ignore: + - goos: darwin + goarch: "386" + dir: ./cli + - id: all-other-builds + env: + - CGO_ENABLED=0 + binary: infisical + goos: - freebsd - linux - netbsd @@ -27,8 +38,6 @@ builds: - 6 - 7 ignore: - - goos: darwin - goarch: "386" - goos: windows goarch: "386" - goos: freebsd @@ -71,7 +80,7 @@ nfpms: - id: infisical package_name: infisical builds: - - infisical + - all-other-builds vendor: Infisical, Inc homepage: https://infisical.com/ maintainer: Infisical, Inc @@ -81,6 +90,7 @@ nfpms: - rpm - deb - apk + - archlinux bindir: /usr/bin scoop: bucket: diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..0b3d59a18 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ + +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx lint-staged diff --git a/README.md b/README.md index 1b2d43c5f..3851b3c53 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
@@ -27,6 +27,9 @@
+
+
+
@@ -52,9 +55,15 @@ And more.
To quickly get started, visit our [get started guide](https://infisical.com/docs/getting-started/introduction).
+
| + + โ๏ธ Fiber + + | ++ + โ๏ธ Nuxt + + | +
Someone requested a password reset.
+ Reset password +If you didn't initiate this request, please contact us immediately at team@infisical.com
+ + \ No newline at end of file diff --git a/backend/src/templates/workspaceInvitation.handlebars b/backend/src/templates/workspaceInvitation.handlebars index 22f63efc9..252452ce5 100644 --- a/backend/src/templates/workspaceInvitation.handlebars +++ b/backend/src/templates/workspaceInvitation.handlebars @@ -3,7 +3,7 @@ -CURRENT PLAN
diff --git a/frontend/components/context/Notifications/Notification.tsx b/frontend/components/context/Notifications/Notification.tsx index 974843cf6..ad556a6f5 100644 --- a/frontend/components/context/Notifications/Notification.tsx +++ b/frontend/components/context/Notifications/Notification.tsx @@ -1,35 +1,64 @@ -import { faXmarkCircle } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import classnames from "classnames"; +import { useEffect, useRef } from 'react'; +import { faX } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { Notification as NotificationType } from "./NotificationProvider"; +import { Notification as NotificationType } from './NotificationProvider'; interface NotificationProps { - notification: NotificationType; - clearNotification: (text?: string) => void; + notification: Required{notification.text}
+ {notification.type === 'error' && ( + + )} + {notification.type === 'success' && ( + + )} + {notification.type === 'info' && ( + + )} ++ {notification.text} +
+ Click on an integration to begin syncing secrets to it. +
++ Click on a framework to get the setup instructions. +
+ENVIRONMENT
++ INTEGRATION +
++ Manage your integrations of Infisical with third-party services. +
+Oops, something went wrong
+Think this is a mistake? Email team@infisical.com and we`ll fix it!
+ + Go to Dashboard + +Generate Random Hex
@@ -195,7 +195,7 @@ const KeyPair = ({You are not authorized to view this project.
)} - {fileState.message == "Access needed to pull the latest file" || + {fileState.message == 'Access needed to pull the latest file' || (!isKeyAvailable && ( <>Oops.
+Your email was not verified.
+Please try again.
++ Note: If it still {"doesn't work"}, please reach out to us at + support@infisical.com +
+{t("integrations:title")}
-- {t("integrations:description")} -
-- {t("integrations:available")} -
-- {t("integrations:available-text1")} -
-- {t("integrations:available-text2")} -
-Framework Integrations
-- Click on a framework to get the setup instructions. -
-- {t("login:login")} -
-- {t("login:need-account")} -
-I may have forgotten my password.
-+ Confirm your email +
++ Enter your backup key +
++ You can find it in your emrgency kit. You had to download the enrgency + kit during signup. +
++ Enter new password +
++ Make sure you save it somewhere save. +
+- {t("signup:step1-start")} + {"Let'"}s get started
+ {"We've"} sent a verification email to{" "} +
++ {email}{" "} +
{t("signup:step2-spam-alert")}
@@ -375,6 +389,7 @@ export default function SignUp() { }) as string } error={firstNameError} + autoComplete="given-name" />+ Forgot your password? +
++ You will need your emergency kit. Enter your email to start + account recovery. +
++ Look for an email in your inbox. +
++ An email with instructions has been sent to {email}. +
+