shadow1ng/fscan · error

webscan_xray_no_rules

webscan_xray_no_rules

Error message

webscan_xray_no_rules

What it means

ToFscanPoc converts an XrayPoc into fscan-style rules; if zero rules were produced after conversion, it refuses to return an empty POC and throws webscan_xray_no_rules. This guards callers from executing a POC with no detectable logic.

Source

Thrown at webscan/lib/poc_adapter.go:493

			FollowRedirects: rule.Request.FollowRedirects,
			Expression:      rule.Expression,
		}

		// 转换 output 字段为 Search — 多步POC中从响应提取变量供后续步骤使用
		if searchVal, ok := rule.Output["search"]; ok {
			fscanRule.Search = fmt.Sprintf("%v", searchVal)
		}

		// 如果expression为空,默认检查200状态码
		if fscanRule.Expression == "" {
			fscanRule.Expression = "response.status == 200"
		}

		poc.Rules = append(poc.Rules, fscanRule)
	}

	if len(poc.Rules) == 0 {
		return nil, fmt.Errorf("%s", i18n.GetText("webscan_xray_no_rules"))
	}

	return poc, nil
}

// ============= afrog格式适配器 =============

// AfrogPoc afrog POC结构(混合 Nuclei + xray 风格)
type AfrogPoc struct {
	ID   string `yaml:"id"`
	Info struct {
		Name        string         `yaml:"name"`
		Author      yamlStringList `yaml:"author"`
		Severity    string         `yaml:"severity"`
		Verified    bool           `yaml:"verified"`
		Description string         `yaml:"description"`
		Reference   yamlStringList `yaml:"reference"`
		Tags        string         `yaml:"tags"`

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Check that the source Xray POC has non-empty rules/expression fields before calling ToFscanPoc
  2. Verify the xray expression uses constructs the converter supports; simplify unsupported CEL operators
  3. Log/warn if poc.Rules is empty after conversion and skip or fix that POC
  4. Regenerate or obtain the POC from a current xray POC repository

Example fix

// before
poc, err := adapter.ToFscanPoc() // errors: no rules
// after
if len(adapter.Poc.Rules) == 0 || adapter.Poc.Expression == "" {
    return // skip non-convertible POC
}
poc, err := adapter.ToFscanPoc()
Defensive patterns

Strategy: validation

Validate before calling

if len(xrayPoc.Rules) == 0 || xrayPoc.Expression == "" {
    return errors.New("xray POC has no convertible rules")
}

Type guard

func hasConvertibleRules(p *lib.XrayPoc) bool {
    return p != nil && (len(p.Rules) > 0 || strings.TrimSpace(p.Expression) != "")
}

Try / catch

poc, err := adapter.ToFscanPoc()
if err != nil && strings.Contains(err.Error(), "webscan_xray_no_rules") {
    log.Warnf("skipping non-convertible POC %s", adapter.GetName())
    return nil
}

Prevention

When it happens

Trigger: Calling ToFscanPoc on an XrayPoc whose Rules/Expression fields are empty or whose expression syntax is not convertible, so the conversion loop appends nothing to poc.Rules.

Common situations: An Xray POC YAML missing the 'expression' or rules section; a POC using xray CEL expression features the converter does not support, resulting in all rules being skipped silently; programmatically constructing an XrayPoc struct with only metadata (name/id) and no rules.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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