Commit Graph

74 Commits

Author SHA1 Message Date
Roardom 70f7bf4146 fix: bbcode link double encoding
We already encode the entire content of the bbcode, so encoding links a second time aren't necessary
2025-01-24 13:46:02 +00:00
Roardom 3a4345aeca fix: double escape in link content
We already escape the entire content and don't need to escape the link content a second time. Otherwise, when a link contains, for example, an apostrophe, it's double encoded to `&pos;` before being displayed on the page. Regression from #3222
2025-01-21 10:37:07 +00:00
Roardom ad716d7cc3 update: remove XSS cleaner and remove XSS vulnerabilities
We've been mostly relying on the 3rd party xss cleaner to make sure user submitted content is clean. This PR fixes up any leftover holes in the bbcode parser that allow xss vulnerabilities, and as a result, the 3rd party library isn't needed anymore. It cleans responsibly by first, running `htmlspecialchars()` over the content, followed by sanitizing the untrusted urls and whitelisting their protocol.
2025-01-20 02:52:42 +00:00
Roardom 4857fcbd57 add: [hr] bbcode tag for horizontal rule 2024-10-17 03:50:19 +00:00
Roardom e63fa486d5 fix: don't compress webp losslessly through image proxy
The `&ll` query parameter prevents webp from being compressed: https://wsrv.nl/docs/format.html#lossless-compression. Adding `&ll` to non-webp images still seems to work fine from testing.
2024-10-12 15:25:02 +00:00
Roardom b73f1d5a6f update: don't match . with * using whitelisted image domain syntax
It's too easy for sysops to add `https://*imgur.com/**` instead of properly adding `https://*.imgur.com/**` or even better, `https://i.imgur.com/**`. This makes it easier to spot errors in the syntax errored since the intended whitelisted domain won't work. Add some more documentation to encourage safe practices and add example evil URLs that are permitted by the bypass for visual feedback of what is allowed.
2024-07-03 06:35:35 +00:00
Roardom 12903f64ac fix: strict type issues
Don't pass null into functions that don't accept null.
2024-05-23 17:40:16 +00:00
Roardom b86475a732 add: strict types to all files 2024-05-23 13:58:29 +00:00
Roardom 0f1f12fb99 fix: support gifs in image proxy
https://wsrv.nl/docs/format.html#number-of-pages
2024-03-06 20:31:06 +00:00
Roardom 571bd5a0ce fix: don't match slashes in whitelisted image url wildcards 2024-03-03 10:02:26 +00:00
Roardom f2dbdd324c fix: whitelisted image url domain matching
Use wildcards on the full url instead of just the hostname.
2024-02-28 22:54:47 +00:00
Roardom 829101f093 add: bbcode image domain whitelist 2024-02-26 09:11:59 +00:00
Roardom ea7104f9e8 update: more strict bbcode youtube video regex 2023-12-30 08:44:57 +00:00
Roardom c940c9013c refactor: format bbcode parser code 2023-12-30 07:31:59 +00:00
Roardom 4c9785b975 fix: typos in bbcode parser comments 2023-12-30 07:29:52 +00:00
Roardom 94f51a0328 update: specify quote encoding in bbcode parser 2023-12-30 07:25:04 +00:00
Roardom 961d6d94a1 refactor: use static anonymous functions in bbcode parser 2023-12-30 07:16:21 +00:00
Roardom 61519a6309 refactor: remove redundant regex in bbcode parser 2023-12-30 07:08:19 +00:00
Roardom 4665d7a990 refactor: add types to bbcode parser 2023-12-30 07:00:27 +00:00
Roardom ea763a4f6f add: table header bbcode syntax 2023-12-09 12:31:36 +00:00
HDVinnie 3f03214e39 PHP Style Change (Laravel Pint CI) 2023-11-07 23:54:38 +00:00
Roardom 8f9c2f8c22 update: only allow px for bbcode font size 2023-10-22 01:49:47 +00:00
HDVinnie 656647649f Revert "cleanup: pt.2"
This reverts commit 33d9927abd.
2023-10-12 23:11:20 -04:00
HDVinnie 33d9927abd cleanup: pt.2 2023-10-12 22:41:46 -04:00
HDVinnie b3f0386149 cleanup: pt.1 2023-10-12 22:30:52 -04:00
Roardom 32d9a1d5b7 add: pre bbcode syntax for inline code 2023-07-29 08:53:56 +00:00
HDVinnie 45c209277b Merge pull request #2789 from Roardom/fix-bbcode-block-margins
(Fix) BBCode margin of some block elements
2023-05-14 16:58:22 -04:00
Roardom 4d5b4a73c5 fix: bbcode margin of some block elements 2023-05-12 20:32:44 +00:00
Roardom 11fd7b4dcc fix: bbcode delegation of line break handling
Pages support markdown as well as bbcode, and handle linebreaks themselves. We shouldn't convert linebreaks in the bbcode parser in such scenarios. Also remove an unused variable.
2023-05-12 19:32:09 +00:00
Roardom a4ce049b77 fix: hiding whitespace surrounding bbcode block elements 2023-05-11 09:15:00 +00:00
Roardom 9fe05cc3bd fix: bbcode font size 2023-05-05 20:52:29 +00:00
Roardom d97ab002f2 remove: redundant bbcode converter 2023-02-07 23:51:10 -06:00
Roardom a1cacd7fa5 update: rendered bbcode/markdown/html styles 2023-02-07 23:23:56 -06:00
HDVinnie 3650900c97 update: lint
- not_operator_with_space to false
2023-02-03 16:01:29 -05:00
HDVinnie 472c820f99 update: UNIT3D linting
- github action updated with new ruleset in pint.json
- codebase linted with new ruleset
- contributors can now run `./vendor/bin/pint`
- action workflow will auto correct any lint issues upon commit/opened pull request
2023-02-02 08:02:34 -05:00
HDVinnie 2ca429c4ce Revert "PSR12 Linting"
This reverts commit 7e65e1d589.
2022-09-11 19:51:58 -04:00
HDVinnie 7e65e1d589 PSR12 Linting 2022-09-11 23:50:41 +00:00
Roardom d998ccb7f1 fix: comparison syntax validation
There are many cases where more flexible user input is desired. The output gets rendered through the Blade template anyway which escapes malicious input.
2022-09-03 14:46:27 +00:00
Roardom ce01dea3c0 add: bbcode syntax for screenshot comparison 2022-08-29 09:09:24 -05:00
HDVinnie 5414340e44 chore: code cleanup 2022-08-25 19:26:08 -04:00
Roardom 1b4a272e00 fix: bbcode error when final character is '[' 2022-07-05 14:59:55 -05:00
Roardom 034b554a82 fix: 3rd party upload bots sending unsupported bbcode image width 2022-06-11 19:02:22 -05:00
Roardom b6ef53a47f fix: bbcode color
Initially, characters were only allowed when there was only one of them, so `[color=r]` would be accepted, but not `[color=red]`. This issue is now fixed.

Additionally, short hex codes with transparency (e.g. `[color=#0123]`) were also broken. This has now been fixed.

Color values such as rgb(), rgba(), hsl() and hsla() are intentionally unsupported to prevent feature creep.
2022-06-09 00:54:05 +00:00
Roardom d4962a3798 fix: bbcode 2022-06-01 22:38:24 -05:00
HDVinnie c0eeef8808 update: helpers 2022-02-28 04:59:08 -05:00
HDVinnie 167f85ad53 add: bbcode img lazy loading 2022-01-25 18:41:45 -05:00
HDVinnie 98521378d2 chore: phpdoc blocks 2022-01-10 17:46:43 -05:00
StyleCI Bot 06bcb20688 Apply fixes from StyleCI 2022-01-08 18:56:52 +00:00
HDVinnie 77ec35bea5 chore: apply the laravel code style linter 2022-01-08 00:03:12 -05:00
HDVinnie 97394c062f chore: adopt type hints 2022-01-07 23:35:33 -05:00