Commit graph

29 commits

Author SHA1 Message Date
Eric
4101aa4b36
Website: Add note about using req.body in android proxy endpoints (#41186)
Closes: https://github.com/fleetdm/fleet/issues/39688

Changes:
- Added a note to android proxy endpoints that forward `req.body` to the
Android management API.
2026-03-06 18:06:25 -06:00
Martin Angers
53c48dea51
Website: implement android proxy endpoint for create webapp (#40059) 2026-03-03 08:23:19 -05:00
Eric
274abc6cb0
Website: update android proxy error handling (#40140)
Related to: https://github.com/fleetdm/fleet/issues/40127

Changes:
- Updated errors logged by Android proxy endpoints to include more
information about the error.
- Added a `deviceNoLongerManaged` exit to the `delete-android-device`
endpoint that is used when the Google API returns a "Device is no longer
being managed" error.
- Added a `policyNotFound` exit to the `modify-android-policies` and
`modify-enterprise-app-policy` endpoints that is used when the Google
API returns a 404 response
- Added a `invalidPolicyName` exit to the `modify-android-device`
endpoint that is used when the Google API returns an error related to
the policy name sent in the request body.
2026-02-19 17:46:41 -06:00
Martin Angers
81b5d7b04e
Website: return 404 if Android enterprise application is not found (#39935) 2026-02-16 15:14:29 -05:00
Martin Angers
c2a2b0d62a
Website: add remove enterprise apps Android proxy endpoint (#39633) 2026-02-16 13:17:31 -05:00
Eric
9dd7419e12
Website: Update android proxy get-enterprise-applications endpoint (#38972)
Changes:
- Updated the `get-enterprise-applications` Android proxy endpoint to
use the `enterprises.applications.get` method (It is currently using the
enterprises.devices.get` method)
- Updated errors returned by the `get-enterprise-applications` endpoint
to include more information from the error returned by Google.
2026-02-09 17:25:56 -06:00
Jahziel Villasana-Espinoza
670f7dbdb5
fail gracefully when profile is invalid (#38899)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #35211 

# Checklist for submitter

- [x] QA'd all new/changed functionality manually
2026-01-28 10:57:27 -05:00
Eric
5e68cf223e
Website: add missing exit to get-android-devices (#37490)
Changes:
- Added a missing `notFound` exit to the `get-android-devices` action
used by the website's Android Enterprise proxy.
2025-12-18 12:10:57 -06:00
Magnus Jensen
237105728e
Reduce API Android usage (#36209)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #36138 

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [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/guides/committing-changes.md#changes-files)
for more information.

## Testing

- [x] Added/updated automated tests
- [x] QA'd all new/changed functionality manually

---------

Co-authored-by: Jordan Montgomery <elijah.jordan.montgomery@gmail.com>
2025-11-25 09:39:06 -03:00
Jahziel Villasana-Espinoza
ff0ba413b7
Android app self service: backend support (#34711)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #34389

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)

## Testing

- [x] Added/updated automated tests
- [x] Where appropriate, [automated tests simulate multiple hosts and
test for host
isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing)
(updates to one hosts's records do not affect another)
- [x] QA'd all new/changed functionality manually

## Database migrations

- [x] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [x] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
2025-11-13 18:10:24 -05:00
Eric
b2151decda
Website: Add API rate limit alert to Android proxy endpoints (#35637)
Closes: https://github.com/fleetdm/fleet/issues/34358

Changes:
- Updated Android enterprise proxy endpoints to log an additional
warning to alert us if we exceed the Android management API rate limit.
2025-11-12 15:37:21 -06:00
Magnus Jensen
7e46d63db8
Android Proxy: Pass authClient to all calls (#35456)
This is another attempt at debugging/solving the current android proxy
bug.

This tries to not use the global google options, and instead just passes
the authClient directly to all google calls.

The other PR with wait, did initially succeed for me, but then failed
right after.
2025-11-11 09:29:18 -03:00
Magnus Jensen
a3170ad8d9
Android Proxy: Wait 1 second + add back retry with big delays (#35449)
Another debugging attempt, at the Android Proxy create enterprise bug.
2025-11-10 17:19:04 -03:00
Magnus Jensen
da27c3f08b
Android Proxy: debug token scopes for android enterprise creation (#35237)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Attempt at debugging #34776 

Another attempt to further debug this issue. This attempt tries to
verify that the scopes for the token is correct, and is not overriden by
another call to the scopes.

The reason is that the `www-authenticate` response header is saying
`error="insufficient_scope"`
2025-11-06 11:14:42 -03:00
Magnus Jensen
c1428f4a98
Remove sails flow.build around getIamPolicy call (#35225)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Attempt at solving #34776 

This was verified by extracting the create topic, and getIamPolicy, and
without the flow.build it worked fine, but when added it started
failing.
2025-11-05 15:54:57 -03:00
Jordan Montgomery
4bedbca6c2
Add a bit of time to the Android proxy creation retry (#35174)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #34776 

Adds delay to subsequent retries on creation of Android enterprise

---------

Co-authored-by: Eric <eashaw@sailsjs.com>
2025-11-05 09:13:13 -05:00
Eric
1e6b45acdc
Website: retry getIamPolicy and setIamPolicy methods in create-android-enterprise (#35165)
Related to: https://github.com/fleetdm/fleet/issues/34776

Changes:
- Updated the create-android-enterprise endpoint to retry the
getIamPolicy and setIamPolicy methods when creating a new android
enterprise.
2025-11-04 14:55:35 -05:00
Magnus Jensen
50c15bd999
add warn log statement to get the error of a 400 if it's not an invalid token error (#35054)
This PR adds a small log warn statement to the fleetdm proxy for a 400
error on creating enterprise that is not an invalid token.

See this slack thread about the issue, and missing error log to further
debug the issue, unless running it locally, and then it is sometimes not
reproducable.
2025-10-31 12:52:39 -03:00
Jordan Montgomery
e5589bc030
Return a 404 for device not found instead of 5XX (#34988)
Haven't fully QA'd as I am not sure how to repro locally(when I test the
pubsub arrives before we ever run the reconciler) however this should
cause 4xx to be returned from the website instead of 5xx for android
unenrolled. We use the exact same code on a different endpoint

<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #34988 partially. This just helps reduce
alerts to help-p1 and implements the interface that the server is
expecting
2025-10-30 09:17:12 -04:00
Jordan Montgomery
abaf15ff51
Do not return MDM=off android hosts from reconciler (#34304)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #34299 

Unreleased bug in Android Config profiles 4.75.0 feature. No changes
file as such. I'm not entirely sure how to cause this as I was unable to
repro it locally, there may be a timing issue or something, so I haven't
fully QA'd manually. QA was limited to verifying basic reconciler
functionality

Also updated Website endpoint to not throw a 5XX since we expect this to
occasionally happen

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [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/guides/committing-changes.md#changes-files)
for more information.

- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] If paths of existing endpoints are modified without backwards
compatibility, checked the frontend/CLI for any necessary changes

## Testing

- [x] Added/updated automated tests
- [x] Where appropriate, [automated tests simulate multiple hosts and
test for host
isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing)
(updates to one hosts's records do not affect another)

- [ ] QA'd all new/changed functionality manually

For unreleased bug fixes in a release candidate, one of:

- [x] Confirmed that the fix is not expected to adversely impact load
test results
2025-10-16 09:59:17 -04:00
Eric
1799c824b1
Website: Update Android proxy endpoints exits (#34135)
Changes:
- Updated the website's Android proxy endpoints to use action2 exit
signals.
2025-10-10 17:11:42 -05:00
Carlo
0ade43e798
Add proxy endpoints for Android (#34021)
Fixes #34018. Adds endpoints for `GET`, `DELETE`, and `PATCH` operations for Android hosts.
2025-10-09 08:17:48 -04:00
Eric
292c23497f
Website: Update Android Proxy endpoints to return 404 responses if an Android Enterprise are not managed by Fleet (#33816)
Related to: https://github.com/fleetdm/fleet/issues/33266

Changes:
- Added a new helper
`sails.helpers.androidProxy.getIsEnterpriseManagedByFleet`. This helper
returns `true` if a provided Android Enterprise ID is present in the
list of all Android Enterprises managed by Fleet, or `false` if it is
not in the list.
- Updated `create-android-enrollment-token`,
`create-android-signup-url`, and `modify-android-policies` to return a
404 response to the requesting Fleet instance if their Android
Enterprise is not managed by Fleet.
2025-10-06 12:50:42 -05:00
Carlo
f6cc722223
pass serverUrl, improve error handling (#32897)
Fixes #32893. Adds `serverUrl` to client implementations for LIST. Improves error handling to prevent aggressive deletion of enterprises.
2025-09-12 17:01:18 -04:00
Carlo
1ebf13219a
Pass along particular 4xx errors from Google (#32817)
Fixes #32703. Intercept and pass along some 4xx errors from Google.
2025-09-11 11:57:29 -04:00
Carlo
3b01f6f529
Handle deleted Android Enterprise (#32267)
Implements #26868; adds `EnterpriseLIST` method to Android Management API client
interface

Co-authored-by: Eric <eashaw@sailsjs.com>
2025-09-04 08:17:37 -04:00
Eric
9438cf1346
Website: Update create-android-enterprise exits (#31538)
Closes: https://github.com/fleetdm/fleet/issues/31506

Changes:
- Updated the `create-android-enterprise` action to return a 409
response if a database record already exists for the Android enterprise.
2025-08-01 16:12:39 -05:00
Eric
e0c1929e4b
Website: Update create-android-signup-url error handling (#30956)
Closes #30935

Changes:
- Updated created-android-signup-url to return a bad request response if
a provided callback URL cannot be used to create an Android Enterprise
signup URL.
2025-07-16 14:44:19 -05:00
Eric
4272df375a
Website: Add android proxy endpoints (#28267)
Related to: https://github.com/fleetdm/fleet/issues/26270

Changes:
- Added a new database model: `AndroidEnterprise`
- Added one new website dependency: `googleapis@148.0.0`
- Added `android-proxy/create-android-signup-url`: an endpoint that
returns a signup url used to grant access to Fleet's Android MDM
integration.
- Added `android-proxy/create-android-enterprise`: An endpoint that
creates an Android enterprise for a Fleet server
- Added `android-proxy/create-android-enrollment-token`: An endpoint
that returns an enrollment token for an Android enterprise
- Added `android-proxy/modify-android-policies`: An endpoint used to
update policies of an Android enterprise
- Added `android-proxy/delete-one-android-enterprise`: an endpoint that
deletes an Android enterprise

---------

Co-authored-by: Victor Lyuboslavsky <victor@fleetdm.com>
2025-06-12 13:23:49 -05:00