Repository navigation
fix: isolate paging observers, fix settings precedence, and encode sudo IDs - #1817
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces several security and robustness improvements across the Node and Python Looker SDKs. Key changes include strict validation and URL encoding of sudoId parameters to prevent path traversal vulnerabilities, robust handling of the verify_ssl configuration to ensure SSL verification defaults to true when empty or undefined, and isolated per-request observers to prevent race conditions during concurrent paging. One review comment was kept, which correctly identifies a redundant logical check in nodeSession.ts that causes unnecessary login attempts when a truthy targetId is provided.
Python Tests 11 files 11 suites 1m 45s ⏱️ Results for commit d2f4eb9. ♻️ This comment has been updated with latest results. |
Typescript Tests 2 files 68 suites 1m 2s ⏱️ Results for commit d2f4eb9. ♻️ This comment has been updated with latest results. |
…do IDs - Validate and percent-encode sudoId as a single path segment in NodeSession._login and Python AuthSession._login_sudo, and throw while resetting _sudoToken if a sudo login response lacks an access_token. - Fix NodeSettings constructor spread order so environment variables override constructor-supplied settings as documented, and ignore empty verify_ssl environment values. - Use boolDefault(..., true) in ApiSettings and check options.verify_ssl !== undefined in verifySsl() so empty, unrecognized, or undefined values default to true. - Avoid mutating shared transport.observer in Paging.rawCatch by binding per-request observers through ITransportSettings and scoped dispatch so concurrent pager() and pageAll() calls stay isolated.
5f31558 to
d2f4eb9
Compare
Summary
Fixes several session, configuration, and concurrency bugs across
@looker/sdk-rtl,@looker/sdk-node, andlooker-sdk(Python):Single-segment
sudoIdencoding & sudo response validation (NodeSession, PythonAuthSession)sudoIdas a single path segment inNodeSession._login()(packages/sdk-node/src/nodeSession.ts) andAuthSession._login_sudo()(python/looker_sdk/rtl/auth_session.py), rejecting empty,.,.., or path-separator values before issuing requests.SDKErrorand reset_sudoTokeninNodeSession._login()if a sudo login response omitsaccess_token, ensuringisAuthenticated()remainsfalse.0cleanly inNodeSession.login()so it is not treated as an emptysudoId, and add a regression test confirmingAPIMethods401 retries keep sudo state isolated when sudo re-authentication fails.NodeSettingsenv-var precedence &verify_sslboolean parsing (@looker/sdk-node,@looker/sdk-rtl)NodeSettings.constructor(packages/sdk-node/src/nodeSettings.ts) to{ ...settings, ...readEnvConfig(envPrefix) }so environment variables override constructor-supplied values as documented.*_VERIFY_SSLenvironment values inreadEnvConfig().isTrue(...)withboolDefault(unquote(...).trim(), true)inApiSettings.constructor(and trim inValueSettings), soundefined, empty, or unrecognized values default totruerather thanfalse.verifySsl()(packages/sdk-rtl/src/transport.ts) to checkoptions.verify_ssl !== undefined ? Boolean(options.verify_ssl) : trueso{ verify_ssl: undefined }does not evaluate falsy inNodeTransport.initRequest().Concurrency-safe
Pagingobserver capture (@looker/sdk-rtl,@looker/sdk-node)transport.observerproperty inPaging.rawCatch()(packages/sdk-rtl/src/paging.ts).observeronITransportSettingsand bindPaging's capture observer through synchronous scoped dispatch (withScopedObserver/getScopedObserver/observeResponse) acrossAPIMethods.authRequest,BrowserTransport,NodeTransport, andExtensionTransport.transport.observerwhile preventing concurrentpager()/pageAll()calls on a shared SDK instance from cross-contaminatingLinkheaders or page results.Testing
packages/sdk-rtl/srcandpackages/sdk-node/src— 18 suites passed (1 skipped), 166 tests passed (3 skipped), 0 failures..tsfiles.tsc -b packages/sdk-rtl/tsconfig.build.json packages/sdk/tsconfig.build.json packages/sdk-node/tsconfig.build.jsonpassed with 0 errors.tests/rtl/— 149 passed, 3 skipped, 0 failures;mypy looker_sdk/— 0 issues in 19 source files.Developer Checklist