Skip to content

Commit

Permalink
[electron] loopback server should only listen on exact redirect_uri a…
Browse files Browse the repository at this point in the history
…ddress (#248)

Co-authored-by: Ben Polinsky <[email protected]>
  • Loading branch information
ben-polinsky and ben-polinsky authored Jun 11, 2024
1 parent 9e64b44 commit 04e8a75
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ There is also an [authorization client for command-line developer tools](./packa
3. Build source: `pnpm build`
4. Run tests: `pnpm cover`

> Note: Sometimes lage's cache will become stale and it may refuse to build projects you've changed. If this or other odd behavior occurs on build, add the [`--reset-cache` flag](https://microsoft.github.io/lage/docs/Tutorial/cache/) to the `pnpm build` command.
## Extract Documentation

`pnpm run docs`
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Only listen on hostname and port provided in redirectUris. Previously, we would listen on any local interface with the selected port.",
"packageName": "@itwin/electron-authorization",
"email": "[email protected]",
"dependentChangeType": "patch"
}
4 changes: 3 additions & 1 deletion packages/electron/src/main/LoopbackWebServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export class LoopbackWebServer {
server.on("error", reject);

const urlParts: URL = new URL(LoopbackWebServer._redirectUri);
server.listen(urlParts.port, () => {
const portNumber = Number(urlParts.port);

server.listen(portNumber, urlParts.hostname, () => {
LoopbackWebServer._httpServer = server;
resolve();
});
Expand Down

0 comments on commit 04e8a75

Please sign in to comment.