Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,30 @@ jobs:
RELEASE_COMMIT: ${{ github.sha }}

steps:
- name: Check out the exact release tag
- name: Check out the release event commit
Comment thread
FlyOverCoderKY marked this conversation as resolved.
Resolved
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: refs/tags/${{ github.event.release.tag_name }}
ref: ${{ github.sha }}
fetch-depth: 1
persist-credentials: false

- name: Confirm the release tag target
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
authorization="$(printf 'x-access-token:%s' "${GITHUB_TOKEN}" | base64 | tr -d '\n')"
unset GITHUB_TOKEN
GIT_CONFIG_COUNT=1 \
GIT_CONFIG_KEY_0=http.https://github.com/.extraheader \
GIT_CONFIG_VALUE_0="AUTHORIZATION: basic ${authorization}" \
git fetch --force --no-tags origin "refs/tags/${RELEASE_TAG}:refs/tags/${RELEASE_TAG}"
unset authorization
tag_commit="$(git rev-parse "refs/tags/${RELEASE_TAG}^{commit}")"
if [[ "${tag_commit}" != "${RELEASE_COMMIT}" ]]; then
echo "::error::Release tag target does not match the release event commit"
exit 1
fi

- name: Set up Node.js and the npm registry
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
Expand All @@ -127,4 +146,4 @@ jobs:
path: .release

- name: Publish prepared tarballs
run: npm run release:publish -- -- --expected-release-commit "${RELEASE_COMMIT}" --manifest .release/package-manifest.json
run: node scripts/release-packages.mjs publish --expected-release-commit "${RELEASE_COMMIT}" --manifest .release/package-manifest.json
19 changes: 13 additions & 6 deletions docs/POLICY.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,19 @@ A policy version is 1–128 ASCII characters and matches:
^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$
```

The `defaults`, `roles`, and `entitlements` sections are optional. Present
sections must use arrays and objects exactly as shown; `null`, sparse arrays,
accessors, inherited configuration, custom prototypes, symbols, and non-JSON
values are rejected. Successful validation returns a detached, deeply frozen
copy so later mutation of the decoded input cannot change authorization
behavior.
The `defaults`, `roles`, and `entitlements` sections are optional. Present grant
lists must be ordinary dense arrays, while the document and mapping objects may
use either `Object.prototype` or a null prototype. `null`, accessors, inherited
configuration, symbols, non-JSON values, and other prototypes are rejected.
Successful validation returns a detached, deeply frozen copy with a null
prototype, so later mutation of the decoded input cannot change authorization
behavior. Parsed output may be passed directly to `validatePolicy` or
`parsePolicy` again.

Core resolution reads optional subject and policy fields only from own data
properties. Inherited optional fields are ignored, and an own optional field
whose value is `undefined` is treated as absent. A present role or entitlement
map entry must be an array; `null` entries are rejected.

## Permission names

Expand Down
36 changes: 22 additions & 14 deletions docs/STORAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,21 @@ assignment is never missed.

Each audited grant therefore costs one more `insertIfAbsent` than before,
outside the grant transaction. Each by-role read is one partition listing plus
one authoritative point read per row, issued in batches of 16. Because rows
are never deleted, the partition grows with every grant attempt for that role
and scope, including revoked and refused ones, so read cost tracks a role's
whole grant history rather than its current holders. That is the right trade
for administrator-style roles granted a handful of times; a role granted
routinely to large populations is a poor fit for by-role reads.
one exact holder confirmation per row, followed by pointer lookup and an
authoritative assignment read in batches of 16. Because rows are never deleted,
the partition grows with every grant attempt for that role and scope, including
revoked and refused ones, so read cost tracks a role's whole grant history
rather than its current holders. That is the right trade for
administrator-style roles granted a handful of times; a role granted routinely
to large populations is a poor fit for by-role reads.

Assignments granted before the index existed (before this release) have no
row. Until `RoleHolderIndexMaintenance.rebuildRoleHolderIndex()` runs once
over the backing store, they are missing from by-role results, which a
last-administrator guard sees as "no other holder" and refuses — fail closed,
but still a refusal an operator would notice. The rebuild reads the
application's assignment pointers (a single-partition scan), writes any
missing rows, reports how many it wrote, and is idempotent and safe to run
application's assignment pointers, confirms each through its exact key, writes
any missing rows, reports how many it wrote, and is idempotent and safe to run
alongside live grants and revocations.

The by-role read is a non-snapshot read like every other listing, so the
Expand Down Expand Up @@ -346,12 +347,19 @@ partition and would therefore leave the transaction boundary.

## Non-snapshot reads

`listActiveRoleAssignments` and `listRoleAssignments` are each one partition
read of the authoritative assignment records. They use no derived selection
index and no fence to compare, so there is nothing that can drift from the
records or that would need reconciling; but a partition listing is not a
snapshot, and a read that begins before a revocation may still observe the
assignment as active.
`listActiveRoleAssignments` and `listRoleAssignments` each begin with one
partition read of the authoritative assignment records. They use no derived
selection index and no fence to compare, so there is nothing that can drift
from the records or that would need reconciling; but a partition listing is
not a snapshot, and a read that begins before a revocation may still observe
the assignment as active.

Each decoded row is confirmed through its recomputed exact record key before it
is used, with point reads issued in batches of 16. A key outside the requested
partition or a duplicate recomputed key rejects as malformed. If a row vanishes
or changes between the partition listing and point confirmation, the read
rejects with a retry-oriented storage error. This confirmation is still not a
snapshot.

The host's cache generation fence is therefore load-bearing rather than
belt-and-braces. A fill must capture all applicable generations before its
Expand Down
7 changes: 4 additions & 3 deletions docs/api/authorization-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ export type PolicyValidationResult =

Validate an already parsed policy value without returning a partial policy.

The input must have the same ordinary data-property shape produced by
JSON.parse. Unexpected proxies or reflective failures are reported as an
invalid structure rather than escaping the fail-closed boundary.
The input must use enumerable data properties and either the ordinary JSON
object prototype or a null prototype. Unexpected proxies or reflective
failures are reported as an invalid structure rather than escaping the
fail-closed boundary.

```ts
export declare function validatePolicy(input: unknown): PolicyValidationResult;
Expand Down
Loading
Loading