Commit Graph

32 Commits

Author SHA1 Message Date
Kyle Carberry 5abfe5afd0
chore: rename dbfake to dbmem (#10432) 2023-10-30 17:42:20 +00:00
Cian Johnston 7d7c84bb4d
feat(coderd): connect dbcrypt package implementation (#9523)
See also: https://github.com/coder/coder/pull/9522

- Adds commands `server dbcrypt {rotate,decrypt,delete}` to re-encrypt, decrypt, or delete encrypted data, respectively.
- Plumbs through dbcrypt in enterprise/coderd (including unit tests).
- Adds documentation in admin/encryption.md.

This enables dbcrypt by default, but the feature is soft-enforced on supplying external token encryption keys. Without specifying any keys, encryption/decryption is a no-op.
2023-09-07 15:49:49 +01:00
Mathias Fredriksson 19d7da3d24
refactor(coderd/database): split `Time` and `Now` into `dbtime` package (#9482)
Ref: #9380
2023-09-01 16:50:12 +00:00
Kyle Carberry 22e781eced
chore: add /v2 to import module path (#9072)
* chore: add /v2 to import module path

go mod requires semantic versioning with versions greater than 1.x

This was a mechanical update by running:
```
go install github.com/marwan-at-work/mod/cmd/mod@latest
mod upgrade
```

Migrate generated files to import /v2

* Fix gen
2023-08-18 18:55:43 +00:00
Kayla Washburn 9710bada06
fix: redirect to login upon authentication error (#9134) 2023-08-17 13:54:20 -06:00
Steven Masley 2ebd0ec6c5
fix: resolve nil pointer dereference on missing oauth config (#8352) 2023-07-06 16:46:22 -04:00
Steven Masley 658246d5f2
chore: add workspace proxies to the backend (#7032)
Co-authored-by: Dean Sheather <dean@deansheather.com>
2023-04-17 19:57:21 +00:00
Kyle Carberry df31636e72
feat: pass `access_token` to `coder_git_auth` resource (#6713)
This allows template authors to leverage git auth to perform
custom actions, like clone repositories.
2023-03-22 19:37:08 +00:00
Dean Sheather 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
Dean Sheather cf9abe3a6c
feat: add session expiry control flags (#5976)
Adds --session-duration which lets admins customize the default session
expiration for browser sessions.

Adds --disable-session-expiry-refresh which allows admins to prevent
session expiry from being automatically bumped upon the API key being
used.
2023-02-03 17:38:36 +00:00
Steven Masley 8b424f03c2
chore: Rename databasefake --> dbfake (#6011) 2023-02-02 19:28:55 -06:00
Steven Masley 4a6fc40949
feat: Add database data generator to make fakedbs easier to populate (#5922)
* feat: Add database data generator to make fakedbs easier to populate
2023-01-31 15:10:03 -06:00
Kyle Carberry 7ad87505c8
chore: move agent functions from `codersdk` into `agentsdk` (#5903)
* chore: rename `AgentConn` to `WorkspaceAgentConn`

The codersdk was becoming bloated with consts for the workspace
agent that made no sense to a reader. `Tailnet*` is an example
of these consts.

* chore: remove `Get` prefix from *Client functions

* chore: remove `BypassRatelimits` option in `codersdk.Client`

It feels wrong to have this as a direct option because it's so infrequently
needed by API callers. It's better to directly modify headers in the two
places that we actually use it.

* Merge `appearance.go` and `buildinfo.go` into `deployment.go`

* Merge `experiments.go` and `features.go` into `deployment.go`

* Fix `make gen` referencing old type names

* Merge `error.go` into `client.go`

`codersdk.Response` lived in `error.go`, which is wrong.

* chore: refactor workspace agent functions into agentsdk

It was odd conflating the codersdk that clients should use
with functions that only the agent should use. This separates
them into two SDKs that are closely coupled, but separate.

* Merge `insights.go` into `deployment.go`

* Merge `organizationmember.go` into `organizations.go`

* Merge `quota.go` into `workspaces.go`

* Rename `sse.go` to `serversentevents.go`

* Rename `codersdk.WorkspaceAppHostResponse` to `codersdk.AppHostResponse`

* Format `.vscode/settings.json`

* Fix outdated naming in `api.ts`

* Fix app host response

* Fix unsupported type

* Fix imported type
2023-01-29 15:47:24 -06:00
Mathias Fredriksson 8afdf24d10
chore: Update sqlc to v1.16.0 (#5788)
* chore: Update sqlc to v1.16.0

* chore: Fix cases where types became Null-types

* chore: Set parameter_schemas default_destination_scheme and default_source_scheme to NOT NULL

* chore: Add enum validation to database fake

* chore: Fix all tests that skipping enum values

* fix: Use correct err in providionerdserver audit log failure log
2023-01-23 13:14:47 +02:00
Kyle Carberry f75a54cd1e
feat: Support x-forwarded-for headers for IPs (#4684)
* feat: Support x-forwarded-for headers for IPs

Fixes #4430.

* Fix realip accepting headers

* Fix unused headers
2022-10-23 13:21:49 -05:00
Ammar Bandukwala 423ac04156
coderd: tighten /login rate limiting (#4432)
* coderd: tighten /login rate limit

* coderd: add Bypass rate limit header
2022-10-20 17:01:23 +00:00
Jon Ayers d0b1c36d51
fix: prevent refreshing tokens that don't exist (#4661)
- When logging in with Google OIDC refresh tokens are not
  provided unless explicitly asked for. This PR updates
  the logic to avoid attempting to refresh the token if
  a refresh token does not exist.

  A session should only be dependent on a valid Coder API
  key, the state of its OAuth token (beyond initial authentication)
  should be irrelevant.
2022-10-20 00:25:57 -05:00
Garrett Delfosse 3cb2d52a08
fix: issue with token auth (#4483) 2022-10-11 15:58:28 +00:00
Dean Sheather 6deef06ad2
feat: secure and cross-domain subdomain-based proxying (#4136)
Co-authored-by: Kyle Carberry <kyle@carberry.com>
2022-09-22 22:30:32 +00:00
Colin Adler 5de6f86959
feat: trace httpapi.{Read,Write} (#4134) 2022-09-21 17:07:00 -05:00
Dean Sheather 29d804e692
feat: add API key scopes and application_connect scope (#4067) 2022-09-19 17:39:02 +00:00
Steven Masley 9b5ee8f267
feat: Implement (but not enforce) CSRF for FE requests (#3786)
Future work is to enforce CSRF

Co-authored-by: Presley Pizzo <presley@coder.com>
2022-09-13 15:26:46 -04:00
Jon Ayers c3eea98db0
fix: use unique ID for linked accounts (#3441)
- move OAuth-related fields off of api_keys into a new user_links table
- restrict users to single form of login
- process updates to user email/usernames for OIDC
- added a login_type column to users
2022-08-17 18:00:53 -05:00
Jon Ayers 7e9819f2a8
ref: move httpapi.Reponse into codersdk (#2954) 2022-07-12 19:15:02 -05:00
Kyle Carberry 2c89e07e12
fix: Redirect to login when unauthenticated and requesting a workspace app (#2903)
Fixes #2884.
2022-07-11 13:46:01 -05:00
Kyle Carberry 4851d932c4
fix: Split host and port before storing IP (#2594)
The IP was always nil prior, and this fixes the test to
check for that as well!
2022-06-26 21:22:03 +00:00
Kyle Carberry b7eeb436ad
feat: Add `ip_address` to API keys (#2580)
Fixes #2561.
2022-06-22 17:32:21 +00:00
Steven Masley af401e3fe1
chore: Linter rule for properly formatted api errors (#2123)
* chore: Linter rule for properly formatted api errors
* Add omitempty to 'Detail' field
2022-06-07 14:33:06 +00:00
Steven Masley 26a2a169df
fix: Suspended users cannot authenticate (#1849)
* fix: Suspended users cannot authenticate

- Merge roles and apikey extract httpmw
- Add member account to make dev
- feat: UI Shows suspended error logging into suspended account
- change 'active' route to 'activate'
2022-05-31 08:06:42 -05:00
Garrett Delfosse 0706c60445
chore: Add watch workspace endpoint (#1493) 2022-05-18 16:16:26 -05:00
Kyle Carberry 7496c3da81
feat: Add GitHub OAuth (#1050)
* Initial oauth

* Add Github authentication

* Add AuthMethods endpoint

* Add frontend

* Rename basic authentication to password

* Add flags for configuring GitHub auth

* Remove name from API keys

* Fix authmethods in test

* Add stories and display auth methods error
2022-04-23 22:58:57 +00:00
Steven Masley 591523a078
chore: Move httpapi, httpmw, & database into `coderd` (#568)
* chore: Move httpmw to /coderd directory
httpmw is specific to coderd and should be scoped under coderd

* chore: Move httpapi to /coderd directory
httpapi is specific to coderd and should be scoped under coderd

* chore: Move database  to /coderd directory
database is specific to coderd and should be scoped under coderd

* chore: Update codecov & gitattributes for generated files
* chore: Update Makefile
2022-03-25 16:07:45 -05:00
Renamed from httpmw/apikey_test.go (Browse further)