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

@ -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);