Skip to content

feat: add serve command for Postman integration#4

Merged
andrespd99 merged 7 commits into
mainfrom
andrespd99/feat/serve-postman
Jul 10, 2026
Merged

feat: add serve command for Postman integration#4
andrespd99 merged 7 commits into
mainfrom
andrespd99/feat/serve-postman

Conversation

@andrespd99

Copy link
Copy Markdown
Owner

Summary

Adds a new serve subcommand that starts a local HTTP server for Postman pre-request script integration.

Postman scripts cannot spawn child processes, so this provides REST endpoints that scripts can call over HTTP to fetch bearer tokens automatically.

Changes

  • cmd/serve.go (new) — serve cobra command with --addr flag (default 127.0.0.1:9876). Exposes:

    • GET /health — health check with version
    • GET /token — returns bearer token (supports ?project=, ?refresh=true, ?format=header)
    • GET /me — returns JSON user details (supports ?project=)
    • Uses Go 1.22+ method-routed http.ServeMux
    • sync.Mutex guards concurrent session file writes
    • Localhost-only binding (no remote access)
  • cmd/token.go — Extracted getToken(projectName, forceRefresh) helper shared by CLI and HTTP handler

  • cmd/me.go — Extracted getMe(ctx, projectName) helper shared by CLI and HTTP handler

  • README.md — Replaced "Coming soon" note with full Postman docs: server setup, endpoint reference, and a copy-paste pre-request script snippet

Testing

go vet ./...
go build .
go test ./...

All pass.

Start a local HTTP server (127.0.0.1:9876 by default) exposing /token,
/me, and /health endpoints. Postman pre-request scripts can call these
to automatically fetch bearer tokens without spawning child processes.

Refactored cmd/token.go and cmd/me.go to extract shared getToken and
getMe helpers so both CLI commands and HTTP handlers use the same logic.

Updated README with Postman setup instructions and a copy-paste
pre-request script snippet.
Base automatically changed from andrespd99/feat/multi-projects to main July 10, 2026 19:08
An error occurred while trying to automatically change base from andrespd99/feat/multi-projects to main July 10, 2026 19:08
@andrespd99 andrespd99 added the enhancement New feature or request label Jul 10, 2026
@andrespd99 andrespd99 closed this Jul 10, 2026
@andrespd99 andrespd99 reopened this Jul 10, 2026
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or OpenSSF Scorecard issues found.

Scanned Files

None

@security-alerts-actions

security-alerts-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

Reporte de Seguridad — 2026-07-10 20:02 UTC

🚫 PR Bloqueado — Vulnerabilidades detectadas en este PR.

Los siguientes checks de seguridad están fallando.
El PR no puede mergearse hasta resolverlos.

CodeQL

Revisa los detalles del check para más información.


Deuda de seguridad existente en main

ℹ️ Las siguientes alertas ya existían en main antes de este PR.
No bloquean el merge, pero deben remediarse.

✅ Secret Scanning — Sin secretos expuestos

No hay secretos expuestos activos en main.

🟡 Code Scanning (CodeQL) — 1 hallazgo(s) de CodeQL

1 hallazgo(s) abiertos, ninguno crítico ni alto.

🔴 Dependabot — 13 dependencia(s) vulnerable(s)

9 crítica(s)/alta(s) de 13 dependencias vulnerables.

# Paquete Severidad Detectado el
#13 golang.org/x/crypto critical 2026-07-10
#12 golang.org/x/crypto critical 2026-07-10
#11 golang.org/x/crypto critical 2026-07-10
#10 golang.org/x/crypto high 2026-07-10
#9 golang.org/x/crypto critical 2026-07-10
#7 golang.org/x/crypto critical 2026-07-10
#5 golang.org/x/crypto critical 2026-07-10
#4 golang.org/x/crypto critical 2026-07-10
#3 golang.org/x/crypto high 2026-07-10

Generado por Security Report · 2026-07-10 20:02 UTC

- Module path: github.com/andrespd99/fireauth
- Binary name: fireauth
- Config dir: ~/.fireauth/
- All docs, workflows, install script updated
- No Cashea references remain
@andrespd99
andrespd99 merged commit 2359bc9 into main Jul 10, 2026
2 checks passed
@andrespd99
andrespd99 deleted the andrespd99/feat/serve-postman branch July 10, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants