Bug 1926997: New profile directories should not be world readable. r=profiles-reviewers,jhirsch
Differential Revision: https://phabricator.services.mozilla.com/D241597
This commit is contained in:
@@ -976,13 +976,19 @@ class SelectableProfileServiceClass extends EventEmitter {
|
||||
PathUtils.join(
|
||||
SelectableProfileServiceClass.getDirectory("DefProfRt").path,
|
||||
profileDir
|
||||
)
|
||||
),
|
||||
{
|
||||
permissions: 0o700,
|
||||
}
|
||||
),
|
||||
IOUtils.makeDirectory(
|
||||
PathUtils.join(
|
||||
SelectableProfileServiceClass.getDirectory("DefProfLRt").path,
|
||||
profileDir
|
||||
)
|
||||
),
|
||||
{
|
||||
permissions: 0o700,
|
||||
}
|
||||
),
|
||||
]);
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ const { MockRegistrar } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/MockRegistrar.sys.mjs"
|
||||
);
|
||||
|
||||
// Windows doesn't support the normal permissions and always creates and returns as 0666.
|
||||
const EXPECTED_PERMISSIONS = AppConstants.platform == "win" ? 0o666 : 0o700;
|
||||
|
||||
const badgingService = {
|
||||
isRegistered: false,
|
||||
badge: null,
|
||||
@@ -172,6 +175,17 @@ add_task(async function test_SelectableProfileLifecycle() {
|
||||
"Profile local dir was successfully created"
|
||||
);
|
||||
|
||||
Assert.equal(
|
||||
(await IOUtils.stat(profilePath)).permissions,
|
||||
EXPECTED_PERMISSIONS,
|
||||
"Profile dir should have the correct permissions"
|
||||
);
|
||||
Assert.equal(
|
||||
(await IOUtils.stat(profileLocalPath)).permissions,
|
||||
EXPECTED_PERMISSIONS,
|
||||
"Profile local dir should have the correct permissions"
|
||||
);
|
||||
|
||||
let times = PathUtils.join(rootDir.path, "times.json");
|
||||
Assert.ok(await IOUtils.exists(times), "times.json should exist");
|
||||
let json = await IOUtils.readJSON(times);
|
||||
|
||||
Reference in New Issue
Block a user