Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
044fd16
feat: add the chat_automation RBAC resource
ThomasK33 Nov 11, 2026
762adc6
feat: add the chat automations schema, queries and audit entry
ThomasK33 Nov 11, 2026
9fb2d1d
test(coderd/database/migrations): stop the 000615 upgrade test at ver…
ThomasK33 Nov 11, 2026
3a01b01
feat: delete a deleted user's chat automations
ThomasK33 Nov 11, 2026
1dfeded
Merge remote-tracking branch 'origin/main' into tk/automations-schema
ThomasK33 Nov 11, 2026
d2e4aea
test: use whole SQL statements and mark fixture secrets for gosec
ThomasK33 Nov 11, 2026
0f78432
chore: remove narrating comments from the chat automation schema branch
ThomasK33 Nov 11, 2026
5daad2f
chore: restore the comments that state a reason
ThomasK33 Nov 11, 2026
97a37ed
refactor: leave the chat automation audit entry to the first PR that …
ThomasK33 Nov 11, 2026
dfade64
fix(coderd/database/migrations): make the 000642 down safe for the pr…
ThomasK33 Nov 12, 2026
3f5b030
fix(coderd/database): test the 000642 protections and name the safe r…
ThomasK33 Nov 12, 2026
fc3dde7
fix(coderd/database/migrations): put the rollback guidance in the 000…
ThomasK33 Nov 12, 2026
3f3d57f
fix(coderd): pair queued automation IDs and keep chat_automation out …
ThomasK33 Nov 12, 2026
3429042
fix(enterprise/dbcrypt): refuse a chat automation webhook secret unti…
ThomasK33 Nov 12, 2026
bc579c4
test(coderd/database/migrations): assert that the refused 000642 down…
ThomasK33 Nov 12, 2026
07d30c1
Merge remote-tracking branch 'origin/main' into tk/automations-schema
ThomasK33 Nov 13, 2026
5a961eb
chore(coderd/database): regenerate queries.sql.go after the merge of …
ThomasK33 Nov 13, 2026
391397f
test: cut tests that repeat or cannot fail
ThomasK33 Nov 13, 2026
6a31a3d
refactor: move four uncalled chat automation items to the PR that fir…
ThomasK33 Nov 13, 2026
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
12 changes: 12 additions & 0 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions coderd/apikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ func (api *API) postToken(rw http.ResponseWriter, r *http.Request) {
})
return
}
// A replica of the previous release fails to load an API key
// whose allow list names a resource type it does not know.
// chat_automation is new, so it stays out of allow lists
// until a rolling upgrade can no longer meet such a replica.
if entry.Type == rbac.ResourceChatAutomation.Type {
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
Message: "Failed to create API key.",
Detail: "Resource type \"chat_automation\" cannot be used in an allow list yet.",
})
return
}
rbacAllowListElements = append(rbacAllowListElements, entry)
}

Expand Down
27 changes: 27 additions & 0 deletions coderd/apikey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,33 @@ func TestCreateTokenScopes(t *testing.T) {
}
}

// A replica of the previous release cannot load a key whose allow list
// names chat_automation, so a token cannot name it yet.
func TestTokenAllowListRejectsChatAutomation(t *testing.T) {
t.Parallel()

client := coderdtest.New(t, nil)
_ = coderdtest.CreateFirstUser(t, client)
ctx := testutil.Context(t, testutil.WaitLong)

for _, target := range []codersdk.APIAllowListTarget{
codersdk.AllowTypeTarget(codersdk.ResourceChatAutomation),
codersdk.AllowResourceTarget(codersdk.ResourceChatAutomation, uuid.New()),
} {
_, err := client.CreateToken(ctx, codersdk.Me, codersdk.CreateTokenRequest{
AllowList: []codersdk.APIAllowListTarget{codersdk.AllowTypeTarget(codersdk.ResourceWorkspace), target},
})
var sdkErr *codersdk.Error
require.ErrorAs(t, err, &sdkErr)
require.Equal(t, http.StatusBadRequest, sdkErr.StatusCode())
require.Contains(t, sdkErr.Detail, `"chat_automation" cannot be used in an allow list`)
}

keys, err := client.Tokens(ctx, codersdk.Me, codersdk.TokensFilter{})
require.NoError(t, err)
require.Empty(t, keys, "a refused request stores no key")
}

func TestTokenScopeCeiling(t *testing.T) {
t.Parallel()

Expand Down
Loading
Loading