Skip to content

Remove unnecessary logs#648

Merged
ragyabraham merged 6 commits intomasterfrom
develop
Feb 20, 2025
Merged

Remove unnecessary logs#648
ragyabraham merged 6 commits intomasterfrom
develop

Conversation

@iandjx
Copy link
Copy Markdown
Collaborator

@iandjx iandjx commented Feb 20, 2025

Remove unnecessary logs

className='flex items-center gap-2'
href={link.noResourceSlug ? link.path : `/${resourceSlug}${link.path}`}
>
href={link.noResourceSlug ? link.path : `/${resourceSlug}${link.path}`}>

Check warning

Code scanning / CodeQL

Client-side URL redirect Medium

Untrusted URL redirection depends on a
user-provided value
.

Copilot Autofix

AI about 1 year ago

To fix the problem, we need to ensure that the resourceSlug value is validated against a list of authorized slugs before it is used to construct the URL. This can be achieved by maintaining a list of authorized slugs and checking if the resourceSlug value is in this list before using it.

  1. Create a list of authorized slugs.
  2. Check if the resourceSlug value is in the list of authorized slugs.
  3. Only use the resourceSlug value to construct the URL if it is in the list of authorized slugs; otherwise, use a default or safe value.
Suggested changeset 1
webapp/src/components/Layout2.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/webapp/src/components/Layout2.tsx b/webapp/src/components/Layout2.tsx
--- a/webapp/src/components/Layout2.tsx
+++ b/webapp/src/components/Layout2.tsx
@@ -246,3 +246,4 @@
 	const posthog = usePostHog();
-	const resourceSlug = router?.query?.resourceSlug || account?.currentTeam;
+	const authorizedSlugs = ['slug1', 'slug2', 'slug3']; // Add your authorized slugs here
+	const resourceSlug = authorizedSlugs.includes(router?.query?.resourceSlug) ? router?.query?.resourceSlug : account?.currentTeam;
 	const currentOrg = account?.orgs?.find(o => o.id === account?.currentOrg);
EOF
@@ -246,3 +246,4 @@
const posthog = usePostHog();
const resourceSlug = router?.query?.resourceSlug || account?.currentTeam;
const authorizedSlugs = ['slug1', 'slug2', 'slug3']; // Add your authorized slugs here
const resourceSlug = authorizedSlugs.includes(router?.query?.resourceSlug) ? router?.query?.resourceSlug : account?.currentTeam;
const currentOrg = account?.orgs?.find(o => o.id === account?.currentOrg);
Copilot is powered by AI and may make mistakes. Always verify output.
@github-actions
Copy link
Copy Markdown

File Coverage
All files 96%
src/lib/utils/validationutils.ts 95%

Minimum allowed coverage is 80%

Generated by 🐒 cobertura-action against 80ed8bb

@iandjx iandjx changed the title Develop Remove unnecessary logs Feb 20, 2025
@ragyabraham ragyabraham merged commit faf339e into master Feb 20, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants