bash-server: A minimal HTTP server that maps URL endpoints to shell commands

https://github.com/danhab99/bash-server

I cannot ever be sure about this but this might have come to me in a dream. I just thought about why it's so hard to implement a web-server in bash, basically all the functionality of the webserver must be implemented in bash but the http handling can be compiled.

This program lets you declare endpoints and map them to shell commands, query args get passed as ENV vars, methods are enforced, body is passed in stdin and the response is the stdout.

I also learned I really like declaring flake.nix files for all my personal projects, I hope it helps you install what I create!

15 points · 11 comments · view on lemmy.world

11 Comments

CameronDev@programming.dev · 13 pts · 148d

Unauthenticated RCE <3

rimu@piefed.social · 8 pts · 148d

sip@programming.dev · 8 pts · 148d (1 reply)

cgi

purplemonkeymad@programming.dev · 2 pts · 148d

Yea have you not be able to do this with Apache etc forever? You can even define the endpoint with a very unix like every endpoint is a file.

On fact was there not even a vulnerability that was caused by the fact the CGI can run bash?

catnip@lemmy.zip · 5 pts · 148d

Im using this in prod to host our banking frontend! It works great so far :)

flying_sheep@lemmy.ml · 4 pts · 148d

Terrifying

brian@programming.dev · 3 pts · 147d

for the common use cases, I imagine you're better off using https://github.com/adnanh/webhook instead. handles security etc. don't think it lets you return responses but at that point you probably want a proper server framework

brian@programming.dev · 1 pts · 147d

for the common use cases, I imagine you're better off using https://github.com/adnanh/webhook instead. handles security etc. don't think it lets you return responses but at that point you probably want a proper server framework

brian@programming.dev · 1 pts · 147d

for the common use cases, I imagine you're better off using https://github.com/adnanh/webhook instead. handles security etc. don't think it lets you return responses but at that point you probably want a proper server framework

tocano@piefed.social · 0 pts · 148d (1 reply)

What about request/response headers?

danhab99@programming.dev · 2 pts · 148d

Out of scope