pm scripts pass the token in argv and swallow failed requests #133
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools#133
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bring the two
pmscripts' Forgejo calls up to the same standard asforge'sapi(), which keeps the token out of the process table and reports why a request failed instead of silently returning nothing.Primary goals:
--configfile the wayforgealready passes it, so it stops being readable from/proc/<pid>/cmdlineby anything running as the same user.Current state
pm/render:70andpm/integrity-check:111both run:Two independent defects sit in that one line.
The
-Hplaces the token in the command's arguments, where any process owned by the same user can read it out of/proc. This is the precise exposureforgeavoids:api()passes the credential through--configprocess substitution, and the test harness's mockcurlexits 99 if it ever sees anAuthorization:header in argv, so the property is actively guarded there and unguarded here.The
-fplus2>/dev/null || truediscards the status, the body, and the exit code together, so an empty result is indistinguishable from a successful empty response. The consequences differ per caller and both are silent:pm/render:70-72continueskips the issue; the rendered board omits it with no indication anything was missedpm/integrity-check:111-113breakends pagination early; the check validates whichever pages arrived and reports successThe second is the more serious: a validator that quietly examines a subset and passes is the failure mode
shell.mdwarns about, where a guard that cannot be shown to fail on sabotaged input does not count. A single 403, rate limit, or dropped connection turns the integrity check into a no-op that still exits 0.Scope
In: replace both call sites with a shared helper that passes the token via
--config, surfaces the HTTP status and the API's message on failure, and returns a non-zero code the callers act on rather than absorb. Decide explicitly per caller whether a failed page should abort or degrade, and if it degrades, say so on stderr.Out:
forge's ownapi(), which is handled in issue #100 and is the reference implementation to copy rather than re-derive. Out: any change to what thepmscripts render or check when every request succeeds.