Skip to content

Add --login-origin options and Make it single input option - #91

Open
dodok8 wants to merge 5 commits into
mainfrom
trailing-dot
Open

dodok8 wants to merge 5 commits into
mainfrom
trailing-dot

Conversation

@dodok8

@dodok8 dodok8 commented Sep 20, 2026

Copy link
Copy Markdown
Member

Closes: #81

Change:

  • Add --login-origin options for running Sever
  • Check login origin with value of URL of --login-origin and its origin.
  • Use .env to set value, like --root-origin.

@2chanhaeng 2chanhaeng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

First, tests for #81 are needed.
Also, this PR seems to contain more changes related to reducing multiple origins to a single origin than changes related to #81. Wouldn’t it be better to keep the PR and create a separate issue for this? It would also be helpful to include in the issue the reasons for changing to a single origin.
It also seems that the documentation needs to be updated. Searching the codebase for DRFED_LOGIN_ORIGINS, loginOrigins, and similar terms still turns up a lot of outdated documentation.

Comment thread scripts/dev.mts Outdated
@dodok8
dodok8 requested a review from 2chanhaeng September 27, 2026 05:51

@dahlia dahlia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Following up on @2chanhaeng's review: please add a regression test that configures https://app.example. and verifies that a login link on https://app.example is accepted. Cover the CLI configuration path and direct createYogaServer() usage, and keep IP literals allowed. The current test changes only adapt existing tests to the new interface.

I agree that the single-origin restriction belongs in a separate discussion. The reply on #81 explains why multiple origins can be useful.

// the project's own, and the login mail would be rejected or junked.
emailFrom: opt.emailFrom ?? `noreply@${canonicalHostname(opt.rootOrigin)}`,
loginOrigins: opt.loginOrigins,
loginOrigin: opt.loginOrigin,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The CLI normalizes the trailing dot, but direct createYogaServer() callers bypass that parser. I reproduced this through loginByEmail: loginOrigin: new URL("https://app.example.") rejects a verify URL on https://app.example. Please normalize the configured origin at the GraphQL API boundary too.

}),
);

const loginOriginParser = option(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes --login-origin mandatory and removes support for DRFED_LOGIN_ORIGINS. DRFED_LOGIN_ORIGIN is forwarded only by scripts/dev.mts; setting it for the installed CLI still fails with Missing option --login-origin. Please keep the existing configuration working for the #81 fix, or handle the CLI migration separately and update the documentation.

@@ -1,2 +1,2 @@
DRFED_LOGIN_ORIGINS=https://drfed.example.com,http://localhost:3000
DRFED_LOGIN_ORIGIN=https://drfed.example.com

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The documentation still describes the old interface: packages/drfed/README.md requires DRFED_LOGIN_ORIGINS and shows a command that now fails, while packages/graphql/README.md passes loginOrigins: new Set(...). Please update these examples to match the final configuration and API. The comments in scripts/dev.mts and packages/drfed/src/parser.test.ts also still refer to the removed behavior.

Comment thread scripts/dev.mts
// DNS or /etc/hosts setup, which is what makes per-instance subdomains usable
// in development.
const defaultRootOrigin = "http://drfed.localhost:8888";
const defaultLoginOrigin = "http://drfed.localhost:3000";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When DRFED_LOGIN_ORIGIN is unset, this allows only http://drfed.localhost:3000, but the frontend dev server advertises http://localhost:3000/. Sign-in builds its verify URL from location.origin, so opening the advertised URL causes login to fail with an unauthorized origin. Please default to http://localhost:3000, or configure the frontend to serve and advertise drfed.localhost:3000 too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

DRFED_LOGIN_ORIGINS does not normalize a trailing dot

3 participants