Add JWT token validation with user context extraction for file uploads#29
Draft
Add JWT token validation with user context extraction for file uploads#29
Conversation
- Added golang-jwt/jwt library dependency - Created JWT middleware with validation for sub, spaceId, and type claims - Extended File model with UserSub, SpaceId, and FileType fields - Created database migrations for new File columns (Scylla and Postgres) - Updated file upload handler to extract and store JWT claims - Implemented CombinedAuthMiddleware to support both service tokens and JWT - Added JWT configuration support (jwt_secret) - Created test suite for JWT functionality - Fixed test helper to create actual S3 buckets in MinIO WIP: Debugging JWT claims storage in file records Co-authored-by: 0xF6 <13326808+0xF6@users.noreply.github.com>
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
- Updated PostgreSQL repository to read/write new JWT fields (user_sub, space_id, file_type) - Updated Scylla repository to read/write new JWT fields - Fixed GetFileByID, GetFileByName, UpdateFile, and ListFiles functions - All JWT tests now passing successfully Co-authored-by: 0xF6 <13326808+0xF6@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add functionality for external services to generate JWT tokens
Add JWT token validation with user context extraction for file uploads
Jan 15, 2026
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.
External services need to authenticate and track user context (user ID, space ID, file type) when uploading files. Previously only service tokens were supported, which lacked user attribution.
Changes
Authentication
JWTAuthMiddlewarevalidatingsub(GUID),type(string), and optionalspaceId(GUID) claimsCombinedAuthMiddlewareaccepting eitherx-api-tokenorAuthorization: BearerheadersData Model
Filemodel with nullableUserSub,SpaceId,FileTypefieldsUpdateFile,GetFileByID,GetFileByName,ListFilesqueriesMigrations
user_sub,space_id,file_typecolumnsConfiguration
jwt_secretparameter (flag/env/config file)Usage
Service token authentication remains unchanged for backward compatibility.
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:
dario.cat/update-job-proxy /update-job-proxy io.containerd.rushow =1 ux_amd64/vet --ro�� 6_add_file_type.down.sql --log ux_amd64/vet(dns block)/update-job-proxy /update-job-proxy ACCEPT --alternate-refs/home/dependabot/go/pkg/mod/cache/vcs/7d314923ef34c8dcc5ae2aed0a0aa313627e4cf88db142be752f8f42a2dd7b17/shallow.lock git -c f225814414e9ca2d--stdin log /home/dependabot--alternate-refs -n1 --format=format:-c refs/tags/v0.7.6log.showsignature=false git conf�� =2 e/git /bin/git ock om/aws/aws-sdk-g--wait 0:refs/tags/v0.5-t /usr/bin/git(dns block)dl.min.io/usr/bin/minio minio server /data ux_amd64/vet -I o-v2@v1.41.1/int-errorsas WnDucx-vv ux_amd64/vet --gdwarf-5 /singleflight -o ux_amd64/vet ortc�� /semver/semver.go x64/src/debug/dwarf/attr_string.-ifaceassert ux_amd64/vet 0183971/b187/ ernal/sdk(dns block)/usr/bin/minio minio server /data(dns block)/usr/bin/minio minio server /data /run/containerd/io.containerd.runtime.v2.task/moby/2bf87787a1e9d38ccdfa39f0eb297ed679c9ed661677ae594dea1fbfb9284bfe --pid-file /run/containerd/io.containerd.runtime.v2.task/moby/2bf87787a1e9d38ccdfa39f0eb297ed679c9ed661677ae594dea1fbfb9284bfe/init.pid 2bf87787a1e9d38ccdfa39f0eb297ed679c9ed661677ae594dea1fbfb9284bfe g_ctl ntime.v2.task/mobash ntime.v2.task/mo--norc 093b291bfd3e5d18--noprofile 8c6/log.json list�� y --no-legend ntime.v2.task/mo--dport g_.a ntime.v2.task/mo/usr/bin/runc 093b291bfd3e5d18--root /usr/bin/docker-/var/run/docker/runtime-runc/moby(dns block)go.googlesource.com/update-job-proxy /update-job-proxy io.containerd.rushow =1 ux_amd64/vet --ro�� 6_add_file_type.down.sql --log ux_amd64/vet(dns block)go.opentelemetry.io/update-job-proxy /update-job-proxy io.containerd.rushow =1 ux_amd64/vet --ro�� 6_add_file_type.down.sql --log ux_amd64/vet(dns block)go.uber.org/update-job-proxy /update-job-proxy io.containerd.rushow =1 ux_amd64/vet --ro�� 6_add_file_type.down.sql --log ux_amd64/vet(dns block)go.yaml.in/update-job-proxy /update-job-proxy io.containerd.rushow =1 ux_amd64/vet --ro�� 6_add_file_type.down.sql --log ux_amd64/vet(dns block)google.golang.org/update-job-proxy /update-job-proxy io.containerd.rushow =1 ux_amd64/vet --ro�� 6_add_file_type.down.sql --log ux_amd64/vet(dns block)gopkg.in/update-job-proxy /update-job-proxy io.containerd.rushow =1 ux_amd64/vet --ro�� 6_add_file_type.down.sql --log ux_amd64/vet(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.