Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add support to query encrypted data #479

Open
wants to merge 72 commits into
base: 3.x
Choose a base branch
from

Conversation

SAMIBETTAYEB
Copy link

New feature about querying encrypted fields.

@slnode
Copy link

slnode commented Jun 17, 2021

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@SAMIBETTAYEB SAMIBETTAYEB force-pushed the development branch 2 times, most recently from 32b572b to 001a9d9 Compare June 18, 2021 10:30
Copy link
Member

@dhmlau dhmlau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SAMIBETTAYEB, thanks for the PR. Could you please add some tests to verify your changes? Also, please sign the DCO as well. Thanks!

package.json Outdated
@@ -1,6 +1,6 @@
{
"name": "loopback-connector-postgresql",
"version": "3.9.1",
"version": "3.10.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no need for this change. When we publish a new version, the tool will update it for us.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@dhmlau
Copy link
Member

dhmlau commented Jun 21, 2021

You can sign the DCO by running the following command:

git commit --amend -s 

Reference: https://loopback.io/doc/en/contrib/code-contrib.html.

@SAMIBETTAYEB SAMIBETTAYEB force-pushed the development branch 4 times, most recently from ba6206a to e795527 Compare June 22, 2021 21:00
@stale
Copy link

stale bot commented Aug 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 21, 2021
@SAMIBETTAYEB
Copy link
Author

Do any of the reviewers verify it, please?

@stale stale bot removed the stale label Sep 1, 2021
@achrinza
Copy link
Member

achrinza commented Sep 2, 2021

Hi @sam-github, could you rebase your PR against the latest copy of master? That way the CI pipeline can be triggered.

jannyHou and others added 11 commits September 2, 2021 15:20
Signed-off-by: SAMI BETTAYEB <[email protected]>
Seems like syntax error:
- autoupdate not working due to variable is unset
- without this change (just comment this line) Indexes was not updated

Signed-off-by: SAMI BETTAYEB <[email protected]>
 * chore: set package-lock=false in .npmrc (Aidan Harbison)
 * Extends test structure to cover fix (Viktor Shanin)
 * Fix Index upgrade (Viktor Shanin)
 * fix: jsdoc (loopbackio#385) (Janny)
 * Enable Travis CI integration (Miroslav Bajtoš)
 * Manually fix remaining linting violations (Miroslav Bajtoš)
 * Auto-fix linting violations (Miroslav Bajtoš)
 * Update eslint to ^6.0.1 (Miroslav Bajtoš)
 * Update dev-dependencies (Miroslav Bajtoš)

Signed-off-by: SAMI BETTAYEB <[email protected]>
Run `eslint --fix .` to add trailing commas to function arguments.

Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
Rapidly-fired queries can exhaust the pool capability and lead to odd
results. In test, we've witnessed "Connection Terminated" flakiness
with many fast test suites. This, combined with setting
`lazyConnect: true` and `idleTimeoutMillis: 0`, alleviates the issue.

Signed-off-by: SAMI BETTAYEB <[email protected]>
 * fix(pool): synchronously release pool connection (Samuel Reed)
 * Handler for with(out) time zone time(stamp) types (Stefano Pirra)
 * chore: improve issue and PR templates (Nora)
 * chore: exclude "good first issues" from stalebot (Miroslav Bajtoš)
 * Fix eslint violations (Miroslav Bajtoš)

Signed-off-by: SAMI BETTAYEB <[email protected]>
bajtos and others added 20 commits September 2, 2021 15:20
Array properties are represented as juggler `List` instance, we need
to modify test assertions to convert them via `toArray()` before
applying `.should.eql` check.

Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
 * test: clean test for `contains` operator (Miroslav Bajtoš)
 * test: fix array tests to handle List values (Miroslav Bajtoš)
 * docs: improve README organization (Miroslav Bajtoš)
 * feat: adds 'contains' operator for querying arrays (shubhisood)

Signed-off-by: SAMI BETTAYEB <[email protected]>
Signed-off-by: Raymond Feng <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
 * Ensure order of and/or clauses are preserved (Raymond Feng)

Signed-off-by: SAMI BETTAYEB <[email protected]>
Signed-off-by: Matthew Gabeler-Lee <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
 * fix: enable pool error handling (Matthew Gabeler-Lee)

Signed-off-by: SAMI BETTAYEB <[email protected]>
Signed-off-by: Francisco Buceta <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
This reverts commit e3ba700.

Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
Signed-off-by: Agnes Lin <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
Signed-off-by: Agnes Lin <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
 * Add on delete options on FK constraints (Quentin Le Bour)
 * ci: switch from Travis to Github Actions (Agnes Lin)
 * Revert "ci: switch travis to github actions" (Miroslav Bajtoš)
 * ci: switch travis to github actions (Francisco Buceta)

Signed-off-by: SAMI BETTAYEB <[email protected]>
When `PostgreSQL.prototype.getDropForeignKeys` gets called with
duplicated foreign keys, an invalid `ALTER TABLE` statement gets
created. This is because the duplicates are mapped to multiple `DROP
CONSTRAINT fk_key` SQL actions, e.g.:

```sql
-- This will throw an error
ALTER TABLE "public"."foo"
  DROP CONSTRAINT "fk_duplicatedKey",
  DROP CONSTRAINT "fk_duplicatedKey",
  DROP CONSTRAINT "fk_duplicatedKey",
  DROP CONSTRAINT "fk_otherKey"
```

As the `DROP CONSTRAINT` actions are run sequentially, when the first
action gets executed by PostgreSQL, the next one (for the same, but
already dropped key) will not cause an SQL error thanks to the added IF
EXISTS check:

```sql
-- This is valid SQL
ALTER TABLE "public"."foo"
  DROP CONSTRAINT IF EXISTS "fk_duplicatedKey",
  DROP CONSTRAINT IF EXISTS "fk_duplicatedKey",
  DROP CONSTRAINT IF EXISTS "fk_duplicatedKey",
  DROP CONSTRAINT IF EXISTS "fk_otherKey"
```

Please note, this is really a hack and we still need to understand why
the method in question gets called with duplicated foreign keys in
certain conditions.

Signed-off-by: Chris Kobrzak <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
Signed-off-by: Diana Lau <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
Signed-off-by: SAMI BETTAYEB <[email protected]>
@SAMIBETTAYEB
Copy link
Author

@achrinza, done!

@SAMIBETTAYEB
Copy link
Author

Can any of the reviewers verify the PR, please?

@achrinza
Copy link
Member

Apologies @SAMIBETTAYEB, I didn't realise that this PR was targeting 3.x instead of master. I'll cherry-pick the commits into new PRs.

@SAMIBETTAYEB
Copy link
Author

Thank you @achrinza, waiting for your review.

@achrinza
Copy link
Member

achrinza commented Sep 12, 2021

Thanks, @SAMIBETTAYEB; Would you be able to point this PR to the master branch (v5.x)? Or is 3.x necessary? Based on what I can tell, 5.x supports both LB3 and LB4.

@SAMIBETTAYEB
Copy link
Author

Yep @achrinza, I think it will be.

@achrinza
Copy link
Member

achrinza commented Sep 12, 2021

Thanks, @SAMIBETTAYEB. If you're comfortable with performing this, could you please reset the branch against master, then cherry-pick the commit range you intend to submit?

The commands should look similar to this:

$ git reset --hard upstream/master # Assuming you've set `upstream` remote to loopbackio/loopback-connector-postgresql
$ git cherry-pick 1199248a0a3e2881241e01d970bb1411605bfead...9beef0c353f335731e498fe262f6daac50012103

# Fix any merge conflicts
git add --all
git cherry-pick --continue
# Repeat last 2 steps for each commit with a merge conflict

# Push changes to remote
$ git push --force-with-lease

Please adjust the commands above according to your Git setup if necessary.

For a wrost-case scenario, I've created a 'backup' of your original commits at #486

@stale
Copy link

stale bot commented Nov 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.