Skip to content

Commit 2c1536e

Browse files
committed
fixup! add slug or port to support separation of terminal and ports
1 parent 4426bcf commit 2c1536e

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

coderd/database/dump.sql

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/migrations/000301_add_workspace_app_audit_sessions.up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CREATE UNLOGGED TABLE workspace_app_audit_sessions (
33
agent_id UUID NOT NULL,
44
app_id UUID NULL,
55
user_id UUID NULL,
6-
ip inet NOT NULL,
6+
ip inet NULL,
77
slug_or_port TEXT NOT NULL,
88
started_at TIMESTAMP WITH TIME ZONE NOT NULL,
99
updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
INSERT INTO workspace_app_audit_sessions
2-
(agent_id, app_id, user_id, ip, started_at, updated_at)
2+
(agent_id, app_id, user_id, ip, slug_or_port, started_at, updated_at)
33
VALUES
4-
('45e89705-e09d-4850-bcec-f9a937f5d78d', '36b65d0c-042b-4653-863a-655ee739861c', '30095c71-380b-457a-8995-97b8ee6e5307', '127.0.0.1', '2025-03-04 15:08:38.579772+02', '2025-03-04 15:06:48.755158+02'),
5-
('45e89705-e09d-4850-bcec-f9a937f5d78d', '36b65d0c-042b-4653-863a-655ee739861c', NULL, '127.0.0.1', '2025-03-04 15:08:44.411389+02', '2025-03-04 15:08:44.411389+02'),
6-
('45e89705-e09d-4850-bcec-f9a937f5d78d', NULL, NULL, '::1', '2025-03-04 15:25:55.555306+02', '2025-03-04 15:25:55.555306+02');
4+
('45e89705-e09d-4850-bcec-f9a937f5d78d', '36b65d0c-042b-4653-863a-655ee739861c', '30095c71-380b-457a-8995-97b8ee6e5307', '127.0.0.1', '', '2025-03-04 15:08:38.579772+02', '2025-03-04 15:06:48.755158+02'),
5+
('45e89705-e09d-4850-bcec-f9a937f5d78d', '36b65d0c-042b-4653-863a-655ee739861c', NULL, '127.0.0.1', '', '2025-03-04 15:08:44.411389+02', '2025-03-04 15:08:44.411389+02'),
6+
('45e89705-e09d-4850-bcec-f9a937f5d78d', NULL, NULL, '::1', 'terminal', '2025-03-04 15:25:55.555306+02', '2025-03-04 15:25:55.555306+02');

coderd/workspaceapps/db.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -467,12 +467,13 @@ func (p *DBTokenProvider) auditInitAutocommitRequest(ctx context.Context, w http
467467
}
468468

469469
sessionID, err = tx.InsertWorkspaceAppAuditSession(dangerousSystemCtx, database.InsertWorkspaceAppAuditSessionParams{
470-
AgentID: aReq.dbReq.Agent.ID,
471-
AppID: uuid.NullUUID{Valid: aReq.dbReq.App.ID != uuid.Nil, UUID: aReq.dbReq.App.ID},
472-
UserID: userID,
473-
Ip: aReq.ip,
474-
StartedAt: aReq.time,
475-
UpdatedAt: aReq.time,
470+
AgentID: aReq.dbReq.Agent.ID,
471+
AppID: uuid.NullUUID{Valid: aReq.dbReq.App.ID != uuid.Nil, UUID: aReq.dbReq.App.ID},
472+
UserID: userID,
473+
Ip: aReq.ip,
474+
SlugOrPort: appInfo.SlugOrPort,
475+
StartedAt: aReq.time,
476+
UpdatedAt: aReq.time,
476477
})
477478
if err != nil {
478479
return xerrors.Errorf("insert workspace app audit session: %w", err)

0 commit comments

Comments
 (0)