Parse and validate SAST ruleset specifications for security scanning engines.
// Source: https://github.com/shivasurya/code-pathfinder | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package ruleset
import (
"fmt"
"regexp"
"strings"
)
// Rule ID pattern: starts with uppercase letters, followed by one or more dash-separated
// uppercase segments, ending with a dash and digits.
// Examples: DOCKER-BP-007, PYTHON-FLASK-SEC-003, PYTHON-LANG-SEC-001, COMPOSE-SEC-008.
var ruleIDPattern = regexp.MustCompile(`^[A-Z]+(-[A-Z]+)*-\d+[a-z]?$`)
// ParseSpec parses "docker/security" or "docker/all" into RulesetSpec.
// The "all" keyword is special and expands to all bundles in the category.
func ParseSpec(spec string) (*RulesetSpec, error) {
parts := strings.Split
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key