lfarci / github-actions

Preparation resources for the GitHub Actions certification
0 stars 0 forks source link

Identify the scope of encrypted secrets #69

Closed lfarci closed 3 months ago

lfarci commented 3 months ago

In GitHub Actions, encrypted secrets have different scopes based on where they are defined:

  1. Repository Secrets: These secrets are defined in a specific repository and are available to all workflows running in that repository. They are not available to workflows in forked repositories by default, unless the workflow is running on a pull request from a fork and the "Allow secrets to be shared with all actions" option is enabled.

  2. Organization Secrets: These secrets are defined at the organization level and can be made available to all repositories within the organization, or to specific repositories. They are not available to workflows in forked repositories.

  3. Environment Secrets: These secrets are defined in an environment within a repository and are only available to workflows that reference that environment. They can be used to manage access to secrets for different deployment stages (e.g., staging, production).

  4. Workflow Run Secrets: These secrets are created in a specific workflow run using the secrets context in the workflow file. They are only available to the steps in the same job where they were created.

Remember, secrets are not exposed in logs or available to workflows triggered by a pull request from a fork, unless explicitly allowed. Always be cautious when handling secrets to prevent unintentional exposure.

lfarci commented 3 months ago

Using secrets in GitHub Actions