Skip to content

Security feature external link warning#7397

Merged
leio10 merged 62 commits intodecidim:developfrom
mainio:feature/external_link_warning
May 26, 2021
Merged

Security feature external link warning#7397
leio10 merged 62 commits intodecidim:developfrom
mainio:feature/external_link_warning

Conversation

@lahdeero
Copy link
Copy Markdown
Contributor

@lahdeero lahdeero commented Feb 16, 2021

🎩 What? Why?

There are many places(e.g. profile and proposals) where registered users can insert links in Decidim. Since Decidim has lot of non-digi-native users we should have clear warning page when they are clicking external or potentially dangerous links. This pull request replaces all links which have external domain to redirect into our warning page. There is also new section in admin panel where admins can add domains to whitelist (so we don't show warning when users click whitelisted links).

📌 Related Issues

https://meta.decidim.org/processes/roadmap/f/122/proposals/15681

Testing

  1. Login as admin
  2. Go to admin panel -> Settings -> External domain whitelist
  3. Whitelist domain (e.g. twitter.com)
  4. Find external links and click them (development app footer has many)

📋 Checklist

🚨 Please review the guidelines for contributing to this repository.

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

📷 Screenshots

external_domain_whitelist_admin
warning_2
similartootherreveals

♥️ Thank you!

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could remove the excess styling from the CSS by utilizing the card element already provided by Foundation.

@ahukkanen
Copy link
Copy Markdown
Contributor

We should also make sure this logic works when new comments are added dynamically to the page. I believe when new comments are loaded right now to the page, this logic won't apply to them.

Same thing for the "opens in new tab" link accessibility icons, I think we could fix them at the same time.

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails in an exception right now if something unexpected in passed in the external_link parameter. Let's fix that.

@lahdeero
Copy link
Copy Markdown
Contributor Author

lahdeero commented May 3, 2021

@mrcasals Done

@mrcasals
Copy link
Copy Markdown
Contributor

mrcasals commented May 5, 2021

@lahdeero some conflicts appeared, sorry about that 🙈 could you check them and I'll merge the PR? 🙏

@lahdeero
Copy link
Copy Markdown
Contributor Author

@mrcasals Done again

Copy link
Copy Markdown
Contributor

@leio10 leio10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @lahdeero! 👍
Sorry for asking for changes again, but we want to avoid issues with migrations and to enforce consistency on that critical part for the apps upgrades. I promess you that I will merge this as soon as you change the migration. 🙏

(The change request appeas as solved, but it's not)

@lahdeero
Copy link
Copy Markdown
Contributor Author

Seems like update_all cant cast array(?)

@leio10
Copy link
Copy Markdown
Contributor

leio10 commented May 26, 2021

Seems like update_all cant cast array(?)

You can try with raw SQL:

Decidim::Organization.update_all("external_domain_whitelist = ARRAY['decidim.org', 'github.com']")

@lahdeero
Copy link
Copy Markdown
Contributor Author

lahdeero commented May 26, 2021

@leio10 Can you restart blogs test? I don't believe this pr is causing it to fail

@leio10 leio10 merged commit e5060db into decidim:develop May 26, 2021
@ahukkanen ahukkanen deleted the feature/external_link_warning branch May 26, 2021 15:50
entantoencuanto added a commit that referenced this pull request May 28, 2021
…ions

* develop:
  Fix broken test on meetings after merging PR without rebase (#8076)
  Show participants list in meetings (#7933)
  Security feature external link warning (#7397)
entantoencuanto added a commit that referenced this pull request May 31, 2021
* develop: (59 commits)
  Update supported versions in docs (#8079)
  Meetings merge minutes and close actions (#7968)
  Meeting calendars providers (#7944)
  Fix broken test on meetings after merging PR without rebase (#8076)
  Show participants list in meetings (#7933)
  Security feature external link warning (#7397)
  Add missing tests for scope types admin page (#8053)
  Use symbols for polymorphic route arguments (#8052)
  Mockup design for Participation statistics tables in Votings (#7879)
  Fix boolean fields for .reported? and .hidden? which is nil if no report exists (#7990)
  Fix redirects broken by Terms and Conditions redirect (#8036)
  Amend CSS overwritting (#8007)
  New Crowdin updates (#8048)
  Fix undetected broken tests because of missing dependencies (#8050)
  Validate results by Monitoring Committee Members (#7899)
  Electoral certificate validation by Monitoring Committee Members (#7871)
  Publish and unpublish a meeting (#7893)
  New Crowdin updates (#8005)
  Polling station closure attach the physical electoral closure certificate (#7929)
  Fix attachment title migration generating possibly invalid values (#8020)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants