Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(links): add validation to components that are links or refs #789

Open
wants to merge 4 commits into
base: feat/pdf-collections
Choose a base branch
from

Conversation

seaerchin
Copy link
Contributor

@seaerchin seaerchin commented Oct 18, 2024

Problem

We previously did not sanitise our URLs at all. this meant that we were allowign insecure URLs on our frontend/backend. in order to alleviate this as a first pass, i added regex validation

Solution

  1. add URL validation for ext links (https at start of URL), internal links (verify that the format is [...]), files (end in .pdf) and mails (begins with mailto:)
  2. for our frontend, i added the https left addon and appended if it didn't exist. also soe minor fixes regarding otggle and state reset.
    • for some reason, using the switch statement still renders the component (and triggers validation). using the if statement doesn't render and has the desired behaviour

Screenshots

Screen.Recording.2024-10-18.at.10.52.58.PM.mov

Copy link

vercel bot commented Oct 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
isomer-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 18, 2024 2:57pm

@seaerchin seaerchin changed the base branch from main to 08/perms/error-boundary October 18, 2024 13:46
@seaerchin seaerchin changed the base branch from 08/perms/error-boundary to feat/pdf-collections October 18, 2024 13:47
@datadog-opengovsg
Copy link

datadog-opengovsg bot commented Oct 18, 2024

Datadog Report

Branch report: fix/add-https
Commit report: 1825900
Test service: isomer-studio

✅ 0 Failed, 129 Passed, 23 Skipped, 34.95s Total Time

@seaerchin seaerchin marked this pull request as ready for review October 18, 2024 14:58
@seaerchin seaerchin requested a review from a team as a code owner October 18, 2024 14:58
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.

1 participant