Skip to main content

audit rules

Browse, enable, disable, and customize audit rules.

skillshare audit rules                          # Interactive TUI rule browser
skillshare audit rules --no-tui # Plain text table
skillshare audit rules --pattern credential-access # Filter by pattern
skillshare audit rules --severity high # Filter by severity
skillshare audit rules --disabled # Show only disabled rules
skillshare audit rules --format json # JSON output

skillshare audit rules disable prompt-injection-0 # Disable single rule
skillshare audit rules disable --pattern credential-access # Disable entire group
skillshare audit rules enable prompt-injection-0 # Re-enable rule
skillshare audit rules enable --pattern credential-access # Re-enable group

skillshare audit rules severity destructive-commands-2 medium # Downgrade one rule
skillshare audit rules severity --pattern destructive-commands low # Downgrade entire group
skillshare audit rules reset # Remove all custom rules, restore defaults

skillshare audit rules init # Create starter audit-rules.yaml
skillshare audit rules init -p # Create project-level rules file

Pattern-Level Rules​

You can disable or override entire pattern groups in audit-rules.yaml:

rules:
# Disable all credential-access rules
- pattern: credential-access
enabled: false

# But keep .env detection
- id: credential-access-env-file
enabled: true

# Downgrade all destructive-commands to MEDIUM
- pattern: destructive-commands
severity: MEDIUM

Pattern-level entries use pattern without id. Merge order: pattern-level rules apply first, then id-level rules can override individual entries within a disabled group.

Custom Rules​

You can add, override, or disable audit rules using YAML files. Rules are merged in order: built-in → global user → project user.

Use --init-rules (or audit rules init) to create a starter file with commented examples:

skillshare audit --init-rules         # Create global rules file
skillshare audit -p --init-rules # Create project rules file

File Locations​

ScopePath
Global~/.config/skillshare/audit-rules.yaml
Project.skillshare/audit-rules.yaml

Format​

rules:
# Add a new rule
- id: my-custom-rule
severity: HIGH
pattern: custom-check
message: "Custom pattern detected"
regex: 'DANGEROUS_PATTERN'

# Add a rule with an exclude (suppress matches on certain lines)
- id: url-check
severity: MEDIUM
pattern: url-usage
message: "External URL detected"
regex: 'https?://\S+'
exclude: 'https?://(localhost|127\.0\.0\.1)'

# Override an existing built-in rule (match by id)
- id: destructive-commands-2
severity: MEDIUM
pattern: destructive-commands
message: "Sudo usage (downgraded to MEDIUM)"
regex: '(?i)\bsudo\s+'

# Disable a built-in rule
- id: insecure-http-0
enabled: false

# Disable the dangling-link structural check
- id: dangling-link
enabled: false

Fields​

FieldRequiredDescription
idYesStable identifier. Matching IDs override built-in rules.
severityYes*CRITICAL, HIGH, MEDIUM, LOW, or INFO
patternYes*Rule category name (e.g., prompt-injection)
messageYes*Human-readable description shown in findings
regexYes*Regular expression to match against each line
confidenceNoConfidence between 0 and 1; defaults to 0.95
excludeNoIf a line matches both regex and exclude, the finding is suppressed
filesNoFile glob patterns that limit where the rule applies; see File Applicability.
enabledNoSet to false to disable a rule. Only id is required when disabling.

*Required unless enabled: false.

Merge Semantics​

Each layer (global, then project) is applied on top of the previous:

  • Same id + enabled: false → disables the rule
  • Same id + regex → replaces the entire rule; severity or confidence alone overrides that field
  • New id → appends as a custom rule
  • pattern only (no id) + enabled: false → disables all rules matching that pattern
  • pattern only + severity or confidence → overrides that field for all matching rules
  • Pattern then id → id-level entries can re-enable individual rules within a disabled pattern group

Practical Templates​

Use this as a starting point for real-world policy tuning:

rules:
# Downgrade hardcoded-secret to MEDIUM for educational/reference skills
- pattern: hardcoded-secret
severity: MEDIUM

# Override built-in suspicious-fetch with internal allowlist
- id: suspicious-fetch-0
severity: MEDIUM
pattern: suspicious-fetch
message: "External URL used in command context"
regex: '(?i)(curl|wget|invoke-webrequest|iwr)\s+https?://'
exclude: '(?i)https?://(localhost|127\.0\.0\.1|artifacts\.company\.internal|registry\.company\.internal)'

# Governance exception: disable noisy insecure-http signal
- id: insecure-http-0
enabled: false

Getting Started with init​

audit rules init (or audit --init-rules) creates a starter audit-rules.yaml with commented examples you can uncomment and adapt:

skillshare audit rules init          # → ~/.config/skillshare/audit-rules.yaml
skillshare audit rules init -p # → .skillshare/audit-rules.yaml

The generated file looks like this:

# Custom audit rules for skillshare.
# Rules are merged on top of built-in rules in order:
# built-in → global (~/.config/skillshare/audit-rules.yaml)
# → project (.skillshare/audit-rules.yaml)
#
# Each rule needs: id, severity, pattern, message, regex.
# Optional: exclude (suppress match), files (scope), enabled (false to disable).

rules:
# Example: flag TODO comments as informational
# - id: flag-todo
# severity: MEDIUM
# pattern: todo-comment
# message: "TODO comment found"
# regex: '(?i)\bTODO\b'

# Example: disable a built-in rule by id
# - id: insecure-http-0
# enabled: false

# Example: disable the dangling-link structural check
# - id: dangling-link
# enabled: false

# Example: override a built-in rule (match by id, change severity)
# - id: destructive-commands-2
# severity: MEDIUM
# pattern: destructive-commands
# message: "Sudo usage (downgraded)"
# regex: '(?i)\bsudo\s+'

If the file already exists, init exits with an error — it never overwrites existing rules.

Workflow: Fixing a False Positive​

A common reason to customize rules is when a legitimate skill triggers a built-in rule. Here's a step-by-step example:

1. Run audit and see the false positive:

$ skillshare audit ci-helper
Audit ~/.config/skillshare/skills
global · blocks at CRITICAL · policy DEFAULT / dedupe:GLOBAL / analyzers:ALL

HIGH Sudo escalation SKILL.md:42
destructive-commands-2 / static
"sudo apt-get install -y jq"

Risk HIGH 15/100
Auditable 100%

! ci-helper has findings below CRITICAL · 0.2s

2. Identify the rule ID from the built-in rules table:

The pattern destructive-commands with sudo matches rule destructive-commands-2.

