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

未關閉 適合新手
#131 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
72/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
go

研究方向

從 internal/authz/authz.go 中 Gate 的預設分支(約第 84-96 行)開始,那裡 confirm 在主機驗證之前執行。internal/authz/scope.go 中的 parseScopeHost 已經會拒絕非 ASCII 主機,請檢查它能否在提示之前執行。完成標準是:非 ASCII 主機在任何提示之前即被拒絕,並附帶 punycode 提示,且 internal/authz 中有測試涵蓋此情況。執行 go test ./internal/authz。

由索引模型根據 Issue 內容生成。

描述

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

主要語言
Go
星號
0
分支
1
PR 合併指標
30 天內沒有已合併 PR

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

TMHSDigital/Spackle 的其他 Issue

查看 TMHSDigital/Spackle 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。