Skip to content

[FIX] Let ALLOW_* container actions work without POST=1 - #194

Open
surfnterd wants to merge 1 commit into
Tecnativa:masterfrom
surfnterd:fix-granular-allow-without-post
Open

surfnterd wants to merge 1 commit into
Tecnativa:masterfrom
surfnterd:fix-granular-allow-without-post

Conversation

@surfnterd

Copy link
Copy Markdown

Fixes #101.

ALLOW_START, ALLOW_STOP, ALLOW_RESTARTS, ALLOW_PAUSE and ALLOW_UNPAUSE only worked with POST=1. These actions are all POST requests, and the deny unless METH_GET || POST line came before their allow rules, so with POST=0 they were refused. With POST=1, every POST to an enabled section is allowed anyway, which defeats the point of the granular flags.

This moves the five granular allow rules above the POST gate. Nothing else changes order, and with the flags at their default 0 the behaviour is the same as before. The linuxserver/docker-socket-proxy fork orders its rules the same way.

Added test_granular_permissions_without_post: with only the five ALLOW_* flags set, pause/unpause/restart/stop/start/kill on a separate container succeed, while rm, run and network create are still refused. It fails on master with 403 Forbidden on the first call, and passes with this change. The full suite passes locally (6 tests, pytest --prebuild), and black 23.9.1 / isort / flake8 are clean.

🤖 Generated with Claude Code

The granular start/stop/restart/pause/unpause rules came after the
`deny unless METH_GET || POST` gate, so with POST=0 they were never
reached. Move them above the gate. Fixes Tecnativa#101.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@surfnterd

Copy link
Copy Markdown
Author

Friendly ping on this one. It fixes #101, where ALLOW_START, ALLOW_STOP, ALLOW_RESTARTS, ALLOW_PAUSE and ALLOW_UNPAUSE only work with POST=1. Happy to adjust anything if you'd prefer a different approach.

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.

ALLOW_RESTARTS doesn't work

1 participant