3. Create a custom rules file (if you haven't already):

skillshare audit rules init

4. Add a rule override to suppress or downgrade:

# ~/.config/skillshare/audit-rules.yaml
rules:
# Downgrade sudo to MEDIUM for CI automation skills
- id: destructive-commands-2
severity: MEDIUM
pattern: destructive-commands
message: "Sudo usage (downgraded for CI automation)"
regex: '(?i)\bsudo\s+'

Or disable it entirely:

rules:
- id: destructive-commands-2
enabled: false

5. Re-run audit to confirm:

$ skillshare audit ci-helper
Audit ~/.config/skillshare/skills
global · blocks at CRITICAL · policy DEFAULT / dedupe:GLOBAL / analyzers:ALL

✓ No issues found in ci-helper · 0.1s # Now passes (or shows MEDIUM instead of HIGH)

Validate Changes​

After editing rules, re-run audit to verify:

skillshare audit                     # Check all skills
skillshare audit <name> # Check a specific skill
skillshare audit --json | jq '.skills[].findings' # Inspect findings programmatically

If a rules file cannot be read, parsed, or compiled (for example, an invalid regex), every scan that uses it reports a scan error naming the file, and audit exits 2. Installs are blocked until you fix the file.

Summary interpretation:

  • Failed counts skills with findings at or above the active threshold.
  • Warning counts skills with findings below threshold but above clean (for example HIGH/MEDIUM/LOW/INFO when threshold is CRITICAL).

Built-in Rule IDs​

Use id values to override or disable specific built-in rules:

Source of truth for regex-based rules: internal/audit/rules.yaml

The file-level whitespace-padding detector is also registered in rules.yaml. Its thresholds and exemptions are implemented in Go; configure its enabled state, severity or confidence without regex or exclude. See Whitespace Padding. Rules for this ID that set regex or exclude are rejected.

Structural, tier, and cross-skill checks

dangling-link, reference-escapes-root, reference-check-incomplete, content-tampered, content-oversize, content-missing, and content-unexpected are structural checks (filesystem lookups and hash comparisons, not regex). low-analyzability is an analyzability finding generated from the Analyzability Score. tier-stealth, tier-destructive-network, tier-network-heavy, tier-interpreter, and tier-interpreter-network are tier combination findings generated from Command Safety Tiering profiles. cross-skill-* findings are generated from Cross-Skill Interaction Detection. Header checks also generate disguised-executable, python-bytecode, executable-artifact, archive-artifact, and uncertain-header findings described in Executable and archive headers. All of these appear in the table below but are not defined in rules.yaml.

bundled-* rules are structured JSON checks under structure, registered for listing, disabling, and severity overrides. Their metadata regex never matches text; see bundled hooks and settings.

IDPatternSeverity
bundled-hook-commandbundled-hook-commandMEDIUM
bundled-network-commandbundled-network-commandHIGH
bundled-remote-postbundled-remote-postHIGH
bundled-permissionbundled-permissionHIGH
bundled-helper-commandbundled-helper-commandHIGH
bundled-config-unparsedbundled-config-unparsedINFO
prompt-injection-0prompt-injectionCRITICAL
prompt-injection-1prompt-injectionCRITICAL
prompt-injection-2prompt-injectionHIGH
prompt-injection-3prompt-injectionCRITICAL
prompt-injection-4prompt-injectionCRITICAL
prompt-injection-5prompt-injectionHIGH
hidden-unicode-1invisible-payloadCRITICAL
data-exfiltration-0data-exfiltrationCRITICAL
data-exfiltration-1data-exfiltrationCRITICAL
data-exfiltration-2data-exfiltrationMEDIUM
data-exfiltration-3data-exfiltrationHIGH
credential-access-ssh-private-keycredential-accessCRITICAL / HIGH (context)
credential-access-env-filecredential-accessCRITICAL / HIGH (context)
credential-access-aws-credentialscredential-accessCRITICAL / HIGH (context)
credential-access-etc-shadowcredential-accessCRITICAL / HIGH (context)
credential-access-git-credentialscredential-accessCRITICAL / HIGH (context)
credential-access-netrccredential-accessCRITICAL / HIGH (context)
credential-access-gnupgcredential-accessCRITICAL / HIGH (context)
credential-access-kube-configcredential-accessCRITICAL / HIGH (context)
credential-access-vault-tokencredential-accessCRITICAL / HIGH (context)
credential-access-terraform-credscredential-accessCRITICAL / HIGH (context)
credential-access-gnome-keyringcredential-accessCRITICAL / HIGH (context)
credential-access-npmrccredential-accessCRITICAL / HIGH (context)
credential-access-pypirccredential-accessCRITICAL / HIGH (context)
credential-access-gem-credentialscredential-accessCRITICAL / HIGH (context)
credential-access-ssl-privatecredential-accessCRITICAL / HIGH (context)
credential-access-ssh-host-keycredential-accessCRITICAL / HIGH (context)
credential-access-pgpasscredential-accessCRITICAL / HIGH (context)
credential-access-mysql-cnfcredential-accessCRITICAL / HIGH (context)
credential-access-etc-passwdcredential-accessMEDIUM
credential-access-azure-credscredential-accessHIGH
credential-access-gcloud-credscredential-accessHIGH
credential-access-docker-configcredential-accessHIGH
credential-access-gh-cli-tokencredential-accessHIGH
credential-access-password-storecredential-accessHIGH
credential-access-macos-keychain-usercredential-accessHIGH
credential-access-macos-keychain-syscredential-accessHIGH
credential-access-terraformrccredential-accessHIGH
credential-access-cargo-credentialscredential-accessHIGH
credential-access-op-clicredential-accessHIGH
credential-access-age-keyscredential-accessHIGH
credential-access-shell-historycredential-accessLOW
credential-access-openvpncredential-accessLOW
credential-access-auth-logcredential-accessINFO
credential-access-unknown-dotdircredential-accessINFO

Note: Each credential entry above also generates variant IDs per access method: -copy, -redirect, -dd, -exfil (e.g., credential-access-ssh-private-key-copy). To disable a specific variant, use its full ID in your audit-rules.yaml.

IDPatternSeverity
hidden-unicode-0hidden-unicodeHIGH
hidden-unicode-2hidden-unicodeHIGH
config-manipulation-0config-manipulationHIGH
anti-refusal-0anti-refusalHIGH
prompt-leakage-0prompt-leakageHIGH
memory-poisoning-0memory-poisoningHIGH
agent-snooping-0agent-snoopingHIGH
persistence-0persistenceHIGH
hidden-comment-injection-1hidden-comment-injectionHIGH
self-propagation-0self-propagationHIGH
destructive-commands-0destructive-commandsHIGH
destructive-commands-1destructive-commandsHIGH
destructive-commands-2destructive-commandsHIGH
destructive-commands-3destructive-commandsHIGH
destructive-commands-4destructive-commandsHIGH
dynamic-code-exec-0dynamic-code-execHIGH
dynamic-code-exec-1dynamic-code-execHIGH
shell-execution-0shell-executionHIGH
hidden-comment-injection-0hidden-comment-injectionHIGH
obfuscation-0obfuscationHIGH
fetch-with-pipe-0fetch-with-pipeHIGH
fetch-with-pipe-1fetch-with-pipeHIGH
fetch-with-pipe-2fetch-with-pipeHIGH
hardcoded-secret-0hardcoded-secretHIGH
hardcoded-secret-1hardcoded-secretHIGH
hardcoded-secret-2hardcoded-secretHIGH
hardcoded-secret-3hardcoded-secretHIGH
hardcoded-secret-4hardcoded-secretHIGH
hardcoded-secret-5hardcoded-secretHIGH
hardcoded-secret-6hardcoded-secretHIGH
hardcoded-secret-7hardcoded-secretHIGH
hardcoded-secret-8hardcoded-secretHIGH
hardcoded-secret-9hardcoded-secretHIGH
data-uri-0data-uriMEDIUM
escape-obfuscation-0escape-obfuscationMEDIUM
whitespace-paddingwhitespace-paddingMEDIUM (HIGH: ≥40 blank lines before nonblank text)
suspicious-fetch-0suspicious-fetchMEDIUM
ip-address-url-0ip-address-urlMEDIUM
hidden-unicode-3hidden-unicodeMEDIUM
untrusted-install-0untrusted-installMEDIUM
untrusted-install-1untrusted-installMEDIUM
insecure-http-0insecure-httpLOW
external-link-0external-linkLOW
dangling-linkdangling-linkLOW
reference-escapes-rootreference-escapes-rootHIGH
reference-check-incompletereference-check-incompleteLOW
content-tamperedcontent-tamperedMEDIUM
content-oversizecontent-oversizeMEDIUM
content-missingcontent-missingLOW
content-unexpectedcontent-unexpectedLOW
shell-chain-0shell-chainINFO
low-analyzabilitylow-analyzabilityINFO
tier-stealthtier-stealthCRITICAL
tier-destructive-networktier-destructive-networkHIGH
tier-network-heavytier-network-heavyMEDIUM
tier-interpretertier-interpreterINFO
tier-interpreter-networktier-interpreter-networkMEDIUM
cross-skill-exfiltrationcross-skill-exfiltrationHIGH
cross-skill-privilege-networkcross-skill-privilege-networkMEDIUM
cross-skill-stealthcross-skill-stealthHIGH
cross-skill-cred-interpretercross-skill-cred-interpreterMEDIUM
disguised-executabledisguised-executableHIGH
python-bytecodepython-bytecodeHIGH
executable-artifactexecutable-artifactMEDIUM
archive-artifactarchive-artifactINFO
uncertain-headeruncertain-headerINFO
ssrf-metadata-0ssrf-metadataCRITICAL / HIGH (context)
ssrf-internal-0ssrf-internalMEDIUM
ssrf-dynamic-0ssrf-dynamicMEDIUM
unsafe-deserialization-pythonunsafe-deserializationHIGH
unsafe-deserialization-yamlunsafe-deserializationHIGH
unsafe-deserialization-torchunsafe-deserializationHIGH
unsafe-deserialization-phpunsafe-deserializationHIGH
unsafe-deserialization-rubyunsafe-deserializationHIGH
unsafe-deserialization-jsunsafe-deserializationHIGH

In audit rules --format json, rules marked context above carry "severityContext": "python-inert" while they keep their built-in CRITICAL severity and regex. Setting a severity or replacing the regex removes it, because the downgrade no longer applies.

Subcommands​

SubcommandDescription
rulesBrowse, enable, and disable audit rules
rules disable <id>Disable a single rule by ID
rules disable --pattern <p>Disable all rules matching a pattern
rules enable <id>Re-enable a single rule by ID
rules enable --pattern <p>Re-enable all rules matching a pattern
rules severity <id> <level>Override severity for a single rule
rules severity --pattern <p> <level>Override severity for all rules in a pattern group
rules resetRemove all custom rules (restore built-in defaults)
rules initCreate a starter audit-rules.yaml (same as audit --init-rules)

See Also​

File Applicability​

The optional files list limits a rule to matching paths. It uses Go path.Match syntax (*, ?, character classes). A glob without /, such as *.py, matches a basename at any depth. A glob with /, such as scripts/*.php, matches the whole path relative to the scanned skill root; * does not cross /. Single-file scans use the basename; raw-content scans use the supplied filename. Matching is case-insensitive. This field filters files already admitted by the scanner; it does not collect additional file types.

Absolute paths, empty globs, empty/dot/parent path segments, backslashes, colons, malformed character classes, and recursive ** are rejected, including in disabled rules and unmatched overrides. Omitted files preserves inherited applicability; an explicit files: [] clears it. ID and pattern overrides support this field; ID overrides take precedence. A full regex replacement replaces the whole rule, including applicability and built-in call inspection. audit rules --format json includes the effective files list when nonempty.

rules:
- id: unsafe-deserialization-python
files: ['*.py', 'scripts/*.txt']