Config: show each database connection's URL and allowed roles

The connections table reads each connection and lists its URL and
allowed roles. Literal passwords in a URL are masked; templated
{{password}} URLs are shown as-is.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mattandClaude Sonnet 5.5 committed 2026-11-09 14:09:42 +00:00
1 parent 44e4eb75c9
commit fd20caa525
4 files changed
+116 -9

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
const MASK = '••••'
/**
* A connection URL safe to put on screen. Templated passwords ("{{password}}", which OpenBao fills in itself) are
* kept, but a literal one typed into the URL ("user:secret@host", "?password=secret") is hidden.
*/
export function maskConnectionUrl(url: string): string {
return url
.replace(/^([a-z][a-z0-9+.-]*:\/\/[^:@/\s]*:)([^@/\s]*)(@)/i, (m, head: string, pw: string, at: string) =>
pw.includes('{{') ? m : `${head}${MASK}${at}`,
)
.replace(/([?&;\s]password=)([^&;\s]*)/gi, (m, head: string, pw: string) => (pw.includes('{{') ? m : `${head}${MASK}`))
}