Add HMAC-SHA256 signed URL support for time-limited PDF access - #14
Merged
Conversation
Co-authored-by: TheRealSeber <111927572+TheRealSeber@users.noreply.github.com>
…signatures only for PDFs Co-authored-by: TheRealSeber <111927572+TheRealSeber@users.noreply.github.com>
…feature Co-authored-by: TheRealSeber <111927572+TheRealSeber@users.noreply.github.com>
Co-authored-by: TheRealSeber <111927572+TheRealSeber@users.noreply.github.com>
…ance security warnings Co-authored-by: TheRealSeber <111927572+TheRealSeber@users.noreply.github.com>
Co-authored-by: TheRealSeber <111927572+TheRealSeber@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for signed, time-limited access to task PDFs
Add HMAC-SHA256 signed URL support for time-limited PDF access
Jan 25, 2026
Using a hardcoded public default secret allows anyone to forge valid signed URLs. Refuse to start if SIGNING_SECRET is not set. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds signed, time-limited URL support to enable unauthenticated (but authorized via HMAC) PDF downloads, enforced at the storage service layer via HTTP middleware.
Changes:
- Introduce
pkg/urlsignerfor HMAC-SHA256 signing/validation (expires+signaturequery params). - Enforce signed URL validation for GET requests to object endpoints, requiring signatures for PDF downloads (with a
metadataOnly=truebypass). - Expose signed URL generation from the Go client (
pkg/filestorage) and document the feature.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/urlsigner/urlsigner.go |
Implements HMAC signing and signature/expiry validation. |
pkg/urlsigner/urlsigner_test.go |
Unit tests for signing/validation behavior. |
internal/api/http/middleware/signature.go |
Adds request-time validation/enforcement middleware for signed URLs. |
internal/api/http/middleware/signature_test.go |
Middleware unit tests for valid/invalid/expired/missing signature scenarios. |
internal/api/http/server/router.go |
Wires the signature middleware into the server and updates NewServer signature. |
internal/config/config.go |
Adds SIGNING_SECRET config loading into app configuration. |
cmd/app/main.go |
Instantiates URLSigner and passes it into the HTTP server. |
cmd/app/integration_test.go |
End-to-end-ish test verifying middleware enforcement through the server handler. |
pkg/filestorage/file_storage.go |
Adds GetSignedFileURL to generate signed URLs from the client library. |
pkg/filestorage/file_storage_test.go |
Adds tests for GetSignedFileURL behavior. |
SIGNED_URLS.md |
New documentation for signed URL format, usage, and behavior. |
Readme.md |
Mentions signed URL support and links to detailed docs. |
.env.dist |
Adds SIGNING_SECRET to the example environment file. |
.gitignore |
Ignores the built file-storage binary. |
go.mod |
Promotes lumberjack.v2 to a direct dependency (used by logger). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
HermanPlay
requested changes
Mar 8, 2026
Thread urlsigner into NewInternalServer; add GET /sign?bucket=&key=&ttl=
handler that returns {"signedPath": "..."} with a default TTL of 300s.
Update main.go and integration tests accordingly.
TDD: failing compile error confirmed before implementation.
SDK no longer does in-process HMAC signing. GetSignedFilePath now calls GET <config.URL>/sign?bucket=...&key=...&ttl=... on the internal server and returns the signed path. Remove SigningSecret from FileStorageConfig. TDD: failing compile confirmed before implementation.
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.
Storage needs to serve PDFs via signed URLs with expiration validation, no user authentication required. Backend generates signatures, storage validates and enforces access control.
Implementation
URL Signing (
pkg/urlsigner)path:timestamp→ base64-encoded signature?expires={unix_ts}&signature={hmac}Server Validation (
internal/api/http/middleware/signature.go)/buckets/{bucket}/{object}?metadataOnly=truerequestsClient API (
pkg/filestorage)Configuration
SIGNING_SECRETenv var (logs ERROR if unset)Behavior
Testing
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
go.googlesource.com/update-job-proxy /update-job-proxy /home/REDACTED/work/_temp/runtime-logs/mkcert/rootCA.pem --updater-env NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/dbot-ca.crt 8426�� g_.a -I ache/go/1.24.12/168.63.129.16 --gdwarf-5 ge/internal/api/rev-parse -o ache/go/1.24.12/53(dns block)/update-job-proxy /update-job-proxy -o br-0a67a4931c29 -j DROP igiCert_High_Assurance_EV_Root_CA.pem /opt/hostedtoolc-e /bin/test(dns block)go.uber.org/update-job-proxy /update-job-proxy /home/REDACTED/work/_temp/runtime-logs/mkcert/rootCA.pem --updater-env NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/dbot-ca.crt 8426�� g_.a -I ache/go/1.24.12/168.63.129.16 --gdwarf-5 ge/internal/api/rev-parse -o ache/go/1.24.12/53(dns block)/update-job-proxy /update-job-proxy -o br-0a67a4931c29 -j DROP igiCert_High_Assurance_EV_Root_CA.pem /opt/hostedtoolc-e /bin/test(dns block)gopkg.in/update-job-proxy /update-job-proxy /home/REDACTED/work/_temp/runtime-logs/mkcert/rootCA.pem --updater-env NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/dbot-ca.crt 8426�� g_.a -I ache/go/1.24.12/168.63.129.16 --gdwarf-5 ge/internal/api/rev-parse -o ache/go/1.24.12/53(dns block)/update-job-proxy /update-job-proxy -o br-0a67a4931c29 -j DROP igiCert_High_Assurance_EV_Root_CA.pem /opt/hostedtoolc-e /bin/test(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.