For #25479 # Checklist for submitter - [X] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files) for more information. - [X] Manual QA for all new/changed functionality ## Details This PR fixes the `privacy_preferences` table results generator for the Chrome Extension. The root cause was that we were attempting to return boolean values directly to sqlite, which doesn't have a native boolean type. The fix is to coerce booleans to "1" or "0" as we do for other tables in the extension. The _proximate_ cause of the issue was that the warnings generated at the db level (in this case about not being able to handle the `null` values that sqlite was coercing booleans to) are not being handled correctly. I'll tackle this in a separate PR as it's a little more complicated to debug and fix. ## Testing On a Chromebook, was able to run a live `select * from privacy_preferences` query with results: <img width="1706" alt="image" src="https://github.com/user-attachments/assets/7dcc4410-70fd-4381-842d-fd06d43b94ae" /> <img width="1708" alt="image" src="https://github.com/user-attachments/assets/db783e7b-3351-424c-82e3-b7e80c1d999d" /> Added automated test that fails on main and passes on this branch. |
||
|---|---|---|
| .. | ||
| changes | ||
| src | ||
| .gitignore | ||
| CHANGELOG.md | ||
| jest.config.ts | ||
| jest.setup.ts | ||
| jsdomwithfetch.ts | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| server.go | ||
| tsconfig.json | ||
| updates-beta.xml | ||
| updates.xml | ||
| webpack.common.js | ||
| webpack.dev.js | ||
| webpack.prod.js | ||
Fleetd Chrome Extension
Packaging the extension locally
Generate a .pem file to be the key for the chrome extension.
(In parent dir) Run the following command to generate an extension.
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --pack-extension=./fleetd-chrome --pack-extension-key=path/to/chrome.pem
Adding Chrome to Fleet
To learn how to package and add hosts to Fleet, visit: https://fleetdm.com/docs/using-fleet/enroll-hosts#enroll-chromebooks.
Debugging
Service worker
View service worker logs in chrome://serviceworker-internals/?devtools (in production), or in chrome://extensions (only during development).
Manual Enroll
Steps 1 and 2 can be performed on your workstation. Step 3 and 4 are to be executed on the target Chromebook.
- Create your .env file:
IMPORTANT: The address in
FLEET_URLmust have a valid TLS certificate.
echo 'FLEET_URL="https://your-fleet-server.example.com"' >> .env
echo 'FLEET_ENROLL_SECRET="<your enroll secret>"' >> .env
To test with your local Fleet server, you can use Tunnelmole or ngrok.
Tunnelmole:
tmole 8080
ngrok:
ngrok http https://localhost:8080
- Build the "unpacked extension":
npm install && npm run build
The above command will generate an unpacked extension in ./dist.
-
Send the
./distfolder to the target Chromebook. -
In the target Chromebook, go to
chrome://extensions, toggleDeveloper modeand click onLoad unpackedand select thedistfolder.
Testing
Run tests
npm run test
Release
- At the top of the repo, update CHANGELOG.md by running
version="X.X.X" make changelog-chrome - Review CHANGELOG.md
- At
ee/fleetd-chrome, runnpm version X.X.Xto update the version inpackage.jsonandpackage-lock.json - Commit the changes and tag the commit with
fleetd-chrome-vX.X.X-beta. This will trigger the beta release workflow. - Once the beta release is tested and PR merged, tag the commit with
fleetd-chrome-vX.X.X. This will trigger the release workflow. - Announce the release in the #help-engineering channel in Slack.
Using GitHub Actions, the build is automatically uploaded to R2 and properly configured clients should be able to update immediately when the job completes. Note that automatic updates seem to only happen about once a day in Chrome -- Hit the "Update" button in chrome://extensions to trigger the update manually.
Beta releases
Beta releases are pushed to https://chrome-beta.fleetdm.com/updates.xml with the extension ID bfleegjcoffelppfmadimianphbcdjkb.
Kick off a beta release by updating the package.json, then tag a commit with fleetd-chrome-vX.X.X-beta to kick off the build and deploy.