Skip to content

Validate the URLs before opening them, prompt user confirmation when opening untrusted domains #2056

Open
@kittaakos

Description

@kittaakos

Describe the request

This feature request is based on #2027 (review).

External library contributors can specify any meaningful content for a library, including URLs. IDE2 renders these links on the UI, and the URL links are clickable, but IDE2 cannot guarantee anything regarding the links. For example, VS Code asks the user before opening a link not among the trusted domains. It's still possible to open untrusted URLs from Code without user confirmation, though, so it could be better. IDE2 opens every link without asking.

Acceptance criteria:

  • IDE2 should validate the URLs before opening them in the users' default browser.
  • IDE2 should raise a confirmation dialog when opening untrusted (other than arduino.cc) URLs to prevent users from landing on an undesired page.

Describe the current behavior

IDE2 opens any links in the default browser without prompting the user.

Arduino IDE version

2.1.0

Operating system

macOS

Operating system version

12.6.3

Additional context

Related links and best practices:

IDE2 renders these links on the UI, and the URL links are clickable

The Arduino security team has suggested not to render a link on the UI clickable if the URL scheme is not http, https, or mailto.

Suggested pseudo code:

// examples:
// external_url_string = "https://maliciouswebsite/"
// external_url_string = "sftp://1.1.1.1"

...
// in general, i prefer call native parser instead implement regex, i consider it safer and more readable
parsed_url_obj = URL(external_url_string) 

if (parsed_url.protocol == 'https' or parsed_url.protocol == 'http' or parsed_url.protocol == 'mailto'){
    // the URL is acceptable, ask confirmation to user
    OpenConfirmDialog(...,"_blank",callback(...))
} else {
    // render it as not clickable string
}
...

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest nightly build
  • My request contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftopic: securityRelated to the protection of user datatype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions