
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
$ npm install piston-js
import Piston from 'piston-js';
(async () => {
const piston = new Piston('https://pistonserver.com');
try {
const result: SubmissionResult = await piston.run({
language: {
name: 'python',
version: '3.9.1',
},
fileName: 'main.py',
sourceCode: 'print(int(input())*3)',
input: ['2'],
expectedOutput: ['4'],
});
console.log(result);
/*{
run: [ { stdout: '6', stderr: '', code: 0, signal: null, stdin: '2' } ],
verdict: { status: 'WA', stdout: '6', stdin: '2', expected_output: '4' }
} */
} catch (err) {
console.log(err.response.data);
}
})();
PistonConfig) : PistonReturns an instance of Piston
An object type representing the config for the Piston instance
| Property | Type | Description | Default |
|---|---|---|---|
| baseURL | string | the base url of the piston server | - |
| apiKey | string? | the api key used to access the piston server | "" |
| apiKeyHeader | string? | name of the api key header | "" |
Submission) : Promise< SubmissionResult>Runs a submission and returns the result
An object representing a submission
| Property | Type | Description | Default |
|---|---|---|---|
| sourceCode | string | the source code to execute | - |
| language | Language | the programming language to execute | - |
| fileName | string | name of the file to execute, 'e.g: Main.java'. Some languages like Java need files to have the same name as the Main class. | - |
| input? | string[] | batch stdin to execute | [""] |
| expectedOutput? | string[] | if provided, the execution will be evaluated against all stdout resulted from input. if provided, must have equal length to input | null |
| runTimeout? | number | milliseconds before timing out the program (TLE) | 3000 |
| compileTimeout? | number | milliseconds before timing out the compilation of the source code (applies only to compiled languages) (TLE) | 10000 |
Type of Language required in Submission
| Property | Type | Description | Default |
|---|---|---|---|
| name | string | name of the language | - |
| version | string | version of the language | - |
An object representing the result of a Submission
| Property | Type | Description |
|---|---|---|
| compile? | ProcessOutput | only available in compiled languages |
| run | ProcessOutput | result of each individual stdin in the batch |
| result | BatchResult | Final result of the submission batch after evaluation |
Type of an execution process output
| Property | Type | Description |
|---|---|---|
| stdin | string | process stdin |
| stdout | string | process stdout |
| stderr | string | process stderr |
| code | number | process return code |
| signal | string | process signal |
Type of an execution process output
| Property | Type | Description |
|---|---|---|
| status | Verdict | submission evaluation verdict |
| stdout | string | stdout of the first failed submission in the batch |
| stdin | string | stdin of the first failed submission in the batch |
| expectedOutput | string | expected output of the first failed submission in the batch |
| signal | string | process signal |
AC)An enum representing the verdict of a submission as strings
| Property | Value | description |
|---|---|---|
| AC | 'AC' | The source code executed successfully/passed all test cases |
| COMPILATION | 'COMPILATION' | Compilation error |
| ERROR | 'ERROR' | An error during the whole execution process |
| MLE | 'MLE' | Memory limit exceeded (NOT YET IMPLEMENTED) |
| PENDING | 'PENDING' | Submission is pending |
| RUNTIME | 'RUNTIME' | Runtime error |
| TLE | 'TLE' | Time limit exceeded (timedout) |
| WA | 'WA' | Wrong answer (Failed test cases) |
FAQs
[![PR's Welcome][pr-welcoming-image]][pr-welcoming-url]
The npm package piston-js receives a total of 1 weekly downloads. As such, piston-js popularity was classified as not popular.
We found that piston-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.