Skip to content

<script type="shell"> to execute arbitrary shell commands, and import stdout or result written to local file as a JavaScript module #3443

@guest271314

Description

@guest271314

Note, this is just a concept that have been mulling over for a few months. Given

<script type="shell" src="file:///home/USER/.config/SHELL_SCRIPTS/ls.sh"></script>

or

<script type="shell">
#!/bin/bash
touch export.txt
ls -l > export.txt
</script>

or

<script type="shell, module">
#!/bin/bash
touch export
ls -l > export

# some mechanism to export the result of `stdout` or created local file "export.txt" as a JavaScript "module"
</script>
<script type="module"> import {stdout} from "./export" </script>

This is a concept roughly based on Native Messaging available at Chromium and Firefox browsers.

We could provide some form of notification to the user where permission is either granted or not (similar to navigator.getUserMedia(), navigator.registerProtocolHandler(), etc.) for a given local folder either containing the binary itself or having adequate permissions to be executed as a program; and sandbox the permissions to the specific folder to avoid permission escalation concerns.

We could also create some form of wrapper for stdout of the command(s) or fetching of a temporary created file for the purpose of using export {<export result of shell command here as JavaScript module>}.

Has this concept or inquiry been previously presented to and considered by HTML Standard?

What is the viability, and security considerations of adding "shell" to <script> element type to execute arbitrary shell commands where src requests resources from file: protocol?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions