Commit Graph

864 Commits

Author SHA1 Message Date
331a49bf75 fix: dbauthz: fix RBAC call for GetTemplateVersionVariables (#6670)
In GetTemplateVersionVariables we were effectively asking the provisionerd role to call rbac.ActionCreate on rbac.ResourceTemplate, which will never work. Updated this to be rbac.ActionRead instead.
2023-03-20 10:22:16 +00:00
c3fb1b325f feat: add owner_oidc_access_token to coder_workspace data source (#6042)
See the discussion in Discord here:
https://discord.com/channels/747933592273027093/1071182088490987542/1071182088490987542

Related provider PR: coder/terraform-provider-coder#91
2023-03-17 15:25:08 -05:00
090e37fc46 feat(audit): auditing token addition and removal (#6649)
* auditing tokens

* adding diffs for token auditing

* added test

* generating docs

* auditing owner field
2023-03-17 10:41:44 -07:00
1c05b46b02 chore: add debug logs for OIDC responses (#6641) 2023-03-16 19:33:45 -05:00
fe247c86eb feat: Add deployment side config-ssh options (#6613)
* feat: Allow setting deployment wide ssh config settings
* feat: config-ssh respects deployment ssh config
* The '.' is now configurable
* Move buildinfo into deployment.go
2023-03-16 13:03:37 -05:00
b693b9f599 chore: fix workspace audit log flake (#6494)
This happened because sometimes a build would be queued
and completed intermittently in CI.

See https://github.com/coder/coder/actions/runs/4358121985/jobs/7618290591
2023-03-16 12:47:54 -05:00
811a69f371 feat(site): add ability to create tokens from account tokens page (#6608)
* add token actions

* added basic token form

* removed token switch

* refined date field

* limiting lifetime days to maxTokenLifetime

* broke apart files

* added loader and error

* fixed form layout

* added some unit tests

* fixed be tests

* no authorize check
2023-03-16 08:25:08 -07:00
a7c734c60b feat: support list(string) as coder_parameter (#6618)
* feat: support list(string) as coder_parameter

* Fix
2023-03-16 11:07:10 +01:00
f91b3acf93 fix: group routine workspace agent stats by id (#6601)
Before this was creating separate rows for distinct stat entries, which
resulted in significantly more data being sent to telemetry.
2023-03-14 10:52:03 -05:00
17bc5794d4 fix: direct embedded derp traffic directly to the server (#6595)
Prior to this change, DERP traffic would route from `coderd` to the
`CODER_ACCESS_URL` to reach the internal DERP server, which may have
resulted in slower connections due to proxying, or the failure of
web traffic entirely.

If your Coder deployment has a proxy in front of it, your traffic through
web terminals, apps, and port-forwarding is about to get a lot faster!
2023-03-14 14:46:47 +00:00
348530000f fix(coderd): Ensure agent disconnect happens after timeout (#6600)
Fixes #6598
2023-03-14 13:14:47 +00:00
7587850a1c feat: import value from legacy variable to build parameter (#6556) 2023-03-14 12:02:44 +00:00
35df1b10d0 feat: add workspace agent stat reporting to telemetry (#6577)
This aggregates stats periodically and sends them by agent ID to
our telemetry server. It should help us identify which editors are
primarily in use.
2023-03-13 14:16:54 -05:00
179d9e0d24 fix(coderd): Detect agent disconnect via inactivity (#6528)
Fixes #5901
2023-03-13 11:54:53 +02:00
144f374f60 refactor(dbauthz): add authz for system-level functions (#6513)
- Introduces rbac.ResourceSystem
- Grants system.* to system and provisionerd rbac subjects
- Updates dbauthz system queries where applicable
- coderd: Avoid index out of bounds in api.workspaceBuilds
- dbauthz: move GetUsersByIDs out of system, modify RBAC check to ResourceUser
- workspaceapps: Add test case for when owner of app is not found
2023-03-10 18:09:28 +00:00
7eb2c2ff6d Revert "chore: Implement joins with golang templates (#6429)" (#6560)
This reverts commit 8b125d6c5d.
2023-03-10 10:39:02 -06:00
a8433b18e4 fix: Prevent infinite redirects on oidc errors (#6550)
* fix: Prevent infinite redirects on bad oidc scopes
* Show oidc errors
2023-03-10 10:12:29 -06:00
8b125d6c5d chore: Implement joins with golang templates (#6429)
* feat: Implement view for workspace builds to include rbac info

* Removes the need to fetch the workspace to run an rbac check.
* chore: Use workspace build as RBAC object
* chore: Use golang templates instead of sqlc files
2023-03-10 09:44:38 -06:00
90901ca129 fix: panic on deleted template (#6553) 2023-03-10 12:26:11 +01:00
6023264a81 fix: typo in error message (#6551)
* fix: typo in error message

* fix
2023-03-10 09:20:22 +00:00
7f25d31745 feat: Allow changing the 'group' oidc claim field (#6546)
* feat: Allow changing the 'group' oidc claim field
* Enable empty groups support
* fix: Delete was wiping all groups, not just the single user's groups
* Update docs
* fix: Dbfake delete group member fixed
2023-03-09 23:31:38 -06:00
70b093ff2a fix: filter session count sums by created_at (#6529)
Fixes the session totals being waaaaay too high!
2023-03-09 17:08:41 +02:00
1cc10f2ffb fix: only sum connection latencies when they are set (#6524)
This was producing a median that didn't make sense.
2023-03-09 03:53:09 +00:00
1199a9330a chore: add fly.io install source (#6509) 2023-03-09 03:16:55 +00:00
5304b4e483 feat: add connection statistics for workspace agents (#6469)
* fix: don't make session counts cumulative

This made for some weird tracking... we want the point-in-time
number of counts!

* Add databasefake query for getting agent stats

* Add deployment stats endpoint

* The query... works?!?

* Fix aggregation query

* Select from multiple tables instead

* Fix continuous stats

* Increase period of stat refreshes

* Add workspace counts to deployment stats

* fmt

* Add a slight bit of responsiveness

* Fix template version editor overflow

* Add refresh button

* Fix font family on button

* Fix latest stat being reported

* Revert agent conn stats

* Fix linting error

* Fix tests

* Fix gen

* Fix migrations

* Block on sending stat updates

* Add test fixtures

* Fix response structure

* make gen
2023-03-08 21:05:45 -06:00
d67552f852 fix: add more cached certificates to azure instance identity (#6519)
This was failing for GovCloud. Now it falls back to fetch, and a test
has been added to notify when certificates are becoming outdated.
2023-03-08 19:32:10 -06:00
3b87316ad7 feat: propagate job error codes (#6507)
* feat: propagate job error_code

* fix

* Fix

* Fix

* Fix

* add errors to typesGenerated

* Address PR comments

* Fix
2023-03-08 16:32:00 +01:00
524b14adbc fix: fetch provisioner logs after end of logs message (#6495)
I think this should _actually_ fix it. See
https://github.com/coder/coder/actions/runs/4358242625/jobs/7618562167

The problem was that this loop is ran async so even though
messages are sent in order, we were processing too slowly and
the end of logs was published first.
2023-03-09 01:13:08 +10:00
3b73321a6c feat: refactor deployment config (#6347) 2023-03-07 15:10:01 -06:00
bb0a996fc2 chore: fix buffered provisioner job logs close flake (#6492)
See https://github.com/coder/coder/actions/runs/4357599919/jobs/7617111287
2023-03-07 20:08:13 +00:00
1bdd2abed7 feat: use JWT ticket to avoid DB queries on apps (#6148)
Issue a JWT ticket on the first request with a short expiry that
contains details about which workspace/agent/app combo the ticket is
valid for.
2023-03-07 19:38:11 +00:00
23bebb40e2 fix: bump migration to resolve duplicate id (#6486)
This happened because two PRs with different migrations
merged at the same time!
2023-03-07 10:04:06 -06:00
2d4706ac33 feat: mark coder_parameter as "required" (#6433)
* Add required column

* Pass through providerd

* Pass the required property down

* Optional

* Fix

* Fix

* Fix

* fix

* CLI create: support for optional fields

* Use HTML API to mark fields required

* Fix

* Improve validation

* more fixes

* make fmt

* Fix

* WIP

* Fix: test

* CLI update tets

* OptionalParameterAdded

* Fix: migration
2023-03-07 16:38:31 +01:00
ef2e86f309 increase default max-token-duration (#6467) 2023-03-07 06:35:48 -08:00
87ed7a7dba chore: use nil map on agent stats to check if report interval should be returned (#6479)
See https://github.com/coder/coder/actions/runs/4350638262/jobs/7601537088
2023-03-07 14:25:04 +00:00
66a6b590a1 feat: add template max_ttl (#6114)
Co-authored-by: Bruno Quaresma <bruno@coder.com>
2023-03-07 14:14:58 +00:00
0c2b432c1b feat: Add migration fixer script (for branches) (#6466) 2023-03-07 14:47:33 +02:00
fd02f73708 chore: ensure pubsub messages are delivered in order for in-memory variant (#6474)
PostgreSQL provides this guarantee, which led to some flakes in tests.
See: https://github.com/coder/coder/actions/runs/4350034299/jobs/7600478096
2023-03-07 04:36:25 +00:00
74632e460c fix: adjust build state permission to require template update (#6472) 2023-03-07 04:24:32 +00:00
964032d783 chore: ignore query cancel error in activitybump (#6476)
See https://github.com/coder/coder/actions/runs/4350254306/jobs/7600782432

It's fine to ignore this, because workspace agent stats happen async
and might occur when shutting down.
2023-03-06 21:27:21 -06:00
09f87d1df1 chore: remove empty case for metricscache (#6473)
This wasn't necessary to test and just caused flakes.
See: https://github.com/coder/coder/actions/runs/4350034299/jobs/7600340648
2023-03-06 21:13:08 -06:00
cf75d7e1fb fix: clean up idle http conns on wsconncache close (#6471)
See https://github.com/coder/coder/actions/runs/4346769070/jobs/7593243836
2023-03-06 20:45:49 -06:00
8a6635bf5f chore: Never run v2 migrations on v1 database (#6438) 2023-03-06 13:49:03 -06:00
22e3ff96be feat(agent): Add shutdown lifecycle states and shutdown_script support (#6139)
* feat(api): Add agent shutdown lifecycle states

* feat(agent): Add shutdown_script support

* feat(agent): Add shutdown_script timeout

* feat(site): Support new agent lifecycle states

---

Co-authored-by: Marcin Tojek <marcin@coder.com>
2023-03-06 21:34:00 +02:00
e78c272a72 chore: System context to oidc login (#6427) 2023-03-04 14:32:07 -06:00
973df199b0 test: Check created_at for prepareData to ensure user order (#6436)
* test: Check created_at for prepareData to ensure user order

* test: Consistent user ordering in dbfake

* import order

* Linting
2023-03-03 13:09:04 -06:00
71d1e63af0 feat: add ability to name tokens (#6365)
* add tokens switch

* reorged TokensPage

* using Trans component for description

* using Trans component on DeleteDialog

* add owner col

* simplify hook return

* lint

* type for response

* added flag for name

* fixed auth

* lint, prettier, tests

* added unique index for login type token

* remove tokens by name

* better check for unique constraint

* docs

* test: Fix dbfake to insert token name

* fix doc tests

* Update cli/tokens.go

Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>

* Update coderd/database/migrations/000102_add_apikey_name.down.sql

Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>

* add more specificity to IsUniqueViolation check

* fix tests

* Fix AutorizeAllEndpoints

* rename migration

---------

Co-authored-by: Steven Masley <stevenmasley@coder.com>
Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
2023-03-02 09:39:38 -08:00
2ff1c6d613 feat: add agent stats for different connection types (#6412)
This allows us to track when our extensions are used, when the
web terminal is used, and average connection latency to the agent.
2023-03-02 08:06:00 -06:00
67db36bf81 feat: Add form to modify managed Template variables (#6257) 2023-03-02 14:11:16 +01:00
8cf292f50a feat: Guard search queries against common mistakes (#6404)
* feat: Error on excessive invalid search keys
* feat: Guard search queries against common mistakes
* Raise errors in FE on workspaces table
* All errors should be on newlines
2023-03-01 23:28:56 -06:00