docsifyjs / docsifyjs/docsify

Embedded markdown fails due to cross site authenticaiton

オープン
#1,422 コメント 1 件 リアクション 1 件 担当者 0 名 @cmbaatz が担当を希望しています GitHub で見る
needs discussion
主要言語
JavaScript
スター
31.5k
フォーク
5.8k
平均マージ
9日 8時間
マージ済み PR(30日)
2

説明

## Bug Report

#### Steps to reproduce
Exposing this issue requires the import of a markdown behind an authenticated site. The bug was discovered when working on a site locally using the docsify-cli tool in which a markdown page had embedded another markdown from a corporate github enterprise system. It's assumed that once the pages were uploaded to the same github instance the issue would be resolved, but this bug makes it impossible to work on such documentation on a local environment.

1. Create a markdown for embedding and store it into a github instance, which when served by pages will require authentication.
1. Create a new github pages project using the docsify embed feature attempt to embed the remote page.
1. Serve the new github pages project locally using the docsify-cli tool

#### What is current behaviour
When docsify attempts to fetch the protected resource instead of the markdown the request is redirected to the authentication page, which is returned and embedded into the markdown.

#### What is the expected behaviour
When embedding a protected markdown that I have already authenticated to I should see the contents of that markdown embedded into the page.

#### Other relevant information
To solve this issue the XMLHttpRequest used to fetch the contents should set the [withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials) value to true. If the use has then successfully authenticated in the browser to the protected resource this would allow docsify to properly fetch the requested content.

- [X] Bug does still occur when all/other plugins are disabled?

- Your OS: RHEL v8.0.2
- Node.js version: v10.21.0
- npm/yarn version: 6.14.4
- Browser version: Firefox 81.0.2, Chrome 86.0.4240.183
- Docsify version: 4.11.6
- Docsify plugins:

#### Please create a reproducible sandbox

[![Edit 307qqv236](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/307qqv236)

#### Mention the docsify version in which this bug was not present (if any)

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。