Repository navigation
🧾 Bring your personal RevBank account into Pixel - #147
Open
davidvanleeuwen wants to merge 6 commits into
Open
davidvanleeuwen wants to merge 6 commits into
davidvanleeuwen wants to merge 6 commits into
Conversation
davidvanleeuwen
marked this pull request as ready for review
October 21, 2026 12:13
Comment on lines
+60
to
70
| !url.hash && | ||
| url.pathname === "/" && | ||
| (url.protocol === "https:" || ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname)) | ||
| ); | ||
| }, | ||
| { error: "must be an HTTPS origin (HTTP is allowed only on loopback)" }, | ||
| ); | ||
|
|
||
| const pixelEnv = z.enum(["local", "dev", "prod"]).default("local"); | ||
| const pixelRuntime = z.enum(["local", "cloud"]).default("local"); | ||
|
|
There was a problem hiding this comment.
Bug: Calling new URL(v) without a try/catch in revbankUrl's .refine() causes an unhandled TypeError on invalid URL input instead of a formatted ConfigError identifying REVBANK_API_URL.
Severity: LOW
Suggested Fix
Wrap the new URL(v) invocation inside the .refine() callback in a try...catch block and return false if a TypeError is caught.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/config.ts#L50-L70
Potential issue: In `src/config.ts`, `revbankUrl` uses `z.url().refine(...)` where the
refine callback calls `new URL(v)` without error handling. In Zod, a failed format check
records an issue but allows subsequent `.refine()` checks on the same schema to execute
unless abort behavior is enforced. If an invalid URL such as 'example.com' is supplied
for `REVBANK_API_URL`, `new URL(v)` throws an unhandled `TypeError: Invalid URL`. This
bypasses Zod error formatting and prevents the `ConfigError` identifying
`REVBANK_API_URL` from being produced.
Did we get this right? 👍 / 👎 to inform future reviews.
This branch was successfully deployed
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.
🧾 Your RevBank account, right in Pixel
Check your credits before your next visit, see your latest bookings, and find out where your balance went — all through private Discord replies.
Available to Friends, Members and Admins; Guests cannot use the RevBank commands.
This adds a personal RevBank connection to Pixel, with a human-verified account link and a separate private service that reads the existing backup.
A quick look
Illustrative response — fictional data:
/revbank link/revbank status/revbank balance/revbank transactions/revbank unlink🔗 Link once, then just ask
/revbank manage.Link managers can review, approve, reject and revoke links. Managing a link does not grant access to someone else's balance or transactions.
On the Pixel website
RevBank now has a homepage feature card and appears in the animated command picker. The getting-started guide explains linking your account, and the command reference covers both personal commands and link management, including the required permissions.
🔒 Personal by design
For reviewers: implementation and trust boundaries
The new
Revbankport and HTTP client integrate with Pixel's existing feature registry and dispatcher. Link management requires the explicitrevbank-link-admincapability; the gateway independently checks its manager allow-list.Responses are schema-validated and streamed with a 16 KiB cap and an eight-second deadline. Redirects and automatic retries are disabled. Financial responses are not persisted or logged by Pixel.
The integration defaults off. This PR includes environment validation, Key Vault/Terraform wiring, ADR 0018, privacy documentation and operator instructions.
Trust boundary: the gateway authenticates Pixel with a service token and trusts its assertion of the Discord caller's identity. A compromised Pixel/token can impersonate linked users. Review this boundary and the private gateway before enabling production.
Validation and rollout
Local validation passed. Malformed gateway URLs are covered by four regression cases and report a redacted
ConfigErrornamingREVBANK_API_URL:just check— 2,174 tests, including all coverage thresholdsjust buildjust docs-buildjust tf-validateThe companion TypeScript/Node.js gateway passed its 39 tests, Docker checks and Terraform validation. It is available on main in the separate private repository. GitHub CI reports the checks for this PR separately.
Rollout still needed: deploy the private TypeScript gateway into Pixel’s existing Azure Container Apps environment using its documented just workflow, configure credentials and link managers, and register the commands through the normal deployment process. The gateway uses internal HTTPS ingress, dedicated storage and secrets, and separate Terraform state keys in the existing backend. No infrastructure has been applied or live secrets changed.
Payments, financial writes, reminders and public statistics are outside this PR.