Skip to content

Decoding, validation, and path-resolution fixes for cgi-bin scripts#796

Open
b1tw153 wants to merge 18 commits into
drolbr:masterfrom
b1tw153:b1tw153/improve-cgi-scripts
Open

Decoding, validation, and path-resolution fixes for cgi-bin scripts#796
b1tw153 wants to merge 18 commits into
drolbr:masterfrom
b1tw153:b1tw153/improve-cgi-scripts

Conversation

@b1tw153

@b1tw153 b1tw153 commented Jul 20, 2026

Copy link
Copy Markdown

src/cgi-bin/* (17 scripts)

  • Pipe the raw parameter values to uncgi on stdin using printf '%s' to ensure that they are correctly decoded.
  • Resolve the script's own path and relative paths with realpath to ensure that path construction is correct.
  • Validate parameters before use. Data-API scripts return 400 for a malformed request and 500 only for a missing or unreadable backend file. Scripts that render an HTML page fall back to defaults instead of erroring.
  • sitemap: fix incorrect handling of an empty directory.
  • ping: handle error cases and remove a race condition.
  • kill_my_queries: validate the PID argument; construct paths more carefully.
  • Quoting, ShellCheck, and backtick → $( ) fixes throughout.

Scripts accept the same inputs and produce the same outputs as before for well-formed requests.

src/pt_diagrams/uncgi.cc

  • Properly handle a trailing % at the end of the input.
  • Restructure main input loop to ensure the entire input is read correctly.

uncgi accepts the same inputs and produces the same outputs as before for well-formed requests.

b1tw153 added 18 commits July 10, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant