Commit Graph
8 Commits
Author SHA1 Message Date
Dylan M. Taylor 0e13ad0b10 fix(scripts): revoke every source session when copying account credentials (#274)
## What was wrong
`script/database/copy_user_account.py` moves an account's email and
password onto another account and says it ends the source account's
sessions. The revocation `UPDATE` had `LIMIT 10` and also matched
sessions that were already deleted. If the source account had more than
ten session rows, some live sessions could survive the transfer and keep
working, because session lookups accept any row with `deleted_at IS
NULL` and `expires_at > NOW()`.

## What changed
- The revocation `UPDATE` has no row limit and only targets live
sessions (`deleted_at IS NULL`), so the timestamps on rows that were
already deleted stay as they were.
- After the update, the script counts the source's remaining live
sessions inside the same transaction. If any are left, it raises, and
the existing handler rolls back.
- The confirmation preview counts live sessions, and the docstring lists
the revocation step.

## Blast radius
This only affects the oncall script that an operator runs by hand. No
service code changed. Session lookups do not use a cache
(`crates/lib/actix_artcraft/src/sessions` reads MySQL directly), so
nothing else needs invalidating.

## Checks
- Run: `python3 -m py_compile script/database/copy_user_account.py`
- Not run: running the script against a database (it needs a live MySQL
and secrets.toml).

Addresses CodeRabbit security findings (CWE-613).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Account-copy operations now stop and roll back if any live source
sessions remain, rather than committing an incomplete transfer.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 11:11:19 -05:00
Dylan M. Taylor 83cacf36ad security: pin Swagger UI, refuse npx installs, drop stale MinIO keys (SonarCloud) (#177)
Resolves the bundled-asset and script security findings SonarCloud
reports outside vendored code.

- **Web:S5725** `frontend/api_docs.html` — Swagger UI was loaded over
protocol-relative `//unpkg.com` URLs with no integrity check. Now
`https://` plus `integrity`/`crossorigin` on all three assets.
- **shell:S6505** the three remaining `npx` calls in Netlify/dev scripts
now pass `--no-install`, so they run the pinned local binary instead of
downloading and running one.
- **secrets:S6418** removed the long-dead MinIO access/secret key pair
commented out in the deprecated inference-job env file.
- **python:S4790** the Gravatar hash is an MD5 identifier required by
Gravatar's URL scheme, so it is marked `usedforsecurity=False`.

Verified: file contents diffed against the previous URLs; no
build-affecting script semantics changed (`--no-install` only rejects
on-demand downloads).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* API documentation resources now load over HTTPS with integrity
verification.
* Account-copying operations preserve their existing output while
supporting environments that restrict security-related hashing.

* **Chores**
* Build and cleanup commands use locally available tooling and continue
cleanup if the reset command fails.
* Removed commented-out credential settings from the development
configuration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-10-27 16:29:01 -04:00
Brandon Thomas e7bb263755 mysql backup tool 2026-04-01 13:15:27 -04:00
Brandon Thomas c7744ae545 update oncall script 2026-03-11 00:36:12 -04:00
Brandon Thomas d45b82109d script for handling oncall scenarios where the user has duplicate accounts (#1078) 2026-03-02 11:05:03 -05:00
Brandon Thomas e0779897b6 single quotes in db migrations 2026-02-17 23:40:56 +07:00
Brandon Thomas 60461e9208 db migration tools 2026-02-15 11:45:31 +07:00
Brandon Thomas 7cc1c0209f database migration tool (primarily record deletion) (#1039)
We need to remove irrelevant FakeYou records that do not impact the
ArtCraft product

- 87M irrelevant media file records (no relation to ArtCraft)
- 105M jobs records (which we purge occasionally anyway)
- lots of other files: audit logs, old/irrelevant stripe event logs,
feed data, etc. etc.
2026-02-14 08:06:54 +07:00