| 14 | ) |
| 15 | |
| 16 | func TestCSRFExemptList(t *testing.T) { |
| 17 | t.Parallel() |
| 18 | |
| 19 | cases := []struct { |
| 20 | Name string |
| 21 | URL string |
| 22 | Exempt bool |
| 23 | }{ |
| 24 | { |
| 25 | Name: "Root", |
| 26 | URL: "https://example.com", |
| 27 | Exempt: true, |
| 28 | }, |
| 29 | { |
| 30 | Name: "WorkspacePage", |
| 31 | URL: "https://coder.com/workspaces", |
| 32 | Exempt: true, |
| 33 | }, |
| 34 | { |
| 35 | Name: "SubApp", |
| 36 | URL: "https://app--dev--coder--user--apps.coder.com/", |
| 37 | Exempt: true, |
| 38 | }, |
| 39 | { |
| 40 | Name: "PathApp", |
| 41 | URL: "https://coder.com/@USER/test.instance/apps/app", |
| 42 | Exempt: true, |
| 43 | }, |
| 44 | { |
| 45 | Name: "API", |
| 46 | URL: "https://coder.com/api/v2", |
| 47 | Exempt: false, |
| 48 | }, |
| 49 | { |
| 50 | Name: "APIMe", |
| 51 | URL: "https://coder.com/api/v2/me", |
| 52 | Exempt: false, |
| 53 | }, |
| 54 | { |
| 55 | Name: "OAuth2Authorize", |
| 56 | URL: "https://coder.com/oauth2/authorize", |
| 57 | Exempt: false, |
| 58 | }, |
| 59 | { |
| 60 | Name: "OAuth2AuthorizeQuery", |
| 61 | URL: "https://coder.com/oauth2/authorize?client_id=test", |
| 62 | Exempt: false, |
| 63 | }, |
| 64 | { |
| 65 | Name: "OAuth2Tokens", |
| 66 | URL: "https://coder.com/oauth2/tokens", |
| 67 | Exempt: true, |
| 68 | }, |
| 69 | { |
| 70 | Name: "OAuth2Register", |
| 71 | URL: "https://coder.com/oauth2/register", |
| 72 | Exempt: true, |
| 73 | }, |