Commit Graph

2126 Commits

Author SHA1 Message Date
Erick Torres
1c508c8bc5 Allow authentication using MSSQL azure-active-directory-service-principal-secret (#11141)
* Extract ignored settings requires by azure authentication

* Change the way to extract initial database settings

* Fix invalid names after extracting from env util

* Replace missing var after solving conflicts

* Add default value to poolconfig

* This should unbreak it

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-05-26 16:18:41 -04:00
rijkvanzanten
d4e0e322ad Fix validate query number comparison
Ref https://github.com/directus/directus/pull/13492#issuecomment-1138770254
2022-05-26 14:02:15 -04:00
Nicola Krumschmidt
3ce0bbd0da Remove npmrc files which prevent lockfile creation in workspaces (#13444)
* Remove npmrc files which prevent lockfile creation in workspaces

Since `v8.5.0` npm will detect that it is running inside a workspace and issue commands at the root package.

* Require a minimum npm version of 8.5.0
2022-05-25 15:15:45 -04:00
Brainslug
e7ff94b55f Added missing "DB_SSL_*_FILE" to the "_FILE" allow list. (#13539) 2022-05-25 15:31:44 +00:00
Azri Kahar
8997753708 fix metadata for directus_folders (#13527) 2022-05-25 08:19:04 -04:00
rijkvanzanten
7e9812d04a v9.11.1 2022-05-24 17:50:37 -04:00
Brainslug
3f4ad0fe87 Environment variable with _FILE suffix containing invalid path throws error on start (#13274)
* opt-in for reading of files from environment variables suffixed with _FILE

* updated docs for new environment variable

* [WIP] allow list

* moved allow list to constants file

* updated whitelist logic for regex matches

* Revert "updated docs for new environment variable"

This reverts commit 584966df38.

* moved allow list back to env.ts to prevent circular dependency
2022-05-24 15:19:52 -04:00
Rijk van Zanten
1187ef8565 Don't require default connection params when using non default type (#13518) 2022-05-24 14:11:43 -04:00
ian
8f52fdf1f9 Validate type of items' primary keys (#13276)
* Validate type of items' primary keys

* Update tests

* Update validations

* Remove DB specific check for statusCode in existing e2e test

* Extract as util function

* Add unit test

* Refactor to generic validateKeys
2022-05-24 11:11:28 -04:00
Nicola Krumschmidt
79b7fc9d4c Fix applyFilter (#13497)
* Revert changes from #11737 to applyFilter

* Add case insensitive operators

* Improve ordering of operators

* Make filters test values more generic and improve structure
2022-05-24 09:37:13 -04:00
Rijk van Zanten
4bcf671f84 Allow floats in number validation (#13492) 2022-05-23 15:49:47 -04:00
Brainslug
eec2c087db Adds _none and _some operators (#13453)
* re-introducing the _none and _some operators

* abstracted subQuery function out of the loop
2022-05-23 10:57:48 -04:00
ian
fa6d9cde22 Add cast-timestamp field flag to system tables (#13429) 2022-05-20 11:16:46 -04:00
rijkvanzanten
f52da51925 v9.11.0 2022-05-19 13:09:50 -04:00
José Varela
999bb85539 Assets: Fix range requests (#13391)
* Return chunk even if range is greater than filesize

* Allow range.start or range.end to not be defined
Examples:
bytes=-300
bytes=300-
bytes=-300- (negative start)

* Make expression lazy instead of greedy
Fix CodeQL "Polynomial regular expression used on uncontrolled data"

* Improve checks readability

* Show proper range in case of failure

* Fix compare falsy values vs zero values

* replace regex

* Handle range validation in a single place

* Clean validation

* Use range object for exception

* Resolve range undefined check

* Prefer strict equality checks

* Cleanup

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-05-19 17:01:18 +00:00
ian
d51240d03f Fix parsing of time and dates when filtering in SQLite (#13410) 2022-05-19 10:00:20 -04:00
ian
ba3fcb8247 Fix compareValue check for _null and _empty type of operators (#13388) 2022-05-18 13:38:38 -04:00
Jesper
b2d8b2319a GraphQL count aggregation for all fields and * (#11871)
* GraphQL count aggregation for all fields

Fixes #11792

* Rename countRows to countAll

* moved function to new apply-query folder

Co-authored-by: jaycammarano <jay.cammarano@gmail.com>
2022-05-18 15:34:12 +00:00
Bernat Vadell
7e1b946b20 Add support to insensitive case operators (#11737)
* feat: refactor apply-query & implements icontains

* feat: implements icontains in app

* New translations en-US.yaml

* tests: fix returns the filter operators for binary

* implement rest insensitive operators

* fix: proposal to fix #5996 (convert "in" into "exists")

* delete unused imports

* fix: prevent error when operator filter value is null

* fix: apply-query imports

* some tests

* fix: _nstarts_with not applied correctly

* tests: add some filter mathematical tests
2022-05-18 09:58:53 -04:00
Azri Kahar
79ddd35fe0 fix user update without status in payload issue (#13375) 2022-05-18 06:59:53 +00:00
ian
72a19477a7 Fix inconsistent revisions after batch update (#13250)
* Sort keys to ensure order

* Set query limit as the number of keys

* Add query limit only when reading by keys

* Update test

* Check if keys is of array type
2022-05-16 13:10:31 -04:00
Azri Kahar
a8908577dd Prevent changing active status of last admin user (#13309) 2022-05-16 11:21:15 -04:00
Samuele Zolfanelli
8d064fc646 Allow creating big integer auto-incremented primary keys in MySQL and PostgreSQL (#13301) 2022-05-16 11:12:17 -04:00
eikaramba
e063f1fe2a Stalling Sqlite when using cascading foreign contraints (#13307)
* Fix #10462: Stalling Sqlite when using cascading foreign contraints

otherwise the transaction pool runs full of knex

* make linter happy
2022-05-16 10:47:12 -04:00
ian
e004b0d596 Delete field only after foreign key constraints are removed (#13222) 2022-05-11 10:39:18 -04:00
Diego Leme
25dea417b3 Sort schema snapshot (#12907)
* Sort schema snapshot

* Refactor sort deep

* Fix import

* Fix type

* Remove unused de types

* minor tweak

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2022-05-10 12:17:26 -04:00
Peera Jeawkok
e47502e11f Fix Invalid foreign key when applying schema snapshot (#12198)
* add logic to create parent collection before apply

* recursively create collection

* Recursively delete collection

* cleanup

* fix import

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>

* fix deconstruction of collections

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>

* fix deconstruction of collections

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>

* Fix destructing

* Move type declaration to the top

As requested during code review https://github.com/directus/directus/pull/12198#discussion_r857330627

* remove unnecessary empty array check.

* remove redundant map functions

* replace lodash functions in favor of built-in ones

* tweaks

* organize imports

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Stephan Schmitz <eyecatchup@gmail.com>
2022-05-09 16:49:20 -04:00
Aiden Foxx
ccd5c39301 Display error message on OAuth errors (#13184)
* Display error message on oauth errors, and notify about incorrect provider

* Updated copy

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-05-09 15:14:11 -04:00
Rijk van Zanten
a36c7eabeb Use json parser wrapper function to prevent pollution attacks (#13191) 2022-05-09 14:57:38 -04:00
Rijk van Zanten
acab4eef35 Fix aliases (#13186)
* Fix REST alias usage

* Properly fix aliases
2022-05-09 10:58:45 -04:00
rijkvanzanten
e3a7a7d887 v9.10.0 2022-05-03 13:05:54 -04:00
Azri Kahar
ad46bfef51 Fix graphql schema for m2o fields without permissions to related collection (#13015)
* fix graphql schema for m2o fields

* add e2e tests for graphql m2o & o2m

* remove unused code

* fix mariadb json error

* attempt to fix oracle

* possibly fix graphql m2o queries
2022-05-03 12:51:12 -04:00
tenebrius
62d8224af9 Convert OAuth identifier to string before calling toLowerCase (#13067)
* Convert identifier to string before calling toLowerCase

Fixes [#13066](#https://github.com/directus/directus/issues/13066)

* allow numbers for indentifier in oauth and openid user profile

* typescript fix

* handle case if email is not string

Co-authored-by: Aiden Foxx <aiden.foxx.mail@gmail.com>

* typescript fix

Co-authored-by: Aiden Foxx <aiden.foxx.mail@gmail.com>

Co-authored-by: Aiden Foxx <aiden.foxx.mail@gmail.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-05-03 10:35:47 -04:00
Nicola Krumschmidt
aeb919ba7f Update knex to version 2.0.0 (#13051)
* Update knex to version 2.0.0

Fixes #10842

* Remove unused optional dependencies

* Update sqlite3 to version 5.0.6

* Fix returning primary key when inserting items into database
2022-05-03 10:20:49 -04:00
Josh Soref
0b01923b0d Spelling (#13072) 2022-05-02 13:16:03 -04:00
Rob Lee
b62456fca8 first attempt at nested sorting (#12084)
* first attempt at nested sorting

* pull out addJoin so it can be reused

* Move get-relation-info to file, add tests

* Extract get-column-path, add tests

* Little cleanup

* Prevent the regex from blowing up with malicious input

* Allow sorting on m2o fields in the tabular layout

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-27 15:02:10 -04:00
rijkvanzanten
5d19120cf4 Force share generated perm set to read 2022-04-26 14:34:06 -04:00
Rijk van Zanten
d7d47b4e14 Allow configuring the HSTS header (#13004) 2022-04-25 16:46:55 -04:00
Rijk van Zanten
aae90979fb Allow disabling GraphQL introspection (#13003) 2022-04-25 16:20:32 -04:00
Rijk van Zanten
70c70af4ee Support BOM in CSV import (#12993)
Fixes #12970
2022-04-25 10:39:19 -04:00
gkielwasser
625b1dbc7e Store original error code in extensions (#8034)
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-22 17:32:39 -04:00
rijkvanzanten
18407ad7c3 Add missing " 2022-04-22 17:10:07 -04:00
rijkvanzanten
ed780aceba v9.9.1 2022-04-22 12:21:24 -04:00
Azri Kahar
3965a5e6dd prevent fields without permissions from appearing (#12949) 2022-04-22 11:56:21 -04:00
Azri Kahar
90b5883f49 fix api for non existent fields & collections (#12952) 2022-04-22 10:49:03 -04:00
Azri Kahar
4438909186 Fix readSingleItems response from array to object (#12922) 2022-04-21 08:21:35 -04:00
Rijk van Zanten
78a3895f75 Give config file higher priority than existing env (#12900)
Fixes #12884
2022-04-20 16:33:26 -04:00
Rijk van Zanten
d652a12008 Ignore non-alias fields that only exist in directus_fields (#12860)
* Ignore non-alias fields that only exist in directus_fields

Fixes #12857

* Organize imports
2022-04-19 14:44:32 -04:00
Azri Kahar
08e57c2901 only set default value when exists for singleton (#12852) 2022-04-19 11:18:09 -04:00
Azri Kahar
098dc4cc70 fix directus_user mutation with role (#12849) 2022-04-19 10:32:08 -04:00