Interactive consent for a non-ASCII host is asked for and then always refused

Offen Anfängerfreundlich
#131 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
72/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
go

Rechercherichtung

Beginne in internal/authz/authz.go beim Standardzweig von Gate (etwa Zeilen 84-96), wo confirm läuft, bevor der Host validiert wird. internal/authz/scope.go enthält parseScopeHost, das nicht-ASCII-Hosts bereits ablehnt; prüfe, ob es vor der Abfrage ausgeführt werden kann. Fertig ist, wenn ein nicht-ASCII-Host vor jeder Abfrage mit dem Punycode-Hinweis abgelehnt wird und ein Test in internal/authz dies abdeckt. Führe go test ./internal/authz aus.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug good first issue severity: low

Summary

For a running target with a non-ASCII host (for example http://bücher.example/), authz.Gate asks the operator to type the host to confirm. After they type it correctly, it refuses with an error about the scope "from the interactive confirmation" not being valid. The host check that makes the target unusable runs after the prompt instead of before it.

Where

  • internal/authz/authz.go:84-96 (confirm, then the interactive scope built from ep.String(), then normalize)
  • internal/authz/scope.go:213-216 (parseScopeHost rejects non-ASCII hosts)
  • internal/authz/scope.go:290 (endpointOf accepts any u.Hostname())

Details

default:
	if err := confirm(ep, opts); err != nil {
		return nil, err
	}
	g.source = sourceInteractive
	raw = config.Scope{
		Hosts: []string{ep.String()},
		...
	}
}
g.scope, g.hosts, g.prefixes, err = normalize(raw)

Impact

The operator is asked for consent, types the host exactly, and is then refused with an error about a scope they never wrote. The punycode hint in the error is useful, but it should come before the prompt.

Steps to reproduce

authz.Gate on http://bücher.example/ with Interactive: true and stdin bücher.example\n: it prints the confirmation prompt, then returns "the scope from the interactive confirmation is not valid ... write international names in punycode".

Suggested fix

In Gate, run parseScopeHost(ep.String()) before confirm, and refuse up front with the punycode hint. Converting the host to punycode would need golang.org/x/net/idna, a new dependency that AGENTS.md asks to justify.

Acceptance criteria

  • A non-ASCII host is refused before any prompt, with the punycode hint.
  • A test in internal/authz covers it.

Getting started

  • Relevant files: internal/authz/authz.go, internal/authz/scope.go
  • How to run tests: go test ./internal/authz

Filed by repo-audit/full-audit at fffef43. Severity: low. Effort: S. audit-key: bug|internal/authz/authz.go|Gate

Vorherrschende Sprache
Go
Sterne
0
Forks
1
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/Spackle

Alle Issues in TMHSDigital/Spackle

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.