test(filesystem): probe actual permission denial before host assertions
This commit is contained in:
1 parent
63370e9300
commit
d0375a1ed0
7 files changed
+102
-20
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { requirePermissionDenial } from "../../../tests/fixtures/permissionDenial.js";
|
||||
import {
|
||||
appendFile,
|
||||
chmod,
|
||||
@@ -167,9 +168,10 @@ it("uses confirmed publication after the output owner's descriptor cleanup compl
|
||||
}
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"returns a tagged permission refusal for an existing read-only empty directory",
|
||||
async () => {
|
||||
async (context) => {
|
||||
await requirePermissionDenial(context, "directory-write");
|
||||
const root = await createTestTempDirectory("rea-bundle-readonly-");
|
||||
const files = await writeEnvironmentServeFiles(root);
|
||||
const inputs = await readEnvironmentExportInputs(
|
||||
@@ -200,9 +202,10 @@ it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
},
|
||||
);
|
||||
|
||||
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"names the nested path when write permission is lost after earlier files",
|
||||
async () => {
|
||||
async (context) => {
|
||||
await requirePermissionDenial(context, "directory-write");
|
||||
const root = await createTestTempDirectory("rea-bundle-later-denied-");
|
||||
const files = await writeEnvironmentServeFiles(root);
|
||||
const inputs = await readEnvironmentExportInputs(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { requirePermissionDenial } from "../../tests/fixtures/permissionDenial.js";
|
||||
import { createHash } from "node:crypto";
|
||||
import {
|
||||
access,
|
||||
@@ -129,9 +130,10 @@ const resolveHopperMachOImage = (
|
||||
resourceScope: inspectionResources.owner,
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"reports a FAT64 source that became unreadable as a host read denial",
|
||||
async () => {
|
||||
async (context) => {
|
||||
await requirePermissionDenial(context, "file-read");
|
||||
const directory = await createTestTempDirectory("rea-hopper-fat64-");
|
||||
const path = join(directory, "universal");
|
||||
await writeFile(path, Buffer.alloc(64));
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { requirePermissionDenial } from "../../tests/fixtures/permissionDenial.js";
|
||||
import { execFile } from "node:child_process";
|
||||
import { once } from "node:events";
|
||||
import {
|
||||
@@ -75,9 +76,10 @@ describe.skipIf(process.platform === "win32")(
|
||||
expect((await lstat(alias)).isSymbolicLink()).toBe(true);
|
||||
});
|
||||
|
||||
it.skipIf(process.getuid?.() === 0)(
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"explains unreadable directory recovery without changing unverified permissions",
|
||||
async () => {
|
||||
async (context) => {
|
||||
await requirePermissionDenial(context, "directory-read");
|
||||
const directory = await temporaryDirectory();
|
||||
await chmod(directory, 0o333);
|
||||
try {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { requirePermissionDenial } from "../../tests/fixtures/permissionDenial.js";
|
||||
import { chmod, mkdir, readdir, realpath, rm, symlink } from "node:fs/promises";
|
||||
import { dirname, join } from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
@@ -93,9 +94,10 @@ describe("IDA workspace ownership before input preparation", () => {
|
||||
expect(await readdir(root)).toEqual([]);
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"preserves the input identity failure and retries workspace removal after permission recovery",
|
||||
async () => {
|
||||
async (context) => {
|
||||
await requirePermissionDenial(context, "directory-write");
|
||||
const { root, target } = await createIdaTarget();
|
||||
roots.push(root);
|
||||
const { client, producer } = clientFor(root, {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { requirePermissionDenial } from "../../../tests/fixtures/permissionDenial.js";
|
||||
import {
|
||||
chmod,
|
||||
mkdir,
|
||||
@@ -104,9 +105,10 @@ it("distinguishes unavailable content hashes from completed path enumeration", a
|
||||
).toMatchObject({ status: "deleted", before: { sha256: null }, after: null });
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"retains readable entries and marks an unreadable directory subtree unknown",
|
||||
async () => {
|
||||
async (context) => {
|
||||
await requirePermissionDenial(context, "directory-read");
|
||||
const root = await createTestTempDirectory("rea-fs-unreadable-directory-");
|
||||
const visible = join(root, "a-visible.txt");
|
||||
const blocked = join(root, "z-blocked");
|
||||
@@ -143,9 +145,10 @@ it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
},
|
||||
);
|
||||
|
||||
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"retains unreadable-file and sibling observations in a complete snapshot",
|
||||
async () => {
|
||||
async (context) => {
|
||||
await requirePermissionDenial(context, "file-read");
|
||||
const root = await createTestTempDirectory("rea-fs-unreadable-file-");
|
||||
const unreadable = join(root, "unreadable.txt");
|
||||
const readable = join(root, "readable.txt");
|
||||
@@ -398,9 +401,10 @@ it("preserves creation when the selected root was observed missing before captur
|
||||
]);
|
||||
});
|
||||
|
||||
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"rejects only selected roots that cannot be admitted before launch",
|
||||
async () => {
|
||||
async (context) => {
|
||||
await requirePermissionDenial(context, "directory-search");
|
||||
const root = await createTestTempDirectory("rea-fs-root-admission-");
|
||||
await writeFile(join(root, "file"), "regular file");
|
||||
await mkdir(join(root, "denied"));
|
||||
@@ -466,9 +470,10 @@ it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
},
|
||||
);
|
||||
|
||||
it.skipIf(process.platform === "win32" || process.getuid?.() === 0)(
|
||||
it.skipIf(process.platform === "win32")(
|
||||
"records an unsearchable directory's children as omitted rather than failing",
|
||||
async () => {
|
||||
async (context) => {
|
||||
await requirePermissionDenial(context, "directory-search");
|
||||
const root = await createTestTempDirectory("rea-fs-unsearchable-");
|
||||
const listed = join(root, "listed");
|
||||
await mkdir(listed);
|
||||
|
||||
Reference in new issue
Block a user