Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
docs: refac github sync and app connection to explain better which permissions are required
adilson6ad1703ee5f9
diff --git a/docs/images/app-connections/github/github-app-codespaces-secrets-permission.png b/docs/images/app-connections/github/github-app-codespaces-secrets-permission.pngnew file mode 100644index 0000000000..586b55bda1Binary files /dev/null and b/docs/images/app-connections/github/github-app-codespaces-secrets-permission.png differdiff --git a/docs/images/app-connections/github/github-app-dependabot-secrets-permission.png b/docs/images/app-connections/github/github-app-dependabot-secrets-permission.pngnew file mode 100644index 0000000000..0b319b6252Binary files /dev/null and b/docs/images/app-connections/github/github-app-dependabot-secrets-permission.png differdiff --git a/docs/images/app-connections/github/pat-codespaces-secrets-permission.png b/docs/images/app-connections/github/pat-codespaces-secrets-permission.pngnew file mode 100644index 0000000000..5d92d19fecBinary files /dev/null and b/docs/images/app-connections/github/pat-codespaces-secrets-permission.png differdiff --git a/docs/images/app-connections/github/pat-dependabot-secrets-permission.png b/docs/images/app-connections/github/pat-dependabot-secrets-permission.pngnew file mode 100644index 0000000000..2fb9c90fe4Binary files /dev/null and b/docs/images/app-connections/github/pat-dependabot-secrets-permission.png differdiff --git a/docs/integrations/app-connections/github.mdx b/docs/integrations/app-connections/github.mdxindex bbcb07a7ae..880a0e1854 100644--- a/docs/integrations/app-connections/github.mdx+++ b/docs/integrations/app-connections/github.mdx@@ -4,6 +4,8 @@ sidebarTitle: "GitHub"description: "Learn how to configure a GitHub Connection for Infisical."---+import GitHubPermissions from "/snippets/app-connections/github/permissions.mdx";+Infisical supports three methods for connecting to GitHub.<Tabs>@@ -30,11 +32,11 @@ Infisical supports three methods for connecting to GitHub.Disable webhook by unchecking the Active checkbox.- Set the repository permissions as follows: Metadata: Read-only, Secrets: Read and write, Environments: Read and write, Actions: Read. To sync [Dependabot or Codespaces secrets](/integrations/secret-syncs/github#secret-types), also set Dependabot secrets or Codespaces secrets to Read and write.- + Every connection that uses this app shares the app's permissions, so if you leave out the permissions for a secret type, no one can sync that type through the app.- Similarly, set the organization permissions as follows: Secrets: Read and write. To sync Dependabot or Codespaces secrets to an organization, also set Organization dependabot secrets or Organization codespaces secrets to Read and write.- + <GitHubPermissions method="github-app" />++ Create the GitHub application.@@ -117,6 +119,10 @@ Infisical supports three methods for connecting to GitHub.+ <Note>+ If your GitHub App was created before Infisical supported Dependabot and Codespaces secrets, the app is missing the permissions those secret types need. To sync them, add the [missing permissions](/integrations/secret-syncs/github#secret-types) to the app on GitHub. An owner of each installation then has to approve the new permissions before Infisical can use them.+ </Note>+You may optionally enable **GitHub Enterprise** to configure enterprise-specific options:- **Instance Type:** Enterprise Cloud or Enterprise Server- **Instance Hostname:** The hostname of your GitHub Enterprise instance (e.g. `github.mycompany.com`)@@ -191,8 +197,9 @@ Infisical supports three methods for connecting to GitHub.</Step><Step title="Grant Access">- You will then be redirected to the GitHub to grant Infisical access to your GitHub account (organization and repo privileges).- Once granted, you will redirect you back to Infisical's App Connections page.+ Infisical redirects you to GitHub, which asks you to grant Infisical the `repo` and `admin:org` scopes. Together they cover every [type of GitHub secret](/integrations/secret-syncs/github#secret-types) a sync can write to, so you don't need to set any permissions yourself.++ After you grant access, GitHub redirects you back to Infisical's App Connections page.</Step><Step title="Connection Created">@@ -217,19 +224,13 @@ Infisical supports three methods for connecting to GitHub.</Step><Step title="Fill in the Personal Access Token details">Fill in the Personal Access Token details:- - **Token name:** A descriptive name for the token (e.g., "infisical-connection-token")- - **Repository access:** Select the repositories you want to grant access to- - Select `All repositories` or `Only selected repositories` to be able to manage the secrets in the selected repositories.- - **Select scopes:** Add the following scopes:- - **Metadata**: Read-only- - **Environments**: Read and write- - **Secrets**: Read and write- - **Dependabot secrets**: Read and write (only to sync [Dependabot secrets](/integrations/secret-syncs/github#secret-types))- - **Codespaces secrets**: Read and write (only to sync [Codespaces secrets](/integrations/secret-syncs/github#secret-types))-- -- Click **Generate token** to create the token.+ - **Token name:** A descriptive name for the token (for example, `infisical-connection-token`)+ - **Resource owner:** The user or organization that owns the repositories (select the organization to sync to an organization)+ - **Repository access:** **All repositories**, or **Only select repositories** to limit which repositories Infisical can manage secrets in++ <GitHubPermissions method="personal-access-token" />++ Select **Generate token** to create the token.</Step><Step title="Copy the Personal Access Token">Copy the generated token immediately as it won't be shown again.diff --git a/docs/integrations/secret-syncs/github.mdx b/docs/integrations/secret-syncs/github.mdxindex 102b513cc9..6ae9350450 100644--- a/docs/integrations/secret-syncs/github.mdx+++ b/docs/integrations/secret-syncs/github.mdx@@ -4,6 +4,8 @@ sidebarTitle: "GitHub"description: "Learn how to configure a GitHub Sync for Infisical."---+import GitHubPermissions from "/snippets/app-connections/github/permissions.mdx";+**Prerequisites:**- Set up and add secrets to [Infisical Cloud](https://app.infisical.com)@@ -12,23 +14,32 @@ description: "Learn how to configure a GitHub Sync for Infisical."## Secret types-A GitHub sync writes to one type of GitHub secret. Each type is read by a different part of GitHub, supports different scopes, and needs its own permission on the [GitHub Connection](/integrations/app-connections/github):+A GitHub sync writes to one type of GitHub secret: Actions, Dependabot, or Codespaces. Each type needs its own permissions on the [GitHub Connection](/integrations/app-connections/github), and how you grant them depends on the connection's method:++<Tabs>+ <Tab title="GitHub App (Recommended)">+ <GitHubPermissions method="github-app" />++ <Note>+ If you add a permission to an existing GitHub App, an owner of each installation has to approve the new permission on GitHub before Infisical can use it.+ </Note>+ </Tab>+ <Tab title="OAuth">+ When you create an OAuth connection, Infisical requests two scopes from GitHub. Together they cover every secret type, so you don't need to set any permissions yourself:-| Secret type | Read by | Scopes | Repository permission | Organization permission |-| --- | --- | --- | --- | --- |-| Actions | GitHub Actions workflows | Organization, Repository, Repository Environment | **Secrets** (and **Environments** for the Repository Environment scope) | **Secrets** |-| Dependabot | Dependabot, for example to reach a private package registry | Organization, Repository | **Dependabot secrets** | **Organization dependabot secrets** |-| Codespaces | GitHub Codespaces | Organization, Repository | **Codespaces secrets** | **Organization codespaces secrets** |+ - `repo`: secrets in repositories and repository environments+ - `admin:org`: secrets in organizations-How you grant those permissions depends on the connection:+ If your connection is to GitHub Enterprise Server, you can't sync Codespaces secrets, because this option is not included there.+ </Tab>+ <Tab title="Personal Access Token">+ If you use a classic token, select the `repo` and `admin:org` scopes, which cover every secret type.-- If your connection uses a GitHub App or a fine-grained personal access token, give each permission read and write access-- If your connection uses OAuth or a classic personal access token, the `repo` and `admin:org` scopes already cover every secret type-- If your connection is to GitHub Enterprise Server, you can't sync Codespaces secrets, because GitHub Enterprise Server doesn't include Codespaces+ If you use a fine-grained token:-<Note>- If you add a permission to an existing GitHub App, an owner of each installation has to approve the new permission on GitHub before Infisical can use it.-</Note>+ <GitHubPermissions method="personal-access-token" />+ </Tab>+</Tabs>## Create a GitHub syncdiff --git a/docs/snippets/app-connections/github/permissions.mdx b/docs/snippets/app-connections/github/permissions.mdxnew file mode 100644index 0000000000..86e00bd3ae--- /dev/null+++ b/docs/snippets/app-connections/github/permissions.mdx@@ -0,0 +1,70 @@+{/*+Props:+- method: "github-app" or "personal-access-token", so each step shows the instructions and screenshots for its own GitHub screen.+*/}++{method === "github-app" && (+ <MDX>+ Under **Permissions**, set the permissions for every [type of GitHub secret](/integrations/secret-syncs/github#secret-types) you plan to sync:+ </MDX>+)}++{method === "personal-access-token" && (+ <MDX>+ Under **Permissions**, select **Add permissions** and add the permissions for every [type of GitHub secret](/integrations/secret-syncs/github#secret-types) you plan to sync:+ </MDX>+)}++<AccordionGroup>+ <Accordion title="Actions secrets">+ - To sync to a repository, set the repository permission **Secrets** to Read and write+ - To sync to a repository environment, also set the repository permission **Environments** to Read and write, and **Actions** to Read-only+ - To sync to an organization, set the organization permission **Secrets** to Read and write++ {method === "github-app" && (+ <MDX>+ + </MDX>+ )}++ {method === "personal-access-token" && (+ <MDX>+ + </MDX>+ )}+ </Accordion>+ <Accordion title="Dependabot secrets">+ - To sync to a repository, set the repository permission **Dependabot secrets** to Read and write+ - To sync to an organization, set the organization permission **Organization dependabot secrets** to Read and write++ {method === "github-app" && (+ <MDX>+ + </MDX>+ )}++ {method === "personal-access-token" && (+ <MDX>+ + </MDX>+ )}+ </Accordion>+ <Accordion title="Codespaces secrets">+ GitHub Enterprise Server doesn't include Codespaces, so you can't sync Codespaces secrets through a GitHub Enterprise Server connection.++ - To sync to a repository, set the repository permission **Codespaces secrets** to Read and write+ - To sync to an organization, set the organization permission **Organization codespaces secrets** to Read and write++ {method === "github-app" && (+ <MDX>+ + </MDX>+ )}++ {method === "personal-access-token" && (+ <MDX>+ + </MDX>+ )}+ </Accordion>+</AccordionGroup>