Repository navigation
feat: seed a dynatron bot user with its own API token - #610
Merged
Merged
Conversation
Dynatron's standup page calls user.whoami and searches with the admin's token, which can do anything. The local Phorge now seeds a bot account, dynatron, that is not an admin and has a permanent command line token of its own, PHORGE_DYNATRON_TOKEN in k8s/base/secret.env. The token is made by the same code as the admin's, moved from the auth module into PhabfiveSeedModule::ensureConduitToken(), which also refuses a token value that already belongs to another account. make creds prints Dynatron's token when the instance has it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The seed puts no task on Development, so on a fresh instance the search found nothing whoever asked. QA has one in the default Space. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Dynatron's standup page calls
user.whoamiandmaniphest.searchwithPHAB_TOKEN, and on the local Phorge that is the admin'sphabfive-devtoken, which can do anything. It only needs to read.What
dynatron(needsauth), creates a bot accountdynatron:isSystemAgent, not an admin, no password, no memberships. It has a permanent command line Conduit token,PHORGE_DYNATRON_TOKENink8s/base/secret.env, with the same fallback default in the module and inphorge/lib/banner.sh.auth.phpintoPhabfiveSeedModule::ensureConduitToken():tokenNamewhere the release has it, no expiry, and an existing token with an expiry made permanent. It also refuses a token value that already belongs to another account, so two variables set to the same value cannot hand one account's token to the other.make credsand the startup banner print Dynatron's token, labelled as Dynatron's, when the instance has it (PHORGE_SEEDmay leave the module out).Tests
tests/k8s/test_seed.py: the user exists, is a bot and not an admin; its token answersuser.whoamiasdynatronand reads the samemaniphest.searchresults as the admin; a second seed run creates and changes nothing; andtest_api_token_never_expiresnow covers both tokens.tests/e2e/test_cli.py:phabfive user whoamiandmaniphest searchwith Dynatron's token.stable:make test-k8s44 passed,make test-e2e151 passed (2 skipped), unit tests 6416 passed.ci:phorge-stableandci:phabricator-stableso CI seeds it on both, rather than switching the shared local instance to Phabricator.🤖 Generated with Claude Code