-
Notifications
You must be signed in to change notification settings - Fork 957
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
fix[gen1][core] ENG-7841 change to queryParams #3787
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: c11643b The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
View your CI Pipeline Execution ↗ for commit c11643b.
☁️ Nx Cloud last updated this comment at |
packages/core/src/builder.class.ts
Outdated
if (this.apiEndpoint === 'content') { | ||
queryParams.enrich = true; | ||
queryParams.noTraverse = queue[0].limit !== 1; | ||
queryParams.includeRefs = true; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move this logic before the following code blocks:
builder/packages/core/src/builder.class.ts
Lines 2604 to 2616 in 1908d27
for (const key of properties) { const value = options[key]; if (value !== undefined) { if (this.apiEndpoint === 'query') { queryParams.options = queryParams.options || {}; queryParams.options[options.key!] = queryParams.options[options.key!] || {}; queryParams.options[options.key!][key] = JSON.stringify(value); } else { queryParams[key] = JSON.stringify(value); } } } } builder/packages/core/src/builder.class.ts
Lines 2627 to 2630 in 1908d27
if (this.overrideParams) { const params = omit(QueryString.parse(this.overrideParams), 'apiKey'); assign(queryParams, params); }
These are two ways customers can override properties, so they need to exist after you set the noTraverse
and includeRefs
defaults.
I also just noticed these two noTraverse
settings:
builder/packages/core/src/builder.class.ts
Lines 2495 to 2497 in 1908d27
if ('noTraverse' in queue[0]) { | |
queryParams.noTraverse = queue[0].noTraverse; | |
} |
builder/packages/core/src/builder.class.ts
Lines 2863 to 2867 in 1908d27
// Set noTraverse=true if NOT already passed by user, for query performance | |
if (!('noTraverse' in options)) { | |
options.noTraverse = true; | |
} | |
This means that noTraverse
is already handled (set to true
in getAll()
which has limit > 1
. So you don't need to set noTraverse
, you only need to add the includeRefs = true
.
TLDR:
- remove
noTraverse
default - move the
includeRefs
default higher up so it can still be overridden by customer - add some tests that show:
- default value of
includeRefs
istrue
- if customer provides
includeRefs: false
tobuilder.get()
orbuilder.getAll()
, then they are able to update the URL
- default value of
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
14200383 | Triggered | Generic High Entropy Secret | 42a258b | packages/core/src/builder.class.test.ts | View secret |
14200385 | Triggered | Generic High Entropy Secret | 42a258b | packages/core/src/builder.class.test.ts | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
@@ -2227,6 +2227,11 @@ export class Builder { | |||
let instance: Builder = this; | |||
let finalLocale = | |||
options.locale || options.userAttributes?.locale || this.getUserAttributes().locale; | |||
|
|||
if (!('noTraverse' in options)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be?
if (!('noTraverse' in options)) { | |
if (!('noTraverse' in options) && this.apiEndpoint === 'content') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, @sanyamkamat correct me if i'm wrong but I think we want the noTraverse
default for Query and Content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When will there be any apiEndpoint
which will not be content
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samijaber Replied to your question in slack thread.
Description
Gen1 SDK: use same Content API defaults as Gen2 SDK