1
0
mirror of https://github.com/hasura/graphql-engine.git synced 2024-12-21 14:31:55 +03:00
Commit Graph

644 Commits

Author SHA1 Message Date
Vamshi Surabhi
ec8b2c80b5
refactor to remove warnings especially with orphan instances ()
* remove phase one/two distinction and hdbquery typeclass

* move extensions to default-extensions

* switch to LazyTx which only acquires a connection if needed

* move defns from TH module into Ops module

* remove tojson orphan instance for http exception

* remove orphan instance for dmlp1

* getTopLevelNodes will not throw any exceptions
2018-12-13 12:56:15 +05:30
Rakesh Emmadi
3ea20bc4d7 allow authentication webhook with POST (close ) () 2018-12-03 16:49:08 +05:30
Anon Ray
512ee6fb9f adds basic support for remote schemas/schema stitching () 2018-11-23 18:32:46 +05:30
Vamshi Surabhi
47dcae1614
fix sql generation for boolean expressions, closes ()
When using self referential relationships in boolean expressions, the exists clause incorrectly uses the table names to qualify columns which will be the same for parent table and the child table. This is now fixed by generating unique aliases as we traverse down the relationships.
2018-11-16 18:10:23 +05:30
Rakesh Emmadi
1539d6b5a6 server port can be set with HASURA_GRAPHQL_SERVER_PORT env variable, closes () 2018-11-15 10:25:39 +05:30
Rakesh Emmadi
9af591e2cb remove x-hasura-access-key header from logs (fix ) () 2018-11-13 14:05:44 +05:30
Rakesh Emmadi
0e9d6994ac refactor nested insert mutation and fix returning (fix ) ()
* improved nested insert execution logic

* integrate error path, improve executing 'withExp' and improve tests

* add more readable types in '/Resolve/Insert.hs'

* set conflict context just before executing WITH expression
2018-11-02 19:31:01 +05:30
Vamshi Surabhi
58582be644
fix parsing webhook response, closes () 2018-10-28 22:01:24 +05:30
Vamshi Surabhi
8b0082eac1
clean up user variables parsing logic and fix explain api () 2018-10-26 21:27:22 +05:30
Rakesh Emmadi
f6ed169219 allow ordering using columns from object relationships (closes ) ()
* allow ordering using columns from object relationships, close 

* validate table fields in nested insert

* add tests

* add docs

* change 'table_order_by' type from enums to ordered map

* remove unwanted code from 'Schema.hs' file

* 'AnnGObject' is not list of field name and value tuple

* update docs for new order_by type

* use 'InsOrdHashMap' for 'AnnGObj'

* handle empty fields in order_by

* remove '_' prefixes for asc/desc

* fix the changed order_by syntax across the repo
2018-10-26 17:27:33 +05:30
Rakesh Emmadi
10d8529d28 allow unauthorized role in accesskey and JWT modes (closes ) () 2018-10-25 23:46:25 +05:30
Vamshi Surabhi
199531cbd9
http and websocket logs now correctly have user information, closes () 2018-10-25 15:07:57 +05:30
Vamshi Surabhi
ab9692da4d
set all session data in a single paramater, 'hasura.user' (closes ) 2018-10-24 16:09:47 +05:30
Vamshi Surabhi
ac537330d0 explain a graphql query, similar to explain of an sql statement (close ) () 2018-10-19 07:45:28 +05:30
Rakesh Emmadi
37e848ccca fix input object validation logic (fix ) () 2018-10-12 16:06:47 +05:30
Rakesh Emmadi
fc7ea9213c fix non-admin insert returns null column values when query affects zero rows in postgres (fix ) ()
Insert trigger function: If query affects no rows then return `null`

Insert trigger function is modified to have 
 `IF r IS NULL THEN RETURN null; ELSE RETURN r; END IF;` in return statement.
2018-09-29 11:12:47 +05:30
Anon Ray
1a0af29920 remove 's' unit from query_execution_time in logs (close ) ()
Removes the seconds unit (trailing `s`) from `query_execution_time` in logs.

- [x] Server

It was a string before, changed to double.

- [x] Bug fix (non-breaking change which fixes an issue)

Docs should mention the type/unit of `query_execution_time` is numeric/double.
2018-09-27 18:02:21 +05:30
Anon Ray
75090d51b9 jwt config now takes a jwk url (close ) ()
JWT config now takes an optional jwk_url parameter (which points to published JWK Set). This is useful for providers who rotate their JWK Set.

Optional jwk_url parameter is taken. The published JWK set under that URL should be in standard JWK format (tools.ietf.org/html/rfc7517#section-4.8).

If the response contains an Expires header, the JWK set is automatically refreshed.
2018-09-27 16:52:49 +05:30
Rakesh Emmadi
e6c5aa5b43 indicate access key is set in the console context (close ) () 2018-09-14 18:57:46 +05:30
Anon Ray
af6121f83d jwt claims check should be case-insensitive (fix ) () 2018-09-13 18:34:50 +05:30
Shahidh K Muhammed
be20a11d37
update checks on ci systems (close ) () 2018-09-12 16:33:36 +05:30
Anon Ray
a5930edd8a uri-decode database uri strings (fix ) () 2018-09-12 11:49:08 +05:30
Tirumarai Selvan
e905535beb implement api to deliver a particular event (close ) () 2018-09-07 17:21:01 +05:30
Anon Ray
f726bb549d add custom namespace in jwt claims (close ) () 2018-09-07 11:30:50 +05:30
Karthik Venkateswaran
e3102dfd5e ui buttons to export and import metadata, reload metadata api (close ) () 2018-09-05 20:55:30 +05:30
Tirumarai Selvan
82e09efce6 add event triggers () 2018-09-05 16:56:46 +05:30
Rakesh Emmadi
0a3f68a6eb allow selectively updating columns on a conflict during insert (fix )
* fix primary key changing on upsert, fix 

* add 'update_columns' in 'on_conflict' object, consider 'allowUpsert'

* 'ConflictCtx' type should respect upsert cases

* validation for not null fields in an object
2018-09-04 19:09:48 +05:30
Anon Ray
b2f88ff28a add support for jwt authorization (close ) ()
The API:
1. HGE has `--jwt-secret` flag or `HASURA_GRAPHQL_JWT_SECRET` env var. The value of which is a JSON.

2. The structure of this JSON is: `{"type": "<standard-JWT-algorithms>", "key": "<the-key>"}`
`type` : Standard JWT algos : `HS256`, `RS256`, `RS512` etc. (see jwt.io).
`key`:
  i. Incase of symmetric key, the key as it is.
  ii. Incase of asymmetric keys, only the public key, in a PEM encoded string or as a X509 certificate.

3. The claims in the JWT token must contain the following:
  i. `x-hasura-default-role` field: default role of that user
  ii. `x-hasura-allowed-roles` : A list of allowed roles for the user. The default role is overriden by `x-hasura-role` header.

4. The claims in the JWT token,  can have other `x-hasura-*` fields where their values can only be strings.

5. The JWT tokens are sent as `Authorization: Bearer <token>` headers.

---
To test:
1. Generate a shared secret (for HMAC-SHA256) or RSA key pair.
2. Goto https://jwt.io/ , add the keys
3. Edit the claims to have `x-hasura-role` (mandatory) and other `x-hasura-*` fields. Add permissions related to the claims to test permissions.
4. Start HGE with `--jwt-secret` flag or `HASURA_GRAPHQL_JWT_SECRET` env var, which takes a JSON string: `{"type": "HS256", "key": "mylongsharedsecret"}` or `{"type":"RS256", "key": "<PEM-encoded-public-key>"}`
5. Copy the JWT token from jwt.io and use it in the `Authorization: Bearer <token>` header.

---
TODO: Support EC public keys. It is blocked on 
2018-08-30 16:02:09 +05:30
Rakesh Emmadi
75e4400bc5 add req_user_id as alias to x-hasura-user-id (fix ) () 2018-08-29 11:17:13 +05:30
Vamshi Surabhi
c901767cd1
update packages ()
* move to stackage 12.4

* upgrade pg-client

* docker build improvements
2018-08-08 13:10:13 +05:30
Vamshi Surabhi
dcde969d66 ignore certain headers from the request when calling the webhook (close ) () 2018-08-06 19:36:48 +05:30
Rakesh Emmadi
8ef2692eb7 improve logs on webhook errors (closes , ) ()
* logging for webhook IO exceptions, fix log request for errors, fix 

* log status code and response in case of any error for webhook
2018-08-03 14:13:35 +05:30
Anon Ray
62b7b800c5 check for updates every 24 hrs in background (fix ) () 2018-07-27 15:04:50 +05:30
Vamshi Surabhi
e3f960da96 initial support for livequeries ()
fix 
2018-07-20 12:52:46 +05:30
Rakesh Emmadi
5efa366b49 add 'on_conflict' argument to insert mutation (closes )
* add 'on_conflict' condition to allow upsert mutation, closes 

* check for empty unique or primary key constraints

* add 'on_conflict' condition test cases and introspection test case

* update 'conflict_action' enum values' description
2018-07-17 18:53:23 +05:30
Rakesh Emmadi
4a76c7e89e server: throw 401 exception for accesskey mismatch/notfound, fix ()
return 401 when access key does not match or is not found, closes 
2018-07-11 11:07:53 +05:30
Rakesh Emmadi
38c91e2b9e catch and log http exceptions from auth webhook, closes 2018-07-09 11:34:41 +05:30
Rakesh Emmadi
b9ff99329a server: process headers only for known urls, fixes 2018-07-06 10:46:42 +05:30
Rakesh Emmadi
e834bc51a6 server: try environment variables if flags are missing, closes 2018-07-06 10:43:46 +05:30
Rakesh Emmadi
b9dd3b2ab2 server: close render console assets version as v[maj.min] () 2018-07-04 18:15:34 +05:30
Rakesh Emmadi
400a0e3f16 server: add v1/version api, fix () 2018-07-03 21:04:25 +05:30
Rakesh Emmadi
128ed2388b server: console is served at /console Closes () 2018-06-29 16:35:09 +05:30
Rakesh Emmadi
f625882199 [server] allow only one of db url or conn params. Closes () 2018-06-28 16:19:40 +05:30
Vamshi Surabhi
530027cf20 move raven into graphql-engine repo 2018-06-28 00:32:00 +05:30