summaryrefslogtreecommitdiff
path: root/lib/banzai
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhqRobert Speicher2019-07-294-50/+16
|\
| * Extract SanitizeNodeLink and apply to WikiLinkFilterKerri Miller2019-07-264-50/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SanitizationFilter was running before the WikiFilter. Since WikiFilter can modify links, we could see links that _should_ be stopped by SanatizationFilter being rendered on the page. I (kerrizor) had previously addressed the bug in: https://gitlab.com/gitlab-org/gitlab-ee/commit/7bc971915bbeadb950bb0e1f13510bf3038229a4 However, an additional exploit was discovered after that was merged. Working through the issue, we couldn't simply shuffle the order of filters, due to some implicit assumptions about the order of filters, so instead we've extracted the logic that sanitizes a Nokogiri-generated Node object, and applied it to the WikiLinkFilter as well. On moving filters around: Once we start moving around filters, we get cascading failures; fix one, another one crops up. Many of the existing filters in the WikiPipeline chain seem to assume that other filters have already done their work, and thus operate on a "transform anything that's left" basis; WikiFilter, for instance, assumes any link it finds in the markdown should be prepended with the wiki_base_path.. but if it does that, it also turns `href="@user"` into `href="/path/to/wiki/@user"`, which the UserReferenceFilter doesn't see as a user reference it needs to transform into a user profile link. This is true for all the reference filters in the WikiPipeline.
* | Prefer `flat_map` over `map` + `flatten`Peter Leitzen2019-07-261-1/+1
|/ | | | | Convert several occurrences of `map` + `flatten` to `flat_map` where applicable.
* Merge branch 'issue-64645-asciidoctor-footnote-links' into 'master'Nick Thomas2019-07-171-5/+28
|\ | | | | | | | | | | | | Preserve footnote link ids Closes #64645 See merge request gitlab-org/gitlab-ce!30790
| * Preserve footnote link idsGuillaume Grossetie2019-07-171-5/+28
| |
* | Rename Redactor classes to ReferenceRedactorSarah Yasonik2019-07-165-6/+6
|/
* Enable section anchorsGuillaume Grossetie2019-07-161-2/+28
|
* Merge branch 'issue-63298-asciidoc-sanitization' into 'master'Douwe Maan2019-07-124-79/+163
|\ | | | | | | | | | | | | Prevent excessive sanitization of AsciiDoc ouptut Closes #63298 See merge request gitlab-org/gitlab-ce!30290
| * Prevent excessive sanitization of AsciiDoc ouptutGuillaume Grossetie2019-07-124-79/+163
| |
* | Merge branch 'banzai-avoid-redis-if-db-cache' into 'master'Douwe Maan2019-07-111-11/+31
|\ \ | | | | | | | | | | | | Banzai - avoid redis if attr is in DB cache See merge request gitlab-org/gitlab-ce!30334
| * | Banzai - avoid redis if attr is in DB cachebanzai-avoid-redis-if-db-cacheMario de la Ossa2019-07-101-11/+31
| |/ | | | | | | | | | | | | When cache_collection_render runs we end up reading and writing things to redis even if we already have the rendered field cached in the DB. This commit avoids using redis at all whenever we have the field already rendered in the DB cache.
* | Expose metrics element for FE consumptionSarah Yasonik2019-07-105-0/+210
|/ | | | | | | | | | | Adds GFM Pipline filters to insert a placeholder in the generated HTML from GFM based on the presence of a metrics dashboard link. The front end should look for the class 'js-render-metrics' to determine if it should replace the element with metrics charts. The data element 'data-dashboard-url' should be the endpoint the front end should hit in order to obtain a dashboard layout in order to appropriately render the charts.
* Merge branch 'asciidoc-syntax-highlighting' into 'master'Douwe Maan2019-07-032-1/+2
|\ | | | | | | | | | | | | Enable AsciiDoc syntax highlighting (using Rouge) Closes #32635 See merge request gitlab-org/gitlab-ce!29835
| * Enable AsciiDoc syntax highlighting (using Rouge)Guillaume Grossetie2019-07-022-1/+2
| |
* | Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ceMarin Jankovski2019-07-031-3/+3
|\ \ | |/
| * Fix attachments using the wrong URLs in e-mailssh-fix-issue-63910Stan Hu2019-06-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/29889, only the project context were set for the Markdown renderer. For a note on an issuable, the group context was set to `nil` because `note.noteable.try(:group)` attempted to get the issuable's group, which doesn't exist. To make group notifications work, now both the project and group context are set. The context gets passed to `RelativeLinkFilter`, which previously assumed that it wasn't possible to have both a group and a project in the Markdown context. However, if a group were defined, it would take precedence, and the URL rendered for uploads would be `/group/-/uploads` instead of `/group/project/uploads/`. This led to 404s in e-mails. However, now that we have both project and group in the context, we render the Markdown giving priority to the project context if is set. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/63910
* | Merge branch 'security-DOS_issue_comments_banzai' into 'master'Marin Jankovski2019-07-021-1/+1
|\ \ | |/ |/| | | | | Fix DOS when rendering issue/MR comments See merge request gitlab/gitlabhq!3152
| * Fix DOS when rendering issue/MR commentsMario de la Ossa2019-06-131-1/+1
| |
* | Do not rewrite relative links for system notesbug/63162-duplicate_path_in_linksMario de la Ossa2019-06-201-0/+2
|/
* Allow emoji in label and milestone referencesallow-emoji-in-referencesSean McGivern2019-06-071-1/+1
| | | | | | | | | | | | | | | If we put the emoji filter before the reference filters, each emoji will have a wrapper element that prevents the reference filter from detecting the presence of the emoji. As the emoji filter now runs after the reference filters, references must contain a literal emoji, not the GitLab Flavored Markdown versions (:100`, for example). A weird side-effect is that if you have a label with the 100 emoji, and a label named :100:, then trying to reference the latter will work (link to the correct label), but will render with the 100 emoji. I'm comfortable with that edge case, I think.
* Use Redis for CacheMarkDownField on non AR modelsPatrick Bajao2019-06-051-1/+1
| | | | | | | | | | | | | | | | | | This allows using `CacheMarkdownField` for models that are not backed by ActiveRecord. When the including class inherits `ActiveRecord::Base` we include `Gitlab::MarkdownCache::ActiveRecord::Extension`. This will cause the markdown fields to be rendered and the generated HTML stored in a `<field>_html` attribute on the record. We also store the version used for generating the markdown. All other classes that include this model will include the `Gitlab::MarkdownCache::Redis::Extension`. This add the `<field>_html` attributes to that model and will generate the html in them. The generated HTML will be cached in redis under the key `markdown_cache:<class>:<id>`. The class this included in must therefore respond to `id`.
* Merge branch 'security-60143-address-xss-issue-master' into 'master'Robert Speicher2019-06-031-0/+8
|\ | | | | | | | | Reject slug+uri concat if slug is deemed unsafe See merge request gitlab/gitlabhq!3108
| * Reject slug+uri concat if slug is deemed unsafeKerri Miller2019-05-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First reported: https://gitlab.com/gitlab-org/gitlab-ce/issues/60143 When the page slug is "javascript:" and we attempt to link to a relative path (using `.` or `..`) the code will concatenate the slug and the uri. This MR adds a guard to that concat step that will return `nil` if the incoming slug matches against any of the "unsafe" slug regexes; currently this is only for the slug "javascript:" but can be extended if needed. Manually tested against a non-exhaustive list from OWASP of common javascript XSS exploits that have to to with mangling the "javascript:" method, and all are caught by this change or by existing code that ingests the user-specified slug.
* | Merge branch 'security-fix-project-existence-disclosure-master' into 'master'GitLab Release Tools Bot2019-06-031-2/+5
|\ \ | |/ |/| | | | | Fix url redaction for issue links See merge request gitlab/gitlabhq!3091
| * Fix url redaction for issue linksPatrick Derichs2019-05-031-2/+5
| | | | | | | | | | | | | | | | | | | | Add changelog entry Add missing href to all redactor specs and removed href assignment Remove obsolete spec If original_content is given, it should be used for link content
* | Fix milestone references with HTML entities in the namefix-milestone-references-with-escaped-html-entitiesSean McGivern2019-05-243-10/+10
| | | | | | | | | | | | | | | | | | When a milestone name contained an HTML entity that would be escaped (&, <, >), then it wasn't possible to refer to this milestone by name, or use it in a quick action. This already worked for labels, but not for milestones. We take care to re-escape un-matched milestones, too.
* | Merge branch 'patch-49' into 'master'Sean McGivern2019-05-061-0/+1
|\ \ | | | | | | | | | | | | | | | | | | No leading/trailing spaces when generating heading ids (Fixes #57528) Closes #57528 See merge request gitlab-org/gitlab-ce!27025
| * | Use strip to remove leading/trailing spacesWillian Balmant2019-04-111-2/+1
| | | | | | | | | Change based on comments in MR #27025
| * | No leading/trailing spaces when generating heading ids (Fixes #57528)Willian Balmant2019-04-101-2/+2
| | | | | | | | | Update based on comments in MR #27025
| * | No leading/trailing spaces when generating heading ids (Fixes #57528)Willian Balmant2019-04-041-0/+2
| | |
* | | Run rubocop -a on CE filessh-upgrade-rubocop-0.68.0-ceStan Hu2019-05-055-14/+14
| |/ |/|
* | Move scoped_label into label presenterJan Provaznik2019-04-231-2/+4
| | | | | | | | | | | | | | When rendering a label we want to check 'scoped_label' feature availability on a project/group where label is being used. For this reason a label presenter is used in UI and information about context project/group is passed to this presenter.
* | Remove multi-line suggestions feature flagosw-remote-multi-line-suggestions-ffOswaldo Ferreira2019-04-101-12/+0
| | | | | | | | That's a straightforward feature flag code removal for 11.10
* | Merge branch 'docs-zj-update-n-plus-one-comments' into 'master'Douglas Barbosa Alexandre2019-04-091-1/+1
|\ \ | | | | | | | | | | | | Update comments about N + 1 Gitaly calls See merge request gitlab-org/gitlab-ce!27178
| * | Update comments about N + 1 Gitaly callsZeger-Jan van de Weg2019-04-091-1/+1
| | | | | | | | | | | | | | | To make sure all known issues are linked to the correct epic, I've gone through the code base, and updated the comments where required.
* | | [CE] Support multiple assignees for merge requestsosw-multi-assignees-merge-requestsOswaldo Ferreira2019-04-081-1/+1
|/ / | | | | | | | | Backports https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10161 (code out of ee/ folder).
* | Merge branch 'keyval-labels' into 'master'Sean McGivern2019-04-052-4/+14
|\ \ | | | | | | | | | | | | [CE] Add mutually exclusive labels See merge request gitlab-org/gitlab-ce!26804
| * | [backend] backport of scoped labelsJan Provaznik2019-04-042-4/+14
| | | | | | | | | | | | Scoped labels in EE require additional changes in CE code.
* | | Fenced blockquotes to not change source line pos58717-checkbox-cannot-be-checked-if-a-blockquote-is-aboveBrett Walker2019-04-041-1/+3
| |/ |/| | | | | | | Replaces blockquote fences with \n, keeping the line numbering intact.
* | Fixed test specsOswaldo Ferreira2019-04-041-16/+0
|/ | | | | - added suggestions to mock data - fixed props to be not required
* Prepare suggestion implementation for multi-lineOswaldo Ferreira2019-03-271-0/+2
| | | | | | Adds the groundwork needed in order to persist multi-line suggestions, while providing the parsing strategy which will be reused for the **Preview** as well.
* Merge branch '54916-extended-tooltip-for-merge-request-links' into 'master'Phil Hughes2019-03-262-6/+17
|\ | | | | | | | | | | | | Resolve "Extended tooltip for merge request links" Closes #54916 See merge request gitlab-org/gitlab-ce!25221
| * Add merge request popover with detailsSam Bigelow2019-03-212-6/+17
| | | | | | | | | | | | | | | | | | - Show pipeline status, title, MR Status and project path - Popover attached to gitlab flavored markdown everywhere, including: + MR/Issue Title + MR/Issue description + MR/Issue comments + Rendered markdown files
* | Implement multi-line suggestions filteringOswaldo Ferreira2019-03-204-6/+49
|/ | | | | Implements the filtering logic for `suggestion:-x+y` syntax.
* Add SyntaxHighlightFilter to markup pipelineMartin Wortschack2019-03-051-1/+2
|
* Only allow 30 RPCs per test case to GitalyZeger-Jan van de Weg2019-02-221-1/+4
| | | | | | | | | Prior to this change, 35 Gitaly RPCs were allowed. But recently there's been a renewed interest in performance. By lowering the number of calls new N + 1's will pop up. Later commits will add blocks to ignore the raised errors, followed by an issue for each to be fixed.
* Properly handle multiple refs to same footnoteBrett Walker2019-02-131-7/+16
|
* Merge branch 'jprovazn-remove-redcarpet' into 'master'Grzegorz Bizon2019-02-054-54/+0
|\ | | | | | | | | | | | | Remove Redcarpet markdown engine Closes #51374 See merge request gitlab-org/gitlab-ce!24819
| * Remove Redcarpet markdown engineJan Provaznik2019-02-044-54/+0
| | | | | | | | | | This engine was replaced with CommonMarker in 11.4, it was deprecated since then.
* | Catch possible Addressable::URI::InvalidURIErrorBrett Walker2019-02-041-1/+5
|/