Problem
We keep re-discovering policy-level mistakes that compile and often pass tests:
- Writing or parsing secret material outside approved secret handlers
- Probing provider configs with only API keys, missing OAuth token fallback
- Descriptor/auth metadata drift (feature advertised but not fully configured)
These are good candidates for static enforcement via internal analyzers (WASDN).
Proposal
Add an internal analyzer package/ruleset for Netclaw that enforces security/config invariants at compile time.
Candidate rules
-
No direct secrets file writes
- Disallow
File.Write* to paths resolving to secrets.json
- Require
SecretsFileWriter / ConfigFileHelper.WriteSecretsFile / approved APIs
-
No raw secret serialization paths
- Flag direct serialization/writes of secret-bearing values (
SensitiveString, provider secret nodes) outside approved handlers
-
Encrypted secret parse must decrypt first
- Flag parsing of secret JSON string fields when decryption helper/protector is not applied first
-
Provider probe credential fallback
- For
ProviderEntry probe callsites, require credential expression equivalent to ApiKey ?? OAuthAccessToken
-
OAuth capability metadata consistency
- If descriptor supports
AuthMethod.OAuthDevice, require non-null OAuth endpoint/client metadata (or explicit opt-out attribute for TBD providers)
Scope / non-goals
- Not blocking current PRs immediately; can start as warning then ratchet to error
- Keep false positives low with explicit allowlist/attributes for intentional exceptions
Deliverables
Acceptance criteria
- New violations fail CI (after rollout gate)
- Existing codebase either clean or baseline documented
- At least one autofix or code-action where practical
Problem
We keep re-discovering policy-level mistakes that compile and often pass tests:
These are good candidates for static enforcement via internal analyzers (WASDN).
Proposal
Add an internal analyzer package/ruleset for Netclaw that enforces security/config invariants at compile time.
Candidate rules
No direct secrets file writes
File.Write*to paths resolving tosecrets.jsonSecretsFileWriter/ConfigFileHelper.WriteSecretsFile/ approved APIsNo raw secret serialization paths
SensitiveString, provider secret nodes) outside approved handlersEncrypted secret parse must decrypt first
Provider probe credential fallback
ProviderEntryprobe callsites, require credential expression equivalent toApiKey ?? OAuthAccessTokenOAuth capability metadata consistency
AuthMethod.OAuthDevice, require non-null OAuth endpoint/client metadata (or explicit opt-out attribute for TBD providers)Scope / non-goals
Deliverables
.editorconfigseverity policyAcceptance criteria