Help reading line from Firefox prefs.js file

There’s likely a pretty simple solution to this, but it eludes me so far, so I’m appealing to those with more experience writing relevance statements.

I would like to see if the string “app.update.enabled” exists in the prefs.js file for Firefox. The file is located in “c:\Users<username>\Appdata\Roaming\Mozilla\Firefox\Profiles\xxxxxxxxx.default”

Both the and the xxxxxxx.default are unique from system to system. %Appdata% is an environment variable that contains the path

"c:\Users<username>\Appdata\Roaming\ so that would probably be the best way to set start of the path and take care of the first variable.

The closest I’ve got to even verifying the file is in place is

q: exists file “prefs.js” of folders of folders of folders of folders of folders of folders of folders "\Users"
A: True
T: 508.806 ms
I: singular boolean
which is, of course, a woefully sloppy way to hunt through subfolders.

My second try to verify the file is in place is

q: exists file “prefs.js” of folders of folders “Mozilla\Firefox\Profiles” of folder (value of variable “AppData” of environment)
A: False
T: 0.277 ms
I: singular boolean
Much cleaner, but returns incorrect results.

Once I can actually verify the file exists, I’ll work then on seeing if it contains the string I’m looking for. Any time or consideration regarding this is appreciated.

You’ll have a problem using %APPDATA%, because the BigFix client is running in the environment of SYSTEM, not the environment of the logged-on user. There are ways to query values out of the profiles of logged-on users, but it is considerably more difficult and a Fixlet would only correct one user at a time.

When tackling something like this, I generally like to hit all of the existing user profiles at once. You can locate them via

q: values "ProfileImagePath" of keys of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" of native registry as string
A: %25systemroot%25\system32\config\systemprofile%00
A: C:\Windows\ServiceProfiles\LocalService%00
A: C:\Windows\ServiceProfiles\NetworkService%00
A: C:\Users\Jason%00
A: C:\Users\Holden%00
A: C:\Users\UpdatusUser%00
T: 0.182 ms
I: plural string

q: pathnames of folders(values "ProfileImagePath" of keys of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" of native registry as string)
A: C:\Windows\ServiceProfiles\LocalService
A: C:\Windows\ServiceProfiles\NetworkService
A: C:\Users\Jason
A: C:\Users\Holden

Find the FireFox prefs.js for each of them -

q: pathnames of folders whose (exists file "prefs.js" of it) of folders "AppData\Roaming\Mozilla\Firefox\Profiles" of folders(values "ProfileImagePath" of keys of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" of native registry as string)
A: C:\Users\Jason\AppData\Roaming\Mozilla\Firefox\Profiles\test1234.default
T: 0.846 ms
I: plural string

I end up with this relevance check:

    q: exists files "prefs.js" whose (not exists lines whose (it as trimmed string as lowercase = "app.update.enabled") of it) of folders of folders "AppData\Roaming\Mozilla\Firefox\Profiles" of folders(values "ProfileImagePath" of keys of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" of native registry as string)
A: True

…and, while you’re at it, I’m pretty sure you can enforce a setting using mozilla.cfg in the FireFox installation directory, with the “pref” and “lockpref” qualifiers. I used that to disable SSLv3 to workaround POODLE before Mozilla made it a default. Have a look at http://bigfix.me/fixlet/details/3915 and see if it helps.

1 Like

@JasonWalker is right. There is no need to check this setting in all user’s profiles. You should instead enforce the setting to be in the desired state for all users using a config file.

See my example here: FireFox Configuration - Disable Active Mixed Content Blocking - Windows

Thank you so much for this Jason. I hadn’t considered that the profile being used would differ from the regular user profile, but that makes total sense.

I’ll be looking further into going the .cfg file route, as that seems a much better way of handling it. Again, thanks so much.

Michael

Thanks jgstew. I’ll be going over the example you provided.

Michael

Good luck. That relevance is a bit hard to follow and since I wrote it so long ago, I definitely have ideas on how to make it simpler.