Skip to content

Document on how to integrate in electron apps #37

Open
@iongion

Description

@iongion

Leaving this as a guide for the next soul trying it.

const URLS_ALLOWED = [
  "https://stately.ai/inspect",
  "https://stately.ai/registry/inspect",
  "http://localhost",
];
const DOMAINS_ALLOW_LIST = ["localhost"];

applicationWindow.webContents.setWindowOpenHandler((event: any) => {
  const info = new URL(event.url);
  if (!URLS_ALLOWED.includes(event.url)) {
      if (!DOMAINS_ALLOW_LIST.includes(info.hostname)) {
        logger.error("Security issue - attempt to open a domain that is not allowed", info);
        return { action: "deny" };
      }
  }
  return { action: "allow" };
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions