Skip to content

Conversation

@morford-brex
Copy link
Contributor

@morford-brex morford-brex commented Oct 9, 2025

Check List

  • Tests have been run in packages where changes have been made if available
  • Linter has been run for changed code
  • Tests for the changes have been added if not covered yet
  • Docs have been added / updated if required

Issue Reference this PR resolves
#10049 (comment)

@morford-brex morford-brex requested a review from a team as a code owner October 9, 2025 21:05
@github-actions github-actions bot added the pr:community Contribution from Cube.js community members. label Oct 9, 2025
@morford-brex morford-brex changed the title fix(api-gateway): merge the two fix(api-gateway): explicitly pass securityContext to extendContext Oct 9, 2025
@morford-brex morford-brex changed the title fix(api-gateway): explicitly pass securityContext to extendContext fix(api-gateway): make securityContext available to extendContext Oct 9, 2025
@morford-brex
Copy link
Contributor Author

morford-brex commented Oct 15, 2025

@igorlukanin - would you be able to assign this to the appropriate reviewers? 🙏

@morford-brex
Copy link
Contributor Author

@igorlukanin - would you be able to assign this to the appropriate reviewers? 🙏

@KSDaemon perhaps? 🙏

@github-actions github-actions bot added the javascript Pull requests that update Javascript code label Oct 17, 2025
@KSDaemon
Copy link
Member

I'd say @ovr is better here :)

@morford-brex
Copy link
Contributor Author

I'd say @ovr is better here :)

@ovr - gentle bump here. also, not sure that the integration test failures are related to these changes but i may be missing some context

@morford-brex
Copy link
Contributor Author

morford-brex commented Oct 28, 2025

@KSDaemon - sorry for another ping but any chance you could help bump this? hoping to get unblocked on some SQL API usage here

@KSDaemon
Copy link
Member

Hi @morford-brex, we'll try to have a look asap. Sorry for the delays, too busy...

}

public async contextByReq(req: Request, securityContext, requestId: string): Promise<ExtendedRequestContext> {
req.securityContext = {
Copy link
Member

Choose a reason for hiding this comment

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

First, I am sorry for the late reply.

@morford-brex Good catch! However, I believe it's correct to assign securityContext for req.securityContext instead of merging.

I assume that securityContext is correct for checkAuth in HTTP (see pic 1), while it's incorrect for WebSocket server and checkSqlAuth (SQL API).

I am OK with changing it once as the last mile instead of fixing it in (sql-server.ts#contextByNativeReq and SubscriptionServer.ts#processMessage), but I suggest using req.securityContext = securityContext instead of merging.

There is no need to merge it, because:

  1. HTTP checkAuth will receive the same object. this.contextByReq(req, req.securityContext, getRequestIdFromRequest(req)), see pic 1
  2. WS request doesn't have securityContext, it stores it separately
  3. SQL API request doesn't have securityContext, it stores it separately
Image

Thanks

Copy link
Contributor Author

@morford-brex morford-brex Oct 29, 2025

Choose a reason for hiding this comment

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

no worries at all - thanks for the follow up!

i think that makes sense and just updated here to skip the merging and directly set it

@morford-brex morford-brex requested a review from ovr October 29, 2025 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update Javascript code pr:community Contribution from Cube.js community members.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants