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: registry-v2.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,11 +81,11 @@ The name for the official Hex.pm repository is "hexpm", it should not be used by
81
81
82
82
## Retiring Releases
83
83
84
-
Individual releases can be retired. A retired release can still be used like any normal release, the only difference is that the particular release will be marked in the UI for the repository and a notice can be displayed to client users that are using that version.
84
+
Individual releases can be retired. Retirement is advisory metadata and does not remove the release from the registry.
85
85
86
-
A release is retired if the `retired` field is set on `Release`. A `RetirementStatus` has a `RetirementReason` enum with the reason for retiring the release, clients need to support future additions to this enum, in the protobuf library that generates the files under `registry/` unknown enum values are decoded as their integer value. A, user set, message can be attached to the `RetirementStatus` clarifying the reason for retirement.
86
+
A release is retired if the `retired` field is set on `Release`. A `RetirementStatus` has a `RetirementReason` enum and may include a message that clarifies the reason. Clients MUST accept future additions to `RetirementReason`; the protobuf library that generates the files under `registry/`decodes unknown enum values as their integer value.
87
87
88
-
It is important that clients still allow users to use retired releases to avoid breaking repeatable builds.
88
+
Clients MUST NOT reject a release solely because it is retired. This preserves repeatable builds that already depend on the release.
89
89
90
90
## Dependency policies
91
91
@@ -97,38 +97,38 @@ The resource lives at `/repos/REPO/policies/NAME`, served by the same backend as
97
97
98
98
The `visibility` field controls who can fetch the resource:
99
99
100
-
*`VISIBILITY_PRIVATE`— served only to authenticated callers who can access the repository, the same auth pipeline as `/packages/NAME` on a private repository.
101
-
*`VISIBILITY_PUBLIC`— served to any caller, authenticated or not, so projects that are not members of the repository can opt in to the policy.
100
+
*`VISIBILITY_PRIVATE`is served only to authenticated callers who can access the repository, using the same authentication rules as `/packages/NAME` on a private repository.
101
+
*`VISIBILITY_PUBLIC`is served to any caller, authenticated or not.
102
102
103
-
The auth decision is made per-object by inspecting the payload's `visibility` field; the path and signing model are identical in both cases. If the payload cannot be decoded — signature mismatch, unknown enum value, missing required field — the edge must fail closed and require authentication.
103
+
The auth decision is made per-object by inspecting the payload's `visibility` field; the path and signing model are identical in both cases. If the payload cannot be decoded because of a signature mismatch, unknown enum value, or missing required field, the edge MUST fail closed and require authentication.
104
104
105
105
### Repository policies
106
106
107
-
A policy carries a list of [`RepositoryPolicy`](/registry/policy.proto) entries, one per repository it constrains — in practice `hexpm` (public packages) and the organization's own repository. Each candidate release is matched to the entry whose `repository` equals the release's repository. A release from a repository with no matching entry is unconstrained by the policy.
107
+
A policy carries a list of [`RepositoryPolicy`](/registry/policy.proto) entries, one per repository it constrains. Each candidate release is matched to the entry whose `repository` equals the release's repository. A release from a repository with no matching entry is unconstrained by the policy.
108
108
109
109
A matched entry has two parts, evaluated in this order for each candidate release `{repository, package, version}`:
110
110
111
-
1.**Overrides** (`overrides`) — the final say. An `OVERRIDE_ACTION_ALLOW`override whose `ref` matches the release permits it immediately and **bypasses the restriction**; an `OVERRIDE_ACTION_DENY`override blocks it. When several overrides match, the one with the most specific `requirement` wins (a `requirement`-bearing entry is more specific than a bare-`package` entry).
112
-
2.**Restriction** (`restriction`) — applied to every release in the repository, but **never** to a release permitted by an `ALLOW` override. A release is blocked if any limit fires.
111
+
1.**Overrides** (`overrides`) are package-scoped decisions and exceptions. A matching `OVERRIDE_ACTION_ALLOW`permits the release and bypasses every policy restriction; `OVERRIDE_ACTION_DENY` blocks it. When several ALLOW or DENY overrides match, the one with the most specific `requirement` wins (a `requirement`-bearing entry is more specific than a bare-package entry). If no final override decides the release, matching ADVISORY, RETIREMENT, and COOLDOWN overrides remove only their selected restriction.
112
+
2.**Restriction** (`restriction`) applies to every release that was not permitted or blocked by a final override. A release is blocked if any remaining limit fires.
113
113
114
-
A `PackageRef`(used by `Override.ref`) matches a release when its `package` equals the release's package and, if `requirement` is set, the release's version satisfies that requirement.
114
+
A `PackageRef` matches a release when its `package` equals the release's package and, if `requirement` is set, the release's version satisfies that requirement using Hex version-requirement semantics.
115
115
116
-
#### Restriction limits
116
+
Each `Override` action has a fail-closed field contract:
117
117
118
-
*`advisory_min_severity` is set and the release's maximum advisory severity is greater than or equal to it. It is an `AdvisorySeverity` (imported from [`package.proto`](/registry/package.proto), `SEVERITY_NONE` … `SEVERITY_CRITICAL`). `SEVERITY_NONE` blocks any release that has any advisory at all.
119
-
*`retirement_reasons` is non-empty and the release's `retired.reason` is one of the listed values. Each is a `RetirementReason` (imported from [`package.proto`](/registry/package.proto), `RETIRED_OTHER` … `RETIRED_RENAMED`).
120
-
*`cooldown` is set and non-zero and the release's `published_at` is more recent than `now - cooldown_duration`. The grammar matches the Hex cooldown configuration grammar: `"Nd"`, `"Nw"`, `"Nmo"`, or `"0"`; `"0"` (or unset) imposes no minimum age. If multiple active policies declare cooldowns, the effective cooldown is the strictest one.
118
+
*`OVERRIDE_ACTION_ALLOW` and `OVERRIDE_ACTION_DENY` MUST set neither selector. ALLOW bypasses all policy restrictions, while DENY blocks the release.
119
+
*`OVERRIDE_ACTION_ADVISORY` MUST set `advisory_id` and MUST NOT set `retirement_reason`. The identifier matches the advisory's primary ID or any alias, case-insensitively. It removes only that advisory, so another advisory affecting the same release is still evaluated.
120
+
*`OVERRIDE_ACTION_RETIREMENT` MUST set `retirement_reason` and MUST NOT set `advisory_id`. It accepts the release only while its current retirement reason equals that value. If the retirement reason changes, the override no longer matches. The retirement message does not affect matching.
121
+
*`OVERRIDE_ACTION_COOLDOWN` MUST set neither selector. It bypasses only the cooldown declared by this policy.
121
122
122
-
### Client behavior
123
+
Every override may carry an optional comment. Comments MUST contain at most 500 Unicode code points and MUST be valid UTF-8 without Unicode control, format, line separator, or paragraph separator characters. Comments on a `VISIBILITY_PUBLIC` policy are public.
123
124
124
-
A conformant client:
125
+
Clients MUST ignore an override if it is malformed, has an unknown action or retirement reason, has an invalid package requirement, or sets selector fields that its action does not permit. An ignored override MUST NOT remove a restriction or otherwise accept the affected release.
125
126
126
-
1.**Reads policy references from multiple opt-in sources** (e.g. project file, environment variable, global config) and composes them by intersection: a release must pass every active policy. The active set is deduplicated on `(repository, name)`.
127
-
2.**Fetches and verifies each active policy** before resolution, using the configured public key for the repository.
128
-
3.**Filters the candidate set at resolution time only.** Lockfile entries are trusted at install; filtering does not apply to versions already in the lockfile.
129
-
4.**Caches each policy independently** with last-known-good fall-back on fetch failure (network, 5xx, signature mismatch). The maximum staleness window should be at most 30 days, bounding the suppression window for a network adversary.
127
+
#### Restriction limits
130
128
131
-
Across the active set, policies compose by intersection: a release survives only if every active policy permits it and no active policy's restriction blocks it. Cooldowns compose by strictest-wins — the effective cooldown is the longest duration across all active policies, and local cooldown configuration cannot lower it.
129
+
*`advisory_min_severity` is set and the release's maximum advisory severity is greater than or equal to it. It is an `AdvisorySeverity` (imported from [`package.proto`](/registry/package.proto), `SEVERITY_NONE` … `SEVERITY_CRITICAL`). `SEVERITY_NONE` blocks any release that has any advisory at all.
130
+
*`retirement_reasons` is non-empty and the release's `retired.reason` is one of the listed values. Each is a `RetirementReason` (imported from [`package.proto`](/registry/package.proto), `RETIRED_OTHER` … `RETIRED_RENAMED`).
131
+
*`cooldown` is set and non-zero and the release's `published_at` is more recent than `now - cooldown_duration`. The grammar is `"Nd"`, `"Nw"`, `"Nmo"`, or `"0"`; `"0"` (or unset) imposes no minimum age.
Copy file name to clipboardExpand all lines: security/threat-model/mitigations.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -266,11 +266,13 @@ Client-side enforcement of organization-defined policies, currently available in
266
266
| Cooldown rule | Implemented | Blocks newly published versions until they reach a minimum age; effective cooldown is the strictest of local config and the policy |
267
267
| Advisory rule | Implemented | Blocks versions with security advisories at or above a severity threshold (or with any advisory) |
268
268
| Retirement rule | Implemented | Blocks versions retired for the configured reasons |
269
-
| Package/version overrides | Implemented | Allow/deny exceptions; most specific match wins, an allow exempts the release from the restriction |
269
+
| Package/version overrides | Implemented | Package and version scoped allow, deny, advisory, retirement, and policy-cooldown overrides; comments are available on every type |
270
+
| Finding-scoped policy overrides | Implemented | Advisory and retirement overrides accept one current identifier or reason without accepting unrelated findings; cooldown overrides don't disable local cooldown configuration |
270
271
| Lockfile exemption | Implemented | Versions already locked are exempt from filtering, so re-resolution keeps a locked-but-now-blocked entry instead of failing |
271
272
| Policy visibility | Implemented | Public policies are fetchable anonymously; private policies require authentication to the owning organization |
272
273
| Fail-closed enforcement | Implemented | Malformed config, fetch failures (without a cached copy), or 404/401 abort resolution rather than resolving unenforced |
273
274
|`mix hex.policy show` / `why`| Implemented | Summarize the active policy and explain per-version why each is allowed or blocked |
275
+
| Policy-aware dependency audit | Implemented | Audits locked advisory and retirement findings against policy overrides and restriction thresholds |
0 commit comments