Restrict profiles per session: read-only, interactive-only and deny-list permissions
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- go
- Bereich
- authorization, cli
Rechercherichtung
The issue points to docs/auth.md and describes changes to core auth resolution and verb dispatch, but does not name source files or tests. Start by reading docs/auth.md and tracing how the active profile and canonical command are resolved before request construction. Done means the policy rules are enforced with a distinct non-zero refusal code and the error identifies the profile, command, rule, and policy path; the open questions need decisions first.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Problem
Any process that can run harness can use every profile and run every command, including deletes. For production-like profiles, and for AI-agent or autonomous use, there is no way to say "this profile is read-only" or "this profile must not run unattended".
Proposed
A cooperative guardrail, not a security boundary: the CLI reads a policy file and refuses commands the active profile doesn't allow. It does not try to stop a process that is working around it (env var mode, direct API calls, other profiles).
Policy file
A TOML file next to the profile files (path TBD, e.g. ~/.harness/permissions.toml), edited by hand. [all] applies to every profile; a [<profile>] section adds to it.
[all]
deny_commands = ["delete project"]
[harness0]
read_only = true
interactive = true
[default]
deny_commands = ["delete repository"]
-
Per-profile options, each independent (a profile is not in a "mode"); a command runs only if every option and the deny list allow it:
read_only: only read verbs (list,get) run.executeis blocked unless listed inallow_commands(for read-type executes such ashql:run).interactive: refuses when stdin or stdout is not a terminal, so scripts, CI and agents can't use the profile.
-
deny_commands: commands not allowed under the profile, matched against the canonicalverb noun[:variant]. An entry is one of:- a literal command:
delete repository - a wildcard with
*:delete * - a regular expression wrapped in slashes:
/^(delete|update) (repository|branch)$/
- a literal command:
-
Deny lists from
[all]and the profile section add up; a profile section can't remove an[all]entry. -
Session profile is chosen the usual way (
export HARNESS_PROFILE=<name>); see docs/auth.md.
Enforcement
One check before the request is built, after noun aliases are resolved (repositories -> repository), so spec-driven commands and custom handlers are covered. A refusal exits with a distinct non-zero code.
Error message
One message for every reader (human, script or agent): which profile, which command, which rule blocked it, and where the policy file is. Example:
blocked: 'delete repository' is not allowed by profile 'harness0' (read_only) - see <policy file path>
Open questions
- Regex syntax (Go RE2), anchoring (whole command vs substring), and the
/.../delimiter for telling a regex from a literal. - Policy file name and location, and Windows path if supported.
- Exact exit code.
allowed_profiles(refuse--profileother than the pinned one) as a follow-up.- Whether
interactiveshould treat pipeline mode (docs/auth.md) as non-interactive and refuse. - Core change (auth resolution and verb dispatch); land before any module work.
Related: #157.
- Vorherrschende Sprache
- Go
- Sterne
- 29
- Forks
- 24
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 111
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus harness/cli
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 45/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
Linux 主机 macOS 主机
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Lee-xeo/Claude-Cage#1455 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
slavakurilyak/awesome-ai-agents#1137 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
-
Make the HTTP server's keep-alive and headers timeouts configurableEvtl. vergeben @mattgodbolt hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
compiler-explorer/compiler-explorer#9902 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag