Skip to content

Feat: enable setting the auth emulator in code#1486

Open
AustinBenoit wants to merge 5 commits into
mainfrom
authemulator
Open

Feat: enable setting the auth emulator in code#1486
AustinBenoit wants to merge 5 commits into
mainfrom
authemulator

Conversation

@AustinBenoit

Copy link
Copy Markdown
Contributor

Description

Provide details of the change, and generalize the change in the PR title above.

Feat: enable setting the auth emulator in code


Testing

Describe how you've tested these changes.

Ran locally with emulator in desktop.


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request exposes the UseEmulator method in the SWIG interface for the Auth SDK and adds commented-out usage examples in the test app. The reviewer identified a potential crash if a null pointer is passed as the host parameter and suggested adding a null check to handle this safely.

Comment thread auth/src/swig/auth.i
Comment on lines +488 to +490
void UseEmulator(const char* host, int port) {
self->UseEmulator(host, port);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

If host is nullptr (for example, if a C# user passes null to UseEmulator), passing it directly to self->UseEmulator will cause undefined behavior or a crash when constructing std::string implicitly from a null pointer on the C++ side.

We should add a null check for host to prevent potential crashes and ensure defensive programming.

  void UseEmulator(const char* host, int port) {
    if (host != nullptr) {
      self->UseEmulator(host, port);
    }
  }

@AustinBenoit AustinBenoit requested a review from a-maurice July 9, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants