Commit graph

20 commits

Author SHA1 Message Date
Kim Emmanuel
04fb62a6f5
ignore code blocks when checking markdown for XSS (#20641)
Code blocks are rendered as raw strings and therefore don´t need to be
checked for XSS. Checking them for XSS disallow users to write articles about
XSS in markdown, for example.

Co-authored-by: Mac Siri <mac@forem.com>
2024-03-07 21:03:39 +00:00
Anna Buianova
20e242af0d
Rubocop fixes (#20254)
* Fixed redundant alls for rubocop

* Fixed rubocop violations in spec/requests

* Fixed rubocop violations in spec/models

* Fixed Performance/MapMethodChain

* Fixed rubocop violations in spec/requests

* Revert changes to FastlyConfig::Update spec
2023-10-18 17:24:28 -04:00
Helio Cola
c7bb3be603
Upgrade ruby 3.0.6 (#19651)
Co-authored-by: Josh Klar <jklar@forem.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2023-07-06 16:42:20 -04:00
Anna Buianova
eb52b91f75
Ensure rendering parity on DisplayAd, Comment, & Article (#19091) 2023-04-07 09:30:17 -04:00
depfu[bot]
59330184ac
[ruby] Update redcarpet: 3.5.1 → 3.6.0 (minor) (#19067)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Co-authored-by: Mac Siri <mac@forem.com>
2023-02-21 11:29:46 -05:00
Joshua Wehner
5e916b74c1
Possibly fixes style injection? (#18053)
See https://github.com/forem/forem-internal-eng/issues/480
2022-07-07 16:05:33 +02:00
Jeremy Friesen
30ff24393c
Allowing dependency injection for LiquidTag policy (#16511)
This is the least effort I can presently think of to allow for us to
reprocess user article's and handle the scenario in which the user may
have once had permission to the liquid tag but no longer.

This DI is not something I imagine using, but may highlight a better
approach for liquid tag permissions.

Related to #12146 and #16460
2022-02-10 07:47:16 -05:00
Daniel Uber
032378b3bd
Disable dash replacement filter in markdown fixer (#15839)
* Remove modify_hr_tags method definition

this breaks things that call it.

* Remove direct uses of modify_hr_tags fixer method

Remove from class METHODS lists, remove test cases about this behavior, and remove from
methods lists in test cases.

* Remove hr tag modification spec

Still don't understand what problem this was fixing, but I've removed
the test case.
2021-12-20 15:39:55 -06:00
Josh Puetz
3fd03b5ed6
Remove line break after linking username mentions (#15788) 2021-12-16 10:39:07 -06:00
Mac Siri
443e852091
Remove button from allowed tags (#14434) 2021-08-11 10:48:07 -04:00
dependabot[bot]
816855ce3b
Bump rubocop from 1.17.0 to 1.18.0 (#14107)
* Bump rubocop from 1.17.0 to 1.18.0

Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.17.0 to 1.18.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.17.0...v1.18.0)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* yarn install

* Fix violations

* Restore the default aligned setting

* Trigger Travis CI

* Escape HTML

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rhymes <github@rhymes.dev>
2021-07-01 13:51:49 +02:00
Andy Zhao
864a9195a9
[15-min-fix] Add option for triple tildes for fenced codeblocks (#13810)
* Add option for triple tildes for fenced codeblocks

Note that this doesn't account for all triple backticks in fenced codeblocks situations.

* Add commented out but failing test case for the future?

* Add tests from QA instructions
2021-05-24 14:19:04 -04:00
rhymes
a798bd2f7d
[15 min fix] Fallback to the image URL if Cloudinary/Imgproxy are not configured (#13767)
* Fallback to the image URL if neither Cloudinary nor Imgproxy are configured

* Fix specs

* Cloudinary api_secret is required

* Update spec/models/message_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-05-19 15:03:20 +02:00
Andy Zhao
dc30eadad8
Remove unused attributes from markdown parser (#13484)
* Remove definitely unused attributes

* Refactor and remove unused attributes

* Add parentheses

* Prevent alt tag from having Liquid tags inside

* Add test

* Remove more unused attributes

* Scrub any valid attributes

* Remove unused tags and add more tests

* Remove <i> tag; <em> is used by parser

* Remove <center> b/c it's deprecated though still valid

* <cite> is a safe tag and used by some

* Eh I changed my mind about center lol

* Add underline <u> back in

* Don't allow width changes

* Use frozen constant for regex

* Use #remove over #gsub
2021-04-27 09:33:01 -04:00
Vaidehi Joshi
956caf69c7
Rename comment-mentioned-user class added by Html::Parser (#13263)
* Rename comment-mentioned-user class added by Html::Parser

* Add DataUpdateScripts for resaving articles, comments, and messages

* Swap order of messages and articles DUS
2021-04-13 14:33:22 -07:00
Jacob Herrington
f76a8e1e99
[15-minute fix] Don't allow markdown to use CSS classes (#13282)
* Don't allow markdown to use CSS classes

* Fix code highlighting

* Add spec for ignoring CSS classes

* Add comment
2021-04-07 11:40:39 -04:00
Miguel Guardia
2a50efb936
Fix Markdown parsing of <code> tag (#12797)
* Create a new method that replaces <code> tags to
triple back ticks (```)

* Create unit tests for add_proper_code_tags method

* Rubocop fixes

* Change method name to one that is more descriptive/accurate
Fix method to allow for triple backticks, sameline code tags and multiline codetags in the same post/article
Fix test to match with method name change

* Fix rubocop offenses

* Fix Rubocop offenses

* Add additional assertions to make sure backticks are present
2021-03-03 17:41:56 +01:00
Alex
f5ab9552d5
Move MarkdownTraverser to service (#12282) 2021-01-20 11:29:42 -05:00
Alex
31689fd76a
Break MarkdownFixer into MarkdownProcessor::Fixer services (#12241)
* Create new MarkdownProcessor::Fixer services

* Remove old MarkdownFixer

* Code cleanup

* Capitalize Base in code comments

* Remove comments related to inheritance

* Add fix_methods method to hold METHDOS constant
2021-01-14 10:26:46 -05:00
Alex
a5e6f7942c
Rename MarkdownParser to MarkdownProcessor::Parser (#12248)
* Rename MarkdownParser to MarkdownProcessor::Parse

* Wake up, Travis

* Fix typo
2021-01-13 10:39:13 -05:00