docsifyjs / docsifyjs/docsify

`<script>` in the md file fetched from the basePath is not executed

Aperta
#1,659 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
31.5k
Fork
5.8k
Merge medio
9g 8h
PR unite (30g)
2

Descrizione

## Bug Report
`// my script` in md file from `basePath` is not executed.

#### Steps to reproduce
- Provide the `basePath` as a full url with a domain different from the domain of `index.html`.
- open url of `index.html` with your browser.
- When you fetch the md files from `basePath`, you can check that the script in the md file cannot be executed.

#### What is current behaviour
In this case, the value of `isRemoteUrl` is determined to be true, so the code is sanitized by the code below.

https://github.com/docsifyjs/docsify/blob/c3cdadc37137edcd9e219359973902d2fc8b66ff/src/core/render/index.js#L332-L334

#### What is the expected behaviour
`basePath` is a value that can be entered only with the authority of the document site administrator, and the basePath server can also be considered owned by the administrator, so the `isRemoteUrl` value should be `false`.

#### Other relevant information

<!-- (Update "[ ]" to "[x]" to check a box) -->
- [ ] Bug does still occur when all/other plugins are disabled?

- Your OS: macOS 11
- Node.js version:
- npm/yarn version:
- Browser version:
- Docsify version: 4.12.1
- Docsify plugins:

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da src/core/render/index.js alle righe 332-334 e riproduci il problema usando un index.html il cui basePath sia un URL completo su un altro dominio. Verifica in che modo la decisione relativa all’URL remota influisce sulla gestione degli script; il lavoro è completato quando uno script nel Markdown recuperato viene eseguito in questa configurazione senza modificare il comportamento previsto per le altre sorgenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.