-
-
Notifications
You must be signed in to change notification settings - Fork 186
fix: null user_id for env bootstrap keys + H2 support for registry fetches #2370
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
kmendell
merged 8 commits into
getarcaneapp:main
from
GiulioSavini:fix/swarm-agent-token-http2-registry
Apr 20, 2026
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
11b7a88
fix: allow null user_id on env bootstrap keys, enable H2 for registry…
4f62a43
fix: guard nil UserID before marking key as used
1ddd146
fix: correct SQLite 046 migration indexes to match post-041 state
f6e25c5
env access token resolver
kmendell df5e34b
Merge branch 'main' into fix/swarm-agent-token-http2-registry
kmendell f46dac7
fix: accept bootstrap keys in proxy auth validator
92e5e4e
merge: resolve conflicts with upstream/main
51fbb5c
Merge branch 'main' into fix/swarm-agent-token-http2-registry
kmendell 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
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
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
3 changes: 3 additions & 0 deletions
3
backend/resources/migrations/postgres/046_nullable_api_key_user_id.down.sql
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,3 @@ | ||
| -- Remove environment bootstrap keys (user_id IS NULL) before restoring the NOT NULL constraint. | ||
| DELETE FROM api_keys WHERE user_id IS NULL; | ||
| ALTER TABLE api_keys ALTER COLUMN user_id SET NOT NULL; |
3 changes: 3 additions & 0 deletions
3
backend/resources/migrations/postgres/046_nullable_api_key_user_id.up.sql
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,3 @@ | ||
| -- Environment bootstrap keys are owned by the system, not a user. | ||
| -- Allow user_id to be NULL so agent-side key creation doesn't violate the FK constraint. | ||
| ALTER TABLE api_keys ALTER COLUMN user_id DROP NOT NULL; |
60 changes: 60 additions & 0 deletions
60
backend/resources/migrations/sqlite/046_nullable_api_key_user_id.down.sql
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,60 @@ | ||
| -- Remove environment bootstrap keys (user_id IS NULL) before restoring the NOT NULL constraint. | ||
| PRAGMA foreign_keys=OFF; | ||
|
|
||
| DROP TABLE IF EXISTS api_keys_old; | ||
|
|
||
| CREATE TABLE api_keys_old ( | ||
| id TEXT PRIMARY KEY, | ||
| name TEXT NOT NULL, | ||
| description TEXT, | ||
| key_hash TEXT NOT NULL, | ||
| key_prefix TEXT NOT NULL, | ||
| managed_by TEXT, | ||
| user_id TEXT NOT NULL, | ||
| environment_id TEXT, | ||
| expires_at DATETIME, | ||
| last_used_at DATETIME, | ||
| created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| updated_at DATETIME, | ||
| FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, | ||
| FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE | ||
| ); | ||
|
|
||
| INSERT INTO api_keys_old ( | ||
| id, | ||
| name, | ||
| description, | ||
| key_hash, | ||
| key_prefix, | ||
| managed_by, | ||
| user_id, | ||
| environment_id, | ||
| expires_at, | ||
| last_used_at, | ||
| created_at, | ||
| updated_at | ||
| ) | ||
| SELECT | ||
| id, | ||
| name, | ||
| description, | ||
| key_hash, | ||
| key_prefix, | ||
| managed_by, | ||
| user_id, | ||
| environment_id, | ||
| expires_at, | ||
| last_used_at, | ||
| created_at, | ||
| updated_at | ||
| FROM api_keys | ||
| WHERE user_id IS NOT NULL; | ||
|
|
||
| DROP TABLE api_keys; | ||
| ALTER TABLE api_keys_old RENAME TO api_keys; | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_api_keys_user_id ON api_keys(user_id); | ||
| CREATE INDEX IF NOT EXISTS idx_api_keys_key_hash ON api_keys(key_hash); | ||
| CREATE INDEX IF NOT EXISTS idx_api_keys_key_prefix ON api_keys(key_prefix); | ||
|
|
||
| PRAGMA foreign_keys=ON; |
60 changes: 60 additions & 0 deletions
60
backend/resources/migrations/sqlite/046_nullable_api_key_user_id.up.sql
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,60 @@ | ||
| -- Environment bootstrap keys are owned by the system, not a user. | ||
| -- Allow user_id to be NULL so agent-side key creation doesn't violate the FK constraint. | ||
| PRAGMA foreign_keys=OFF; | ||
|
|
||
| DROP TABLE IF EXISTS api_keys_new; | ||
|
|
||
| CREATE TABLE api_keys_new ( | ||
| id TEXT PRIMARY KEY, | ||
| name TEXT NOT NULL, | ||
| description TEXT, | ||
| key_hash TEXT NOT NULL, | ||
| key_prefix TEXT NOT NULL, | ||
| managed_by TEXT, | ||
| user_id TEXT, | ||
| environment_id TEXT, | ||
| expires_at DATETIME, | ||
| last_used_at DATETIME, | ||
| created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| updated_at DATETIME, | ||
| FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, | ||
| FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE | ||
| ); | ||
|
|
||
| INSERT INTO api_keys_new ( | ||
| id, | ||
| name, | ||
| description, | ||
| key_hash, | ||
| key_prefix, | ||
| managed_by, | ||
| user_id, | ||
| environment_id, | ||
| expires_at, | ||
| last_used_at, | ||
| created_at, | ||
| updated_at | ||
| ) | ||
| SELECT | ||
| id, | ||
| name, | ||
| description, | ||
| key_hash, | ||
| key_prefix, | ||
| managed_by, | ||
| user_id, | ||
| environment_id, | ||
| expires_at, | ||
| last_used_at, | ||
| created_at, | ||
| updated_at | ||
| FROM api_keys; | ||
|
|
||
| DROP TABLE api_keys; | ||
| ALTER TABLE api_keys_new RENAME TO api_keys; | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_api_keys_user_id ON api_keys(user_id); | ||
| CREATE INDEX IF NOT EXISTS idx_api_keys_key_hash ON api_keys(key_hash); | ||
| CREATE INDEX IF NOT EXISTS idx_api_keys_key_prefix ON api_keys(key_prefix); | ||
|
|
||
| PRAGMA foreign_keys=ON; |
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.
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.