shadow1ng/fscan · error

webscan_strmap_parse_failed

webscan_strmap_parse_failed

Error message

webscan_strmap_parse_failed

What it means

Guard in StrMap.UnmarshalYAML: while converting the ordered YAML mapping, a key or value was not a string (e.g. a nested map or number where a string was expected). The POC rule field being decoded does not match the string-to-string map shape and parsing is aborted.

Source

Thrown at webscan/lib/Client.go:307

		Key   string  // 键名
		Value []Rules // 规则列表
	}
)

// UnmarshalYAML 实现StrMap的YAML解析接口
func (r *StrMap) UnmarshalYAML(unmarshal func(interface{}) error) error {
	// 临时使用MapSlice存储解析结果
	var tmp yaml.MapSlice
	if err := unmarshal(&tmp); err != nil {
		return err
	}

	// 转换为StrMap结构
	for _, one := range tmp {
		key, keyOk := one.Key.(string)
		value, valueOk := one.Value.(string)
		if !keyOk || !valueOk {
			return fmt.Errorf("%s", i18n.GetText("webscan_strmap_parse_failed"))
		}
		*r = append(*r, StrItem{key, value})
	}

	return nil
}

// UnmarshalYAML 实现RuleMap的YAML解析接口
// 参数:
//   - unmarshal: YAML解析函数
//
// 返回:
//   - error: 解析错误
func (r *RuleMap) UnmarshalYAML(unmarshal func(interface{}) error) error {
	// 使用MapSlice保持键的顺序
	var tmp1 yaml.MapSlice
	if err := unmarshal(&tmp1); err != nil {
		return err

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Fix the POC YAML so map values are plain strings
  2. Quote numeric or boolean values in the rule map
  3. Validate the POC file against the documented schema
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at webscan/lib/Client.go:307 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06). Data as JSON: /api/errors/3a14bb9406bf0a04. Report an issue: GitHub.