Skip to content

This spring-boot-starter facilitates the debugging of your deployed web application. It allows you to execute arbitrary code in the context of your application or outside it via the web route.

License

AnatoliyKozlov/evaluator-spring-boot-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code evaluator for spring applications

Maven Central codecov Maintainability License: MIT

Description

This spring-boot-starter facilitates the debugging of your deployed web application. It allows you to execute arbitrary code in the context of your application or outside it via the web route.

Requirements

  • Java 11+
  • Spring boot WEB application

Configuration

  1. Add dependency in your project. See versions on Maven Central.

For maven project:

<dependency>
    <groupId>dev.toliyansky</groupId>
    <artifactId>evaluator-spring-boot-starter</artifactId>
    <version>1.2.2</version>
</dependency>

For gradle project:

implementation 'dev.toliyansky:evaluator-spring-boot-starter:1.2.2'
  1. Since execution of arbitrary code is a security breach, the bean with route will not be instantiated by default. You must enable the evaluator by adding this property to application.properties:
evaluator.enabled=true
evaluator.webUiEnabled=true

Usage

  1. WEB UI: Use http://host:port/eval to access the web interface of evaluator with syntax highlight

  2. API: GET http://host:port/eval/{language}?code={your code}
    Parameters:
    your code - string with a valid script, URI encoded
    language - your script language [groovy, shell, cmd, powershell]

  3. API: POST http://host:port/eval/{language}
    language - your script language [groovy, shell, cmd, powershell]
    request body - string with a valid script

WEB UI is a preferable way of a code execution. Use API requests when the route is not accessible outside of execution environment (ex. kubernetes cluster, you can connect to POD terminal and use curl/wget for execute code you need to run).

Features

  • Execution arbitrary code in runtime. Support languages:
    • groovy
    • java (by compatibility via groovy)
    • shell
    • cmd
    • powershell
  • UI with code and response highlight

WEB UI overview

Dynamic usage example: dynamic-method

Simple groovy code example: groovy-operation

You can use Shell, Cmd or PowerShell for execute scripts in system context. powershell

About

This spring-boot-starter facilitates the debugging of your deployed web application. It allows you to execute arbitrary code in the context of your application or outside it via the web route.

Topics

Resources

License

Stars

Watchers

Forks