Skip to content
项目

关于

Try JShell on Web

开发工具

这些数字如何统计

实测星标增长

24小时
正在收集历史
7天
正在收集历史
15天
正在收集历史
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

tryjshell.org

1. About

tryjshell.org is a web terminal to try and test Java 27 and its preview features on the JShell tool.

print screen

1.1. Run on Web

1.2. Run on Docker

docker run -it --rm -p 8080:8080 rahmanusta/tryjshell

run.sh starts it with the same sandbox flags that are used in production.

1.3. Build

Maven runs inside Docker, so no local JDK is needed.

./build.sh     # image for the local architecture
./publish.sh   # multi-arch (amd64 + arm64) image, pushed to Docker Hub

2. Configuration

All settings are environment variables.

Variable Default Description

MAX_SESSIONS

12

Concurrent jshell sessions on the server

MAX_SESSIONS_PER_IP

3

Concurrent sessions per client IP (X-Real-IP from the proxy)

MAX_SESSION_MINUTES

60

Hard limit for a single session

POOL_SIZE

1

jshell processes kept warm for fast startup

ALLOWED_ORIGINS

(any)

Comma separated list of allowed WebSocket origins

JSHELL_OPTS

--enable-preview + heap limits

Options passed to jshell

3. Security model

JShell executes arbitrary Java code, so a visitor can run any program inside the container. The goal is to keep that contained:

  • No network. In production the container is only attached to an internal Docker network whose bridge has no address on the host. Code cannot reach the internet, the cloud metadata service, the host or other containers. Only nginx-proxy joins that network. See deploy/tryjshell_restart.sh.

  • Immutable image. Read-only root filesystem; the JDK and the server jar are owned by root. /tmp is a small noexec tmpfs, so dropped binaries cannot be executed.

  • Least privilege. Non-root user, all Linux capabilities dropped, no-new-privileges.

  • Resource limits. CPU, memory, process count and file descriptors are capped, as are sessions per IP and in total.

  • Session isolation and cleanup. Every session gets its own home, working directory and JShell preferences (history is not shared). When a session ends, its whole process tree and directory are removed; processes that try to escape with setsid/nohup are reaped within a minute.

Visitors still share one container and one Unix user, so a malicious visitor can observe or disturb other sessions running at the same time. Nothing else runs in the container.

4. License

MIT

探索相关项目

加载中…