diff --git a/content/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect.md b/content/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect.md index 0e5e9f0b68..5ae4b0ef75 100644 --- a/content/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect.md +++ b/content/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect.md @@ -73,6 +73,7 @@ The following example OIDC token uses a subject (`sub`) that references a job en "repository": "octo-org/octo-repo", "repository_owner": "octo-org", "actor_id": "12", + "repo_visibility": private, "repository_id": "74", "repository_owner_id": "65", "run_id": "example-run-id", @@ -128,6 +129,7 @@ The token also includes custom claims provided by {% data variables.product.prod | `job_workflow_ref`| This is the ref path to the reusable workflow used by this job. For more information, see "["Using OpenID Connect with reusable workflows"](/actions/deployment/security-hardening-your-deployments/using-openid-connect-with-reusable-workflows)." | | `ref`| _(Reference)_ The git ref that triggered the workflow run. | | `ref_type`| The type of `ref`, for example: "branch". | +| `repo_visibility` | The visibility of the repository where the workflow is running. Accepts the following values: `internal`, `private`, or `public`. | | `repository`| The repository from where the workflow is running. | | `repository_id`| The ID of the repository from where the workflow is running. | | `repository_owner`| The name of the organization in which the `repository` is stored. | @@ -238,6 +240,181 @@ curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOK {% data reusables.actions.oidc-permissions-token %} +{% ifversion actions-oidc-hardening-config %} +## Customizing the token claims + +You can security harden your OIDC configuration by customizing the claims that are included with the JWT. This allows your cloud provider to apply more granular trust conditions when determining whether to grant access to its resources. For example, you can customize the issuer (`iss`) claim to only allow access from a specific enterprise URL, and you can customize the subject (`sub`) value to require that requests originate from a specific repository, reusable workflow, or other source. + +To configure the claim conditions on {% data variables.product.prodname_dotcom %}, you can use the REST API endpoints described in the following sections. + +### Switching to a unique token URL + +By default, the JWT is issued by {% data variables.product.prodname_dotcom %}'s OIDC provider at `https://token.actions.githubusercontent.com`. This path is presented to your cloud provider using the `iss` value in the JWT. + +Enterprise admins can security harden their OIDC configuration by configuring their enterprise to receive tokens from a unique URL at `https://api.github.com/enterprises//actions/oidc/customization/issuer`. Replace `` with the slug value of your enterprise. + +This configuration means that your enterprise will receive the OIDC token from a unique URL, and you can then configure your cloud provider to only accept tokens from that URL. This helps ensure that only the enterprise's repositories can access your cloud resources using OIDC. + +To activate this setting for your enterprise, an enterprise admin must use the `/enterprises/{enterprise}/actions/oidc/customization/issuer` endpoint and specify `"include_enterprise_slug": true` in the request body. For more information, see "[Set the {% data variables.product.prodname_actions %} OIDC custom issuer policy for an enterprise](/rest/actions/oidc#set-the-github-actions-oidc-custom-issuer-policy-for-an-enterprise)." + +After this setting is applied, the JWT will contain the updated `iss` value. In the following example, the `iss` key uses `octocat-inc` as its `enterpriseSlug` value: + +```json +{ + "jti": "6f4762ed-0758-4ccb-808d-ee3af5d723a8" + "sub": "repo:octocat-inc/private-server:ref:refs/heads/main" + "aud": "http://octocat-inc.example/octocat-inc" + "enterprise": "octocat-inc" + "iss": "https://api.github.com/enterprises/octocat-inc/actions/oidc/customization/issuer", + "bf": 1755350653, + "exp": 1755351553, + "iat": 1755351253 +} +``` + +### Customizing the subject claims for an organization + +To configure organization-wide security, compliance, and standardization, you can customize the standard claims to suit your required access conditions. If your cloud provider supports conditions on subject claims, you can create a condition that checks whether the `sub` value matches the path of the reusable workflow, such as `"job_workflow_ref: "octo-org/octo-automation/.github/workflows/oidc.yml@refs/heads/main""`. The exact format will vary depending on your cloud provider's OIDC configuration. To configure the matching condition on {% data variables.product.prodname_dotcom %}, you can can use the REST API to require that the `sub` claim must always include a specific custom claim, such as `job_workflow_ref`. For more information, see "[Set the customization template for an OIDC subject claim for an organization](/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization)." + +The following example templates demonstrate various ways to customize the subject claim. To configure these settings on {% data variables.product.prodname_dotcom %}, organization admins use the REST API to specify a list of claims that must be included in the subject (`sub`) claim. {% data reusables.actions.use-request-body-api %} + +To customize your subject claims, you should first create a matching condition in your cloud provider's OIDC configuration, before adding the configuration using the REST API. Once the configuration is completed, each time a new job runs, the OIDC token generated during that job will follow the new customization template. If the matching condition doesn't exist in the cloud provider's OIDC configuration before the job runs, the generated token might not be accepted by the cloud provider, since the cloud conditions may not be synchronized. + +{% note %} + +**Note**: When the organization template is applied, it will not affect any existing repositories that already use OIDC. For new repositories that are created after the template has been applied, the repository owner will need to opt-in to receive this configuration. For more information, see "[Set the opt-in flag of an OIDC subject claim customization for a repository](/rest/actions/oidc#set-the-opt-in-flag-of-an-oidc-subject-claim-customization-for-a-repository)." + +{% endnote %} + +#### Example: Allowing repository based on visibility and owner + +This example template enables cloud access based on repository visibility and owner, letting you restrict cloud role access to only private repositories within an organization or enterprise. {% data reusables.actions.use-request-body-api %} + +```json +{ + "include_claim_keys": [ + "repository_owner", + "repository_visibility" + ] +} +``` + +In your cloud provider's OIDC configuration, configure the `sub` condition to require that claims must include specific values for `repository_owner` and `repository_visibility`. For example: `"repository_owner: "monalisa":repository_visibility:private"`. + +#### Example: Allowing access to all repositories with a specific owner + +This example template grants access to all repositories with a specified `repository_owner`. {% data reusables.actions.use-request-body-api %} + +```json +{ + "include_claim_keys": [ + "repository_owner" + ] +} + +``` + +In your cloud provider's OIDC configuration, configure the `sub` condition to require that claims must include a specific value for `repository_owner`. For example: `"repository_owner: "monalisa""` + +#### Example: Requiring a reusable workflow + +This example template requires a specific reusable workflow in a claim, letting an enterprise enforce consistent deployments across its enterprise, organizations, and repositories. {% data reusables.actions.use-request-body-api %} + +```json + { + "include_claim_keys": [ + "job_workflow_ref" + ] + } +``` + +In your cloud provider's OIDC configuration, configure the `sub` condition to require that claims must include a specific value for `job_workflow_ref`. For example: `"job_workflow_ref: "octo-org/octo-automation/.github/workflows/oidc.yml@refs/heads/main""`. + +#### Example: Requiring a reusable workflow and other claims + +This example template combines the requirement of a specific reusable workflow with additional claims. {% data reusables.actions.use-request-body-api %} + +```json +{ + "include_claim_keys": [ + "repo", + "context", + "job_workflow_ref" + ] +} +``` + +In your cloud provider's OIDC configuration, configure the `sub` condition to require that claims must include specific values for `repo`, `context`, and `job_workflow_ref`. + +#### Example: Granting access to a specific repository + +This example template lets you grant cloud access to all the workflows in a specific repository, across all branches/tags and environments. To help improve security, combine this template with the custom issuer URL described in "[Customizing the token URL for an enterprise](/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#customizing-the-token-url-for-an-enterprise)." + +{% data reusables.actions.use-request-body-api %} + +```json +{ + "include_claim_keys": [ + "repo" + ] +} +``` + +In your cloud provider's OIDC configuration, configure the `sub` condition to require a `repo` claim that matches the required value. + +#### Example: Using system-generated GUIDs + +This example template enables predictable OIDC claims with system-generated GUIDs that do not change between renames of entities (such as renaming a repository). {% data reusables.actions.use-request-body-api %} + +```json + { + "include_claim_keys": [ + "repository_id" + ] + } +``` + +In your cloud provider's OIDC configuration, configure the `sub` condition to require a `repository_id` claim that matches the required value. + +or: + +```json +{ + "include_claim_keys": [ + "repository_owner_id" + ] +} +``` + +In your cloud provider's OIDC configuration, configure the `sub` condition to require a `repository_owner_id` claim that matches the required value. + +#### Resetting your customizations + +This example template resets the subject claims to the default format. {% data reusables.actions.use-request-body-api %} This template effectively opts out of any organization-level customization policy. + +```json +{ + "include_claim_keys": [ + "repo", + "context" + ] +} +``` + +In your cloud provider's OIDC configuration, configure the `sub` condition to require that claims must include specific values for `repo` and `context`. + +#### Using the default subject claims + +For repositories that can receive a subject claim policy from their organization, the repository owner can later choose to opt-out and instead use the default `sub` claim format. To configure this, the repository admin must use the REST API endpoint at "[Set the opt-out flag of an OIDC subject claim customization for a repository](/rest/actions/oidc#set-the-opt-out-flag-of-an-oidc-subject-claim-customization-for-a-repository)" with the following request body: + +```json +{ + "use_default": true +} +``` + +{% endif %} + ## Updating your workflows for OIDC You can now update your YAML workflows to use OIDC access tokens instead of secrets. Popular cloud providers have published their official login actions that make it easy for you to get started with OIDC. For more information about updating your workflows, see the cloud-specific guides listed below in "[Enabling OpenID Connect for your cloud provider](#enabling-openid-connect-for-your-cloud-provider)." diff --git a/content/billing/managing-billing-for-github-packages/about-billing-for-github-packages.md b/content/billing/managing-billing-for-github-packages/about-billing-for-github-packages.md index e7fb70174a..81683b18f8 100644 --- a/content/billing/managing-billing-for-github-packages/about-billing-for-github-packages.md +++ b/content/billing/managing-billing-for-github-packages/about-billing-for-github-packages.md @@ -49,9 +49,9 @@ All data transferred out, when triggered by {% data variables.product.prodname_a Storage usage is shared with build artifacts produced by {% data variables.product.prodname_actions %} for repositories owned by your account. For more information, see "[About billing for {% data variables.product.prodname_actions %}](/billing/managing-billing-for-github-actions/about-billing-for-github-actions)." -{% data variables.product.prodname_dotcom %} charges usage to the account that owns the repository where the package is published. If your account's usage surpasses these limits and you have set a spending limit above $0 USD, you will pay $0.25 USD per GB of storage per day and $0.50 USD per GB of data transfer. +{% data variables.product.prodname_dotcom %} charges usage to the account that owns the repository where the package is published. If your account's usage surpasses these limits and you have set a spending limit above $0 USD, you will pay $0.008 USD per GB of storage per day and $0.50 USD per GB of data transfer. -For example, if your organization uses {% data variables.product.prodname_team %}, allows unlimited spending, uses 150GB of storage, and has 50GB of data transfer out during a month, the organization would have overages of 148GB for storage and 40GB for data transfer for that month. The storage overage would cost $0.25 USD per GB per day or $37 USD. The overage for data transfer would cost $0.50 USD per GB or $20 USD. +For example, if your organization uses {% data variables.product.prodname_team %}, allows unlimited spending, uses 150GB of storage, and has 50GB of data transfer out during a month, the organization would have overages of 148GB for storage and 40GB for data transfer for that month. The storage overage would cost $0.008 USD per GB per day or approximately $37 USD for a 31-day month. The overage for data transfer would cost $0.50 USD per GB or $20 USD. {% data reusables.dotcom_billing.pricing_calculator.pricing_cal_packages %} diff --git a/data/features/actions-oidc-hardening-config.yml b/data/features/actions-oidc-hardening-config.yml new file mode 100644 index 0000000000..4fe8c936fc --- /dev/null +++ b/data/features/actions-oidc-hardening-config.yml @@ -0,0 +1,5 @@ +# Reference: #7336 +# General versioning for oidc hardening options +versions: + ghec: '*' + ghes: '>=3.7' diff --git a/data/reusables/actions/use-request-body-api.md b/data/reusables/actions/use-request-body-api.md new file mode 100644 index 0000000000..1d37d0c4f0 --- /dev/null +++ b/data/reusables/actions/use-request-body-api.md @@ -0,0 +1 @@ +To apply this configuration, submit a request to the API endpoint and include the required configuration in the request body. For more information, see "[Set the customization template for an OIDC subject claim for an organization](/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization)". \ No newline at end of file diff --git a/stylesheets/extended-markdown.scss b/stylesheets/extended-markdown.scss index a0ec5a761d..0e1c819027 100644 --- a/stylesheets/extended-markdown.scss +++ b/stylesheets/extended-markdown.scss @@ -10,10 +10,6 @@ } } - p { - margin: 0; - } - p:not(:first-child) { margin-top: 1rem; }