MCPcopy Create free account
hub / github.com/vercel/vercel / getUnsafeStatsReason

Function getUnsafeStatsReason

packages/cli-exec/src/safety.ts:189–214  ·  view source on GitHub ↗
(stats: {
  mode: number;
  uid: number;
})

Source from the content-addressed store, hash-verified

187 * Reports unsafe ownership or write permissions from filesystem metadata.
188 */
189export function getUnsafeStatsReason(stats: {
190 mode: number;
191 uid: number;
192}): string | null {
193 const getuid = process.geteuid ?? process.getuid;
194
195 if (typeof getuid !== 'function') {
196 return null;
197 }
198
199 const uid = getuid();
200
201 if ((stats.mode & 0o022) !== 0) {
202 if ((stats.mode & 0o002) !== 0) {
203 return 'world-writable';
204 }
205
206 return 'group-writable';
207 }
208
209 if (stats.uid !== uid) {
210 return `owned by uid ${stats.uid}, current uid is ${uid}`;
211 }
212
213 return null;
214}

Callers 4

getUnsafeDirectoryReasonFunction · 0.85
getUnsafeFileReasonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected