Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ AI_MODEL=qwen3:8b
# default is generous.
# AI_TIMEOUT_MS=300000

# ─── Container user ────────────────────────────────────────────────────────────
# The user Swoop runs as inside the container. The container fixes ownership of
# its data folder to this user on every start, so upgrades cannot leave the
# database unwritable. Unraid: PUID=99 PGID=100. Most Linux hosts: 1000/1000.
# PUID=1000
# PGID=1000

# ─── Server ────────────────────────────────────────────────────────────────────
PORT=3000
NODE_ENV=production
Expand All @@ -72,3 +79,13 @@ NODE_ENV=production
# Overrides the SuperOps API endpoint. Leave unset to pick it from the tenant's
# configured data centre. Useful for an egress proxy, or a local mock.
# SUPEROPS_API_URL=

# Entra ID authority for CIPP API tokens. Only change it for a sovereign cloud
# (e.g. https://login.microsoftonline.us) or a local mock.
# CIPP_AUTHORITY_URL=https://login.microsoftonline.com

# ─── Safety ────────────────────────────────────────────────────────────────────
# Set to 1 to stop Swoop changing any client's Microsoft 365 tenant, whatever
# Settings → Execution says. Triage, lookups, plans and approvals still work;
# dry runs and live runs are refused, so CIPP only ever receives GET requests.
# SWOOP_DISABLE_EXECUTION=0
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,27 @@ WORKDIR /app

ENV NODE_ENV=production
# wget serves the container healthcheck; tini reaps zombies and forwards the
# SIGTERM that Swoop needs in order to finish its poll cycle cleanly.
RUN apk add --no-cache wget tini
# SIGTERM Swoop needs to finish its poll cycle cleanly; su-exec lets the
# entrypoint drop from root to PUID:PGID after fixing data-folder ownership.
RUN apk add --no-cache wget tini su-exec

COPY --from=prod-deps /app/node_modules ./node_modules
COPY package.json ./
COPY --from=backend-build /app/dist ./dist
COPY --from=frontend-build /app/web/dist ./web/dist
COPY docker/entrypoint.sh /usr/local/bin/swoop-entrypoint
RUN chmod 755 /usr/local/bin/swoop-entrypoint && mkdir -p /app/data

# Run unprivileged. The node image already provides uid/gid 1000 as `node`.
RUN mkdir -p /app/data && chown -R node:node /app/data
USER node
# PUID/PGID select the user the app runs as. 1000:1000 is the image's `node`
# user; Unraid users typically set 99:100. The entrypoint starts as root only
# to fix /app/data ownership, then drops to this user before starting Swoop.
ENV PUID=1000 PGID=1000

VOLUME ["/app/data"]
EXPOSE 3000

HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD wget -qO- http://127.0.0.1:${PORT:-3000}/health || exit 1

ENTRYPOINT ["/sbin/tini", "--"]
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/swoop-entrypoint"]
CMD ["node", "dist/server.js"]
20 changes: 12 additions & 8 deletions PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,18 @@ These need real SuperOps credentials and cannot be closed from a dev environment
- `src/services/executor.ts`, dispatching on the action type
- M365 actions go through [CIPP](https://cipp.app):

| Action | CIPP endpoint |
|---|---|
| `password_reset` | `POST /api/ExecResetPass` |
| `group_add` / `group_remove` | `POST /api/ExecAddMember` / `ExecRemoveMember` |
| `license_assign` / `license_remove` | `POST /api/ExecAssignLicense` |
| `account_disable` / `account_enable` | `POST /api/ExecDisableUser` / `ExecEnableUser` |
| `mfa_reset` | `POST /api/ExecResetMFA` |
| `mailbox_permission` | `POST /api/ExecMailboxPermission` |
Checked against CIPP's own OpenAPI spec (`Config/openapi.json` in CIPP-API). Two names this plan originally used — `ExecAddMember`/`ExecRemoveMember` and `ExecEnableUser` — do not exist.

| Action | CIPP endpoint | Notes |
|---|---|---|
| `password_reset` | `POST /api/ExecResetPass` | `tenantFilter`, `ID`, `displayName`, `MustChange` |
| `mfa_reset` | `POST /api/ExecResetMFA` | `tenantFilter`, `ID` |
| `group_add` / `group_remove` | `POST /api/EditGroup` | `groupId` object plus `AddMember` / `RemoveMember` arrays |
| `license_assign` / `license_remove` | `POST /api/ExecBulkLicense` | Array body; `LicenseOperation` Add / Remove |
| `account_disable` / `account_enable` | `POST /api/ExecDisableUser` | `Enable: false` / `true`; pair disable with `ExecRevokeSessions` |
| `mailbox_permission` | `POST /api/ExecEditMailboxPermissions` | Rights as `[{ "value": "<mailbox>" }]` — a bare string silently does nothing |

Swoop already builds these as execution plans (`src/services/approvals/plan.ts`) and shows them to approvers. Read-only lookups use `ListUsers` (`UserID` accepts a UPN), `ListUserGroups` and `ListMFAUsers` with `UseReportDB=true`.

- Every execution is logged with the request, the response and the outcome
- Rollback guidance recorded for reversible actions
Expand Down
Loading
Loading