@@ -6,7 +6,6 @@ package server_test
66import (
77 "bytes"
88 "context"
9- "encoding/hex"
109 "encoding/json"
1110 "errors"
1211 "io"
@@ -29,7 +28,6 @@ import (
2928 "github.com/stacklok/toolhive/pkg/vmcp/router"
3029 "github.com/stacklok/toolhive/pkg/vmcp/server"
3130 vmcpsession "github.com/stacklok/toolhive/pkg/vmcp/session"
32- "github.com/stacklok/toolhive/pkg/vmcp/session/security"
3331)
3432
3533// ---------------------------------------------------------------------------
@@ -113,19 +111,6 @@ func (f *v2FakeMultiSessionFactory) MakeSession(
113111 return nil , f .err
114112 }
115113 baseSession := transportsession .NewStreamableSession ("auto-id" )
116-
117- // Populate token hash metadata to match real session factory behavior.
118- allowAnonymous := vmcpsession .ShouldAllowAnonymous (identity )
119- if identity != nil && identity .Token != "" && ! allowAnonymous {
120- testSecret := []byte ("integration-test-secret" )
121- testSalt := []byte ("test-salt-123456" )
122- tokenHash := security .HashToken (identity .Token , testSecret , testSalt )
123- baseSession .SetMetadata (vmcpsession .MetadataKeyTokenHash , tokenHash )
124- baseSession .SetMetadata (vmcpsession .MetadataKeyTokenSalt , hex .EncodeToString (testSalt ))
125- } else {
126- baseSession .SetMetadata (vmcpsession .MetadataKeyTokenHash , "" )
127- }
128-
129114 sess := newV2FakeMultiSession (baseSession , f .tools )
130115 f .lastCreatedSession = sess
131116 return sess , nil
@@ -139,21 +124,6 @@ func (f *v2FakeMultiSessionFactory) MakeSessionWithID(
139124 return nil , f .err
140125 }
141126 baseSession := transportsession .NewStreamableSession (id )
142-
143- // Populate token hash metadata to match real session factory behavior.
144- // This allows integration tests to verify that hashes (not raw tokens) are stored.
145- if identity != nil && identity .Token != "" && ! allowAnonymous {
146- // Use a test HMAC secret and salt for integration tests
147- testSecret := []byte ("integration-test-secret" )
148- testSalt := []byte ("test-salt-123456" ) // 16 bytes
149- tokenHash := security .HashToken (identity .Token , testSecret , testSalt )
150- baseSession .SetMetadata (vmcpsession .MetadataKeyTokenHash , tokenHash )
151- baseSession .SetMetadata (vmcpsession .MetadataKeyTokenSalt , hex .EncodeToString (testSalt ))
152- } else {
153- // Anonymous session
154- baseSession .SetMetadata (vmcpsession .MetadataKeyTokenHash , "" )
155- }
156-
157127 sess := newV2FakeMultiSession (baseSession , f .tools )
158128 f .lastCreatedSession = sess
159129 return sess , nil
0 commit comments