scan.ignore: optional match on the finding title, to accept one check of a rule with several (e.g. the ALL CAPS title in play-metadata)

This commit is contained in:
CRTkafa 2026-10-11 18:08:11 +00:00
parent dc52eaa923
commit 43daeef97f
6 changed files with 12 additions and 7 deletions

View file

@ -132,7 +132,7 @@ code imply, each marked **detected (file:line)** or **ask owner**, as a diff aga
the config. Nothing is written unless you run `storebound scan --write` (only detected answers; questions stay
questions). The MCP tool `scan` is read-only and cannot write; `validate` includes the open scan findings; the desktop
app shows them on the Checks tab. A finding you decided is fine goes into the config with its reason:
`scan: { ignore: [{ rule: 'demo-account', reason: '...' }] }`.
`scan: { ignore: [{ rule: 'demo-account', reason: '...' }] }`; a rule with several checks (e.g. `play-metadata`) takes `match: '<text in the finding title>'` to accept just one of them.
| rule | App Store | Google Play | what scan proves |
|---|---|---|---|

View file

@ -537,7 +537,7 @@ export interface ShipConfig {
* them in App Store Connect). `storebound scan` proposes them from the detected SDKs and code. */
appPrivacy?: AppPrivacyConfig;
/** `storebound scan`: findings the owner has looked at and accepts, by rule id (with the reason, shown in the report). */
scan?: { ignore?: { rule: string; store?: 'apple' | 'play'; reason: string }[] };
scan?: { ignore?: { rule: string; store?: 'apple' | 'play'; /** Only findings whose title contains this text (one check of a rule that has several). */ match?: string; reason: string }[] };
/** Ads: `validate` checks that <app.website>/app-ads.txt is reachable and contains every line listed here. */
ads?: { appAdsTxt?: string[] };
/** Rendered store graphics dir (<renders>/<languageId>/<size>/NN.png|jpg). Defaults to shots.out. */
@ -766,8 +766,8 @@ export function validateConfig(c: unknown): string[] {
e.push('appPrivacy.trackingDomains: a list of host names');
}
for (const [i, x] of (cfg.scan?.ignore ?? []).entries())
if (!x || typeof x.rule !== 'string' || !x.rule || typeof x.reason !== 'string' || !x.reason.trim() || (x.store !== undefined && x.store !== 'apple' && x.store !== 'play'))
e.push(`scan.ignore[${i}]: { rule: '<rule id from storebound scan>', reason: 'why this is fine', store?: 'apple' | 'play' }`);
if (!x || typeof x.rule !== 'string' || !x.rule || typeof x.reason !== 'string' || !x.reason.trim() || (x.store !== undefined && x.store !== 'apple' && x.store !== 'play') || (x.match !== undefined && (typeof x.match !== 'string' || !x.match.trim())))
e.push(`scan.ignore[${i}]: { rule: '<rule id from storebound scan>', reason: 'why this is fine', store?: 'apple' | 'play', match?: '<text in the finding title>' }`);
if (cfg.ads?.appAdsTxt && !cfg.ads.appAdsTxt.every(l => typeof l === 'string' && l.split(',').length >= 3))
e.push('ads.appAdsTxt: lines like "example-network.com, pub-123, DIRECT, abc123"');
const seen = new Set<string>();

View file

@ -149,7 +149,7 @@ export function addOriginality(r: ScanReport, o: OriginalityReport, stores: { ap
if (stores.play) r.findings.push({ ...base, guideline: 'Play: Repetitive content', store: 'play', ref: 'https://support.google.com/googleplay/android-developer/answer/9898783' });
}
for (const f of r.findings) if (f.rule === 'originality' && !f.accepted) {
const hit = ignore.find(i => i.rule === f.rule && (!i.store || i.store === f.store));
const hit = ignore.find(i => i.rule === f.rule && (!i.store || i.store === f.store) && (!i.match || f.title.toLowerCase().includes(i.match.toLowerCase())));
if (hit) f.accepted = hit.reason;
}
r.findings = sortScan(r.findings);

View file

@ -516,7 +516,7 @@ export function scanRules(inp: ScanInput): ScanFinding[] {
// ---- owner-accepted findings ----
const ignore = c?.scan?.ignore ?? [];
for (const f of out) {
const hit = ignore.find(i => i.rule === f.rule && (!i.store || i.store === f.store));
const hit = ignore.find(i => i.rule === f.rule && (!i.store || i.store === f.store) && (!i.match || f.title.toLowerCase().includes(i.match.toLowerCase())));
if (hit) f.accepted = hit.reason;
}
return sortScan(out);

View file

@ -17,7 +17,7 @@ the stores; run them freely.
Privacy / ATT / privacy manifest proposal, each item "detected (file:line)" or "ask owner", as a diff against the
config. Exit 1 on an open blocker. `--write` adds only the detected answers to the config (show the diff and ask
the owner first; MCP never writes). `--store apple|play`, `--json`. A finding the owner accepts goes into
`scan.ignore: [{ rule, reason }]`; never add one without the owner's reason. The Play rules also read
`scan.ignore: [{ rule, reason, match? }]` (`match` = text in the finding title, to accept one check of a rule with several); never add one without the owner's reason. The Play rules also read
`play.targetAges` (Families), `play.accountType` / `play.accountCreated` (closed-testing requirement) and
`play.billingPrograms` (payments): ask the owner for them, never guess.
1. `storebound check`: config, both listing files (limits are checked locally: title 30, subtitle 30, keywords 100

View file

@ -240,6 +240,11 @@ describe('Google Play rules', () => {
const soft = await scanVariant('play-listing', { 'store/listing.md': s => s.replace('🔥 #1 Best Free Photo Saver App Pro', 'Free Photo Saver') });
expect(soft.findings.filter(f => f.rule === 'play-metadata' && f.title.includes('Free Photo Saver')).map(f => f.severity)).toEqual(['low']);
expect(rules(await scan('ios-native').then(x => x.findings), 'play').size).toBe(0);
// scan.ignore with match: accepts the ALL CAPS check of play-metadata only, the other metadata checks stay open
const caps = await scanVariant('play-listing', { 'storebound.config.ts': s => s.replace(/\n(\s*)app: \{/, "\n$1scan: { ignore: [{ rule: 'play-metadata', match: 'ALL CAPS', reason: 'brand name' }] },\n$1app: {") });
const md = caps.findings.filter(f => f.rule === 'play-metadata');
expect(md.find(f => f.title.includes('ALL CAPS'))!.accepted).toBe('brand name');
expect(md.filter(f => !f.title.includes('ALL CAPS')).every(f => !f.accepted)).toBe(true);
});
test('the policy tables cite their sources', () => {
for (const u of Object.values(PLAY_REFS)) expect(u).toMatch(/^https:\/\//);