You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Rikaitan API not able to export dictionary CSS on Firefox
* Use CSSOM as fallback for sanitization
* Allow data-permissions-setting to trigger transforms
* Add frontend for rikaitanApiAllowCssSanitizationBypass
* Add rikaitanApiAllowCssSanitizationBypass option
* Allow css to be passed through without sanitization
* Move newline stripping outside sanitization method
* Log css when sanitization is bypassed
* Only show sanitization bypass for firefox
* Fix typo
* Improve sanitization bypass description
<rikaitan.link>OWU0NDQzN2RjNzE2N2U4NGM1Nzc2MmE5OTJkNDkzYWRlZDE0OGQ3ZQo=</rikaitan.link>
// newlines and returns do not get converted into json well, are not required in css, and cause invalid css if not parsed for by the api consumer, just do the work for them
// newlines and returns do not get converted into json well, are not required in css, and cause invalid css if not parsed for by the api consumer, just do the work for them
487
-
returnsanitizedCSS.replaceAll(/(\r|\n)/g,' ');
495
+
returnsanitizedCSS;
488
496
}catch(e){
489
-
log.log('Failed to sanitize css: '+css.replaceAll(/(\r|\n)/g,' ')+', '+toError(e).message);
A malicious dictionary which contains malicious CSS may try to execute Javascript.
231
+
For example, if the output of the Rikaitan API is used in Anki, then the resulting Anki card may execute unintended Javascript.
232
+
The risk in this case is similar to downloading a malicious Anki deck.
233
+
Namely, in both cases, you are relying purely on Anki's sandbox to protect your machine and information from the malicious code.
234
+
If the Anki sandbox works, card contents could be leaked (a minor confidential issue).
235
+
If the sandbox fails, there is much more to worry about (actions being taken on your machine such as stealing credentials and sensitive information, or ransomware taking over your computer).
236
+
</p>
237
+
<p>
238
+
If you choose to disable the CSS sanitization, we recommend thinking end-to-end about where the Rikaitan API output is used, and whether that destination is resilient to potentially malicious Javascript code being included, otherwise you are potentially risking the data and integrity of your system.
239
+
</p>
240
+
<p>
241
+
Sanitization bypass will allow CSS that cannot be sanitized to pass through the sanitizer unchanged.
242
+
This ONLY applies to the Rikaitan API, it will not make any other areas of Rikaitan potentially vulnerable.
243
+
</p>
244
+
<p>
245
+
This can be required to retrieve CSS on some browsers which do not support the offscreen page necessary for full CSS sanitization in the Rikaitan API on the backend.
246
+
Rikaitan will attempt to fall back on basic sanitization but this will fail for dictionaries making use of complex CSS.
0 commit comments