Skip to content

web: Router tidy v1#13754

Open
GirlBossRush wants to merge 1 commit intomainfrom
router-tidy-v1
Open

web: Router tidy v1#13754
GirlBossRush wants to merge 1 commit intomainfrom
router-tidy-v1

Conversation

@GirlBossRush
Copy link
Contributor

Details

This PR preps the client-side router for hash-less routes, partially getting our parameter logic into a more compatible format. This PR also...

  • Prepares the router for packaging.
  • Moves route related logic into the router package.
  • Fixes a UI issue where the sidebar does not scroll the current route into view after accordion expansion.

Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

@GirlBossRush GirlBossRush added the enhancement New feature or request label Apr 3, 2025
@GirlBossRush GirlBossRush self-assigned this Apr 3, 2025
@GirlBossRush GirlBossRush requested a review from a team as a code owner April 3, 2025 04:20
@netlify
Copy link

netlify bot commented Apr 3, 2025

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 01ff1e1
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/688271858828bf0008acdd47
😎 Deploy Preview https://deploy-preview-13754--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Apr 3, 2025

Deploy Preview for authentik-docs canceled.

Name Link
🔨 Latest commit 01ff1e1
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6882718547b2f4000734441b

@codecov
Copy link

codecov bot commented Apr 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.24%. Comparing base (4a933b8) to head (01ff1e1).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13754      +/-   ##
==========================================
- Coverage   92.97%   92.24%   -0.74%     
==========================================
  Files         831      831              
  Lines       44226    44226              
==========================================
- Hits        41119    40795     -324     
- Misses       3107     3431     +324     
Flag Coverage Δ
e2e ?
integration 23.46% <ø> (+<0.01%) ⬆️
unit 91.28% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@netlify
Copy link

netlify bot commented Jul 24, 2025

Deploy Preview for authentik-integrations canceled.

Name Link
🔨 Latest commit 01ff1e1
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6882718519e7cc000810dda5

if (!match) continue;

console.debug(
`authentik/router: matched route ${route.pattern} to ${pathname} with params`,

Check failure

Code scanning / CodeQL

Use of externally-controlled format string

Format string depends on a [user-provided value](1). Format string depends on a [user-provided value](2). Format string depends on a [user-provided value](3).

Copilot Autofix

AI 8 months ago

To fix the issue, we will ensure that the untrusted pathname is not directly interpolated into the template literal. Instead, we will use a %s specifier in the format string and pass pathname as a separate argument. This approach ensures that the untrusted input is treated as a string and avoids any unintended behavior.


Suggested changeset 1
web/src/elements/router/utils.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/web/src/elements/router/utils.ts b/web/src/elements/router/utils.ts
--- a/web/src/elements/router/utils.ts
+++ b/web/src/elements/router/utils.ts
@@ -29,3 +29,5 @@
         console.debug(
-            `authentik/router: matched route ${route.pattern} to ${pathname} with params`,
+            "authentik/router: matched route %s to %s with params",
+            route.pattern,
+            pathname,
             match.pathname.groups,
@@ -39,3 +41,3 @@
 
-    console.debug(`authentik/router: no route matched ${pathname}`);
+    console.debug("authentik/router: no route matched %s", pathname);
 
EOF
@@ -29,3 +29,5 @@
console.debug(
`authentik/router: matched route ${route.pattern} to ${pathname} with params`,
"authentik/router: matched route %s to %s with params",
route.pattern,
pathname,
match.pathname.groups,
@@ -39,3 +41,3 @@

console.debug(`authentik/router: no route matched ${pathname}`);
console.debug("authentik/router: no route matched %s", pathname);

Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@BeryJu BeryJu changed the title Router tidy v1 web: Router tidy v1 Jul 24, 2025
render(): TemplateResult {
return this.route.render(this.arguments);
console.debug(
`authentik/router: matched route ${route.pattern} to ${pathname} with params`,

Check failure

Code scanning / CodeQL

Use of externally-controlled format string High

Format string depends on a
user-provided value
.
Format string depends on a
user-provided value
.
Format string depends on a
user-provided value
.

Copilot Autofix

AI 8 months ago

To fix the issue, we will ensure that the untrusted pathname value is not directly interpolated into the format string. Instead, we will use a %s specifier in the format string and pass the pathname as a separate argument. This approach ensures that the pathname is treated as a string and prevents any unintended format specifiers from being processed.

The changes will be made in the matchRoute function in RouteMatch.ts. Specifically, the console.debug statement on line 30 will be updated to use a safe format string.


Suggested changeset 1
web/src/elements/router/RouteMatch.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/web/src/elements/router/RouteMatch.ts b/web/src/elements/router/RouteMatch.ts
--- a/web/src/elements/router/RouteMatch.ts
+++ b/web/src/elements/router/RouteMatch.ts
@@ -29,3 +29,5 @@
         console.debug(
-            `authentik/router: matched route ${route.pattern} to ${pathname} with params`,
+            "authentik/router: matched route %s to %s with params",
+            route.pattern,
+            pathname,
             match.pathname.groups,
EOF
@@ -29,3 +29,5 @@
console.debug(
`authentik/router: matched route ${route.pattern} to ${pathname} with params`,
"authentik/router: matched route %s to %s with params",
route.pattern,
pathname,
match.pathname.groups,
Copilot is powered by AI and may make mistakes. Always verify output.
@BeryJu BeryJu mentioned this pull request Jul 25, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant