-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(relay): add resource identity auth for relays #6515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
saifsmailbox98
merged 24 commits into
main
from
saif/pam-215-build-resource-identity-auth-for-relays
May 22, 2026
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
55899f0
feat(relay): add resource identity auth for relays
saifsmailbox98 25ff699
feat(networking-ui): split view overhaul for gateways, pools, and relays
saifsmailbox98 06a82e6
Revert "feat(networking-ui): split view overhaul for gateways, pools,…
saifsmailbox98 6e05559
feat(relay): add connected gateways section, fix create modal and hea…
saifsmailbox98 5b4aff5
fix(relay): host editing, security hardening, audit log, and review f…
saifsmailbox98 566696d
merge: resolve conflicts with main (heartbeatTTL, remove lastHealthCh…
saifsmailbox98 9697458
fix(relay): remove lastHealthCheckStatus references after upstream merge
saifsmailbox98 544ec7c
fix(relay): address PR review — resource type guard, audit event, imp…
saifsmailbox98 4905e27
chore(schema): regenerate resource-auth-methods schema from DB
saifsmailbox98 4da26ed
fix(relay): replace for-of with reduce to satisfy no-restricted-synta…
saifsmailbox98 9910d2e
fix(relay): address second round PR review
saifsmailbox98 40d538f
docs(relay): update CLI docs and permissions for resource auth
saifsmailbox98 22d0333
docs(relay): match gateway docs pattern — accordion per auth method w…
saifsmailbox98 212d4b2
chore(relay): apply prettier formatting
saifsmailbox98 96587f2
fix(resource-auth): validate resource type before consuming enrollmen…
saifsmailbox98 6d35115
fix(relay): org-scope relay lookups in route handlers
saifsmailbox98 2a9c8a3
fix(resource-auth): use resource type in error message instead of har…
saifsmailbox98 b744290
fix(relay): add timeout parameter to createRelayConnection, use 15s f…
saifsmailbox98 d02e0c5
chore: remove unused BadRequestError imports from relay and gateway r…
saifsmailbox98 5327a9f
chore: use realistic timestamp for relay-resource-auth migration
saifsmailbox98 40a6ea6
chore: update relay-resource-auth migration timestamp
saifsmailbox98 ec81260
docs(relay): remove legacy machine identity section from CLI docs
saifsmailbox98 71bec45
docs(relay): update deployment guide and terraform for resource auth
saifsmailbox98 628b151
docs(relay): minor copy fix
saifsmailbox98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
backend/src/db/migrations/20260521025807_relay-resource-auth.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import { Knex } from "knex"; | ||
|
|
||
| import { TableName } from "../schemas"; | ||
|
|
||
| export async function up(knex: Knex): Promise<void> { | ||
| // 1. Add relayId FK to resource_auth_methods — same nullable-FK-per-resource-type | ||
| // pattern used for gatewayId (see 20260430143000_resource-auth-methods.ts). | ||
| if (await knex.schema.hasTable(TableName.ResourceAuthMethod)) { | ||
| const hasRelayId = await knex.schema.hasColumn(TableName.ResourceAuthMethod, "relayId"); | ||
| if (!hasRelayId) { | ||
| await knex.schema.alterTable(TableName.ResourceAuthMethod, (t) => { | ||
| t.uuid("relayId").nullable(); | ||
| t.foreign("relayId").references("id").inTable(TableName.Relay).onDelete("CASCADE"); | ||
| }); | ||
|
|
||
| await knex.schema.raw(` | ||
| CREATE UNIQUE INDEX one_method_per_relay | ||
| ON ${TableName.ResourceAuthMethod} ("relayId") | ||
| WHERE "relayId" IS NOT NULL | ||
| `); | ||
| } | ||
| } | ||
|
|
||
| // 2. Add tokenVersion to relays — used for stateless JWT revocation, | ||
| // same pattern as gateways_v2.tokenVersion. | ||
| if (await knex.schema.hasTable(TableName.Relay)) { | ||
| const hasTokenVersion = await knex.schema.hasColumn(TableName.Relay, "tokenVersion"); | ||
| if (!hasTokenVersion) { | ||
| await knex.schema.alterTable(TableName.Relay, (t) => { | ||
| t.integer("tokenVersion").notNullable().defaultTo(0); | ||
| }); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| export async function down(knex: Knex): Promise<void> { | ||
| if (await knex.schema.hasTable(TableName.Relay)) { | ||
| const hasTokenVersion = await knex.schema.hasColumn(TableName.Relay, "tokenVersion"); | ||
| if (hasTokenVersion) { | ||
| await knex.schema.alterTable(TableName.Relay, (t) => { | ||
| t.dropColumn("tokenVersion"); | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| if (await knex.schema.hasTable(TableName.ResourceAuthMethod)) { | ||
| const hasRelayId = await knex.schema.hasColumn(TableName.ResourceAuthMethod, "relayId"); | ||
| if (hasRelayId) { | ||
| await knex.schema.raw(`DROP INDEX IF EXISTS one_method_per_relay`); | ||
| await knex.schema.alterTable(TableName.ResourceAuthMethod, (t) => { | ||
| t.dropColumn("relayId"); | ||
| }); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.