@orangecheck/auth-client 2.22.1 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1998,15 +1998,27 @@ var primaryChipStyle = {
1998
1998
  color: V.primary,
1999
1999
  border: `1px solid ${V.primary}`
2000
2000
  };
2001
+ function isSameOriginPath(candidate, origin) {
2002
+ try {
2003
+ return new URL(candidate, origin).origin === origin;
2004
+ } catch {
2005
+ return false;
2006
+ }
2007
+ }
2008
+ function resolutionOrigin() {
2009
+ return typeof window === "undefined" ? "https://ochk.io" : window.location.origin;
2010
+ }
2001
2011
  function safeReturnTo(input) {
2002
2012
  const candidate = input ?? "/";
2003
2013
  if (typeof candidate !== "string") return "/";
2004
- if (!candidate.startsWith("/") || candidate.startsWith("//")) return "/";
2005
- return candidate;
2014
+ if (!candidate.startsWith("/")) return "/";
2015
+ return isSameOriginPath(candidate, resolutionOrigin()) ? candidate : "/";
2006
2016
  }
2007
2017
  function familyReturnTarget(input) {
2008
2018
  if (typeof input !== "string" || input.length === 0) return void 0;
2009
- if (input.startsWith("/") && !input.startsWith("//")) return input;
2019
+ if (input.startsWith("/") && isSameOriginPath(input, resolutionOrigin())) {
2020
+ return input;
2021
+ }
2010
2022
  try {
2011
2023
  const u = new URL(input);
2012
2024
  if (u.protocol !== "https:") return void 0;
@@ -3100,6 +3112,6 @@ function handleSudoRequired(body, args = {}) {
3100
3112
  return false;
3101
3113
  }
3102
3114
 
3103
- export { DEFAULT_CONFIG, DISPLAY_IDENTITY_KINDS, OcAccountChip, OcAccountPill, OcAddressInput, OcLinkedIdentities, OcSessionProvider, OcSignIn, OcSignInButton, TAB_ACCOUNT_HINT_KEY, TAB_ADOPT_HASH, TAB_SESSION_HEADER, TAB_SESSION_STORAGE_KEY, buildAddAccountUrl, buildSignInUrl, clearTabSession, consumeTabAccountHint, consumeTabAdoptMarker, fetchOcLinkedIdentities, handleSudoRequired, installTabFetchInterceptor, installTabLinkDecorator, readTabSession, redirectToSudo, tabSessionHeader, useOcAddressSuggestion, useOcSession, useOptionalOcSession, useStepUpAuth, useWebAuthnList, useWebAuthnRegister, writeTabSession };
3115
+ export { DEFAULT_CONFIG, DISPLAY_IDENTITY_KINDS, OcAccountChip, OcAccountPill, OcAddressInput, OcLinkedIdentities, OcSessionProvider, OcSignIn, OcSignInButton, TAB_ACCOUNT_HINT_KEY, TAB_ADOPT_HASH, TAB_SESSION_HEADER, TAB_SESSION_STORAGE_KEY, buildAddAccountUrl, buildSignInUrl, clearTabSession, consumeTabAccountHint, consumeTabAdoptMarker, familyReturnTarget, fetchOcLinkedIdentities, handleSudoRequired, installTabFetchInterceptor, installTabLinkDecorator, readTabSession, redirectToSudo, safeReturnTo, tabSessionHeader, useOcAddressSuggestion, useOcSession, useOptionalOcSession, useStepUpAuth, useWebAuthnList, useWebAuthnRegister, writeTabSession };
3104
3116
  //# sourceMappingURL=index.mjs.map
3105
3117
  //# sourceMappingURL=index.mjs.map