path-free: a shared build folder outside home is not a leak (only home and user-name paths are private)
This commit is contained in:
parent
efa9503a50
commit
0858f4e538
3 changed files with 11 additions and 1 deletions
|
|
@ -52,7 +52,11 @@ export interface PathHit { file: string; kind: string; offset: number }
|
|||
* checkout. DerivedData is no needle: outside the home folder it is not the user's (dsymutil and Xcode record it in the
|
||||
* dSYM and the __swift_ast section and no prefix map reaches it); inside the home folder the home needle finds it. */
|
||||
export function leakNeedles(i: { home: string; user: string; root: string }): { kind: string; value: string }[] {
|
||||
const list = [{ kind: 'home folder', value: trim(i.home) + '/' }, { kind: 'user folder', value: `/Users/${i.user}/` }, { kind: 'checkout', value: trim(i.root) + '/' }];
|
||||
// the checkout is a needle only when it says something about the person: inside the home folder or naming the user.
|
||||
// A shared build folder (/Users/Shared/..., /opt/...) recorded by dsymutil and Xcode's module cache is not private
|
||||
const root = trim(i.root) + '/';
|
||||
const personal = root.startsWith(trim(i.home) + '/') || (i.user.length >= 3 && root.includes(`/${i.user}/`));
|
||||
const list = [{ kind: 'home folder', value: trim(i.home) + '/' }, { kind: 'user folder', value: `/Users/${i.user}/` }, ...(personal ? [{ kind: 'checkout', value: root }] : [])];
|
||||
const seen = new Set<string>();
|
||||
return list.filter(n => n.value.length >= 6 && !seen.has(n.value) && seen.add(n.value));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue