department-of-veterans-affairs / va.gov-cms

Editor-centered management for Veteran-centered content.
https://prod.cms.va.gov
GNU General Public License v2.0
96 stars 70 forks source link

Add form validation to guard against bad links #6837

Open kevwalsh opened 2 years ago

kevwalsh commented 2 years ago

User Story or Problem Statement

We've seen a lot of links to internal VA domains. Broken link tests (such as node link report or the one in the content build) cannot catch these, because those tests operate within the VA network and can access those links fine. We can't easily build tools that can reproduce the conditions outside the work and provide feedback inside the network.

User story As an editor adding a URL to VA.gov CMS that is not available outside the VA network, I want form validation (or a warning?) that prevents me from saving it, and provides useful feedback about why, so that i know what to fix about my link.

As a CMS team member, i can add, or remove disallowed URL patterns on prod, so that i can quickly guard against (or create exceptions) based on request fulfillment, or other reported problems with the configuration.

Related issues

Acceptance Criteria

Implementation steps

We need the opposite of https://www.drupal.org/project/link_allowed_hosts Need this https://www.drupal.org/project/node_link_report/issues/3216113

Config should be ignored

Design principles

Veteran-centered

Editor-centered

CMS Team

Please leave only the team that will do this work selected. If you're not sure, it's fine to leave both selected.

swirtSJW commented 2 years ago

It would be very nice if this could be a contrib module. Basically a module with a bunc of validation constraints that can be turned on and off in UI and some fields for adding "never link" domains.

I thought about having it added to the node link_report_module, but that expands the module's concern from reporting, to validating, which then makes it a lie.

EWashb commented 2 years ago

Identified as an opportunity through #8536

EWashb commented 12 months ago

This will need a new think...is the "bad links" list exhaustive? Are we missing something? This list includes particular types of links but we might need to think through particular processes/workflows that could cause bad links to happen outside of what a bad link is defined as.