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 摘要。