Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
import { ConnectionsApi } from 'api/connections';
import DataprepApi from 'api/dataprep';
import { getCurrentNamespace } from 'services/NamespaceStore';
import { getCdapConfig } from 'services/helpers';

export const ENTITY_TRUNCATION_LIMIT = 1000;
export const ENTITY_TRUNCATION_LIMIT_SETTING = 'defaultWranglerBrowseEntitiesLimit';
export const ENTITY_TRUNCATION_LIMIT = getCdapConfig(ENTITY_TRUNCATION_LIMIT_SETTING, 2000);

export function exploreConnection({ connectionid, path = '/' }) {
const body = {
Expand Down
3 changes: 2 additions & 1 deletion server/config/development/cdap.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"hsts.max.age": 31536000,
"hsts.include.sub.domains": "true",
"hsts.preload": "true",
"ui.default.poll.interval.millis": "10000"
"ui.default.poll.interval.millis": "10000",
"ui.wrangler.connections.browse.entities.limit": "2000"
}
1 change: 1 addition & 0 deletions server/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ function makeApp(authAddress, cdapConfig, uiSettings) {
hstsPreload: cdapConfig['hsts.preload'],
runRecordsTtl: cdapConfig['app.run.records.ttl.days'],
defaultPollIntervalMs: parseInt(cdapConfig['ui.default.poll.interval.millis'], 10) || 10000,
defaultWranglerBrowseEntitiesLimit: parseInt(cdapConfig['ui.wrangler.connections.browse.entities.limit'], 10) || 2000,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

If the configuration ui.wrangler.connections.browse.entities.limit is set to a negative number (e.g., "-100"), parseInt will return -100. Since -100 is truthy in JavaScript, the expression parseInt(...) || 2000 will evaluate to -100, which is an invalid limit and could cause the backend API to fail.

We should ensure the parsed limit is a positive integer, falling back to 2000 if it is less than or equal to 0 or invalid.

Suggested change
defaultWranglerBrowseEntitiesLimit: parseInt(cdapConfig['ui.wrangler.connections.browse.entities.limit'], 10) || 2000,
defaultWranglerBrowseEntitiesLimit: Math.max(parseInt(cdapConfig['ui.wrangler.connections.browse.entities.limit'], 10) || 0, 0) || 2000,

},
hydrator: {
previewEnabled: cdapConfig['enable.preview'] === 'true',
Expand Down
Loading