Skip to content

Add recommendation to use environment secrets instead of repository secrets#273

Closed
jack-berg wants to merge 1 commit into
mainfrom
recommend-environment-secrets
Closed

Add recommendation to use environment secrets instead of repository secrets#273
jack-berg wants to merge 1 commit into
mainfrom
recommend-environment-secrets

Conversation

@jack-berg
Copy link
Copy Markdown
Member

@jack-berg jack-berg commented May 28, 2026

Comment thread docs/recommendations.md
publishing, signing, and other privileged workflows.

With **repository secrets**, any workflow running in the repository can access
them — including workflows triggered on non-protected branches. This means
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not even know how to type an em-dash on the keyboard 😉

Suggested change
them including workflows triggered on non-protected branches. This means
them, including workflows triggered on non-protected branches. This means

Comment thread docs/recommendations.md

With **repository secrets**, any workflow running in the repository can access
them — including workflows triggered on non-protected branches. This means
anyone with write access could push a non-protected branch containing secret
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest capitalizing the role name https://docs.github.com/en/organizations/managing-user-access-to-your-organizations-repositories/managing-repository-roles/repository-roles-for-an-organization

Suggested change
anyone with write access could push a non-protected branch containing secret
anyone with Write access could push a non-protected branch containing secret

Comment thread docs/recommendations.md
With **environment secrets**, access is restricted to workflows running in the
context of a named environment, and that environment can be configured to only
allow deployments from specific branches. This means even a contributor with
write access cannot access the secrets without their code successfully passing
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
write access cannot access the secrets without their code successfully passing
Write access cannot access the secrets without their code successfully passing

Comment thread docs/recommendations.md
context of a named environment, and that environment can be configured to only
allow deployments from specific branches. This means even a contributor with
write access cannot access the secrets without their code successfully passing
all branch protection criteria — i.e., an approved and merged PR.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
all branch protection criteria i.e., an approved and merged PR.
all branch protection criteria, i.e., an approved and merged PR.

Comment thread docs/recommendations.md
Comment on lines +74 to +76
4. Remove the corresponding repository-level secrets. If both exist, the
repository-level secret remains accessible from any branch, defeating the
purpose.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe swap ordering of 4 and 5, and mention something about may need to backport the release workflow update if making an older patch release

@jack-berg
Copy link
Copy Markdown
Member Author

Bah, forgot to create the branch on my fork. See #274 instead.

@jack-berg jack-berg closed this May 28, 2026
@trask
Copy link
Copy Markdown
Member

trask commented May 28, 2026

Bah, forgot to create the branch on my fork. See #274 instead.

yeah, this is annoying, proposing to block the initial creation to avoid the after-the-fact surprise: https://github.com/open-telemetry/admin/pull/676

@jack-berg jack-berg deleted the recommend-environment-secrets branch May 28, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants