You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: policies/repository.readme.md
+92Lines changed: 92 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,98 @@ protected_branches:
61
61
- `allow_fork_syncing`: if set to `true`, the branch can be synced with the upstream repository.
62
62
63
63
64
+
## Tag Protection
65
+
66
+
Tag protection is a way to protect important version tags and releases from unauthorized modifications or deletions. The policy checks whether the tag protection settings specified are applied to the repository using GitHub repository rulesets.
67
+
68
+
[GitHub Repository Rulesets for Tags](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets)
69
+
70
+
```yml
71
+
tags:
72
+
enforcement: active # disabled | active | evaluate
73
+
target: tag # fixed for tag rules so we can also not specify it here but fix it in code
74
+
75
+
scope:
76
+
include:
77
+
- "v*" # e.g., protect all version tags
78
+
# - "~ALL" # special token: all tags
79
+
exclude: [] # patterns to exclude, e.g., ["v*-rc*", "v*-beta*"]
80
+
81
+
operations: # who can perform actions on matching tags
- `enforcement` (**mandatory**): the enforcement level for the tag ruleset.
111
+
- `disabled`: the ruleset is disabled and not enforced.
112
+
- `active`: the ruleset is actively enforced and will block non-compliant operations.
113
+
- `evaluate`: the ruleset runs in evaluation mode (logs violations without blocking).
114
+
115
+
- `target` (**optional**): should always be `tag` for tag rulesets. This is typically fixed in code and doesn't need to be specified.
116
+
117
+
- `scope`: defines which tags are protected by the ruleset.
118
+
- `include`: a list of tag patterns to protect. Supports wildcards (e.g., `v*` for all version tags) and the special token `~ALL` to protect all tags.
119
+
- `exclude`: a list of tag patterns to exclude from protection (e.g., `["v*-rc*", "v*-beta*"]` to exclude release candidates and beta versions).
120
+
121
+
- `operations`: defines who can perform operations on protected tags.
122
+
- `create`: controls tag creation. Set to `restricted` to allow only bypass actors to create tags, or `allowed` for unrestricted creation.
123
+
- `update`: controls tag updates. Set to `restricted` to allow only bypass actors to update tags, or `allowed` for unrestricted updates.
124
+
- `delete`: controls tag deletion. Set to `restricted` to allow only bypass actors to delete tags, or `allowed` for unrestricted deletion.
125
+
126
+
- `naming` (**optional**): constrains tag names using pattern matching.
127
+
- `enabled`: set to `true` to enable naming constraints.
128
+
- `operator`: the pattern matching operator to use.
129
+
- `starts_with`: tag name must start with the pattern.
130
+
- `ends_with`: tag name must end with the pattern.
131
+
- `contains`: tag name must contain the pattern.
132
+
- `regex`: tag name must match the regular expression pattern.
133
+
- `pattern`: the pattern or regular expression to match against tag names. For semantic versioning, use: `"^v\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$"`.
134
+
- `negate`: if set to `true`, the pattern is disallowed (inverts the match).
135
+
136
+
- `bypass` (**optional**): defines actors who can bypass tag protection rules.
137
+
- `organization_admins`: bypass mode for organization administrators.
138
+
- `always`: organization admins can always bypass the rules.
139
+
- `exempt`: organization admins are not exempt and must follow the rules.
140
+
- `teams`: a list of teams that can bypass the rules.
141
+
- `id`: the team ID (numeric).
142
+
- `mode`: `always`(can bypass) or `exempt` (cannot bypass).
143
+
- `integrations`: a list of GitHub Apps that can bypass the rules.
144
+
- `id`: the GitHub App ID (numeric).
145
+
- `mode`: `always`(can bypass) or `exempt` (cannot bypass).
146
+
- `repository_roles`: a list of repository roles that can bypass the rules.
147
+
- `id`: the repository role ID (e.g., 3 for Maintainer).
148
+
- `mode`: `always`(can bypass) or `exempt` (cannot bypass).
149
+
- `deploy_keys`: configuration for deploy keys.
150
+
- `allow`: set to `true` to allow deploy keys to bypass protections, `false` to deny.
151
+
- `mode`: `always`(can bypass) or `exempt` (cannot bypass).
152
+
153
+
**Best Practice**: Use tag protection to secure release tags, enforce semantic versioning, and prevent accidental deletion or modification of important version markers.
154
+
155
+
64
156
## File Disallow
65
157
66
158
The `file_disallow` policy checks if sensitive files that should not be present in the repository are found. This helps prevent accidental commits of credentials, API keys, and other sensitive information.
Copy file name to clipboardExpand all lines: policies/repository.threats.md
+49Lines changed: 49 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,6 +141,55 @@ webhooks:
141
141
- Endpoint compromise
142
142
143
143
144
+
### Unauthorized modification or deletion of release tags
145
+
146
+
A malicious actor could modify or delete release tags in the repository, potentially compromising the integrity of versioned releases, breaking deployments, or enabling supply chain attacks by manipulating which code versions are considered official releases.
147
+
148
+
#### Security controls
149
+
- Restrict who can create, update, or delete tags using repository rulesets
150
+
- Enforce naming conventions for version tags to ensure consistency
151
+
- Define bypass actors who are authorized to manage protected tags
152
+
- Use evaluation mode to test tag protection rules before enforcement
Developers may accidentally commit sensitive files containing credentials, API keys, passwords, or other confidential information to the repository. Files like `.env`, configuration files, or credential files can expose the application and infrastructure to unauthorized access.
0 commit comments