Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/agentvault/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func errPersonalValuesMissing(svc *resolvedService) error {
if svc.native != nil {
what = "username or password"
}
return fmt.Errorf("service %q needs your own %s, which isn't set up yet: %w. Set it up on access bundle %q in Infisical Agent Vault, or for a machine identity, start the session on behalf of a user who has set it up. It can take a few minutes to apply.", svc.name, what, errPolicyBlocked, svc.accessBundleName)
return fmt.Errorf("service %q needs your own %s, which isn't set up yet: %w. Set it up under Services in Infisical Agent Vault, or for a machine identity, start the session on behalf of a user who has set it up. It can take a few minutes to apply.", svc.name, what, errPolicyBlocked)
}

func checkServicePolicy(svc *resolvedService, req *http.Request) error {
Expand Down
2 changes: 1 addition & 1 deletion packages/agentvault/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func TestPersonalValuesMissing(t *testing.T) {
t.Fatalf("a service missing the owner's personal values should be blocked, got %v", err)
}
if !strings.Contains(err.Error(), `service "github" needs your own credential or sign-in`) ||
!strings.Contains(err.Error(), `access bundle "on-call" in Infisical Agent Vault`) ||
!strings.Contains(err.Error(), "under Services in Infisical Agent Vault") ||
!strings.Contains(err.Error(), "It can take a few minutes to apply") {
t.Fatalf("the refusal should say what to set up, where, and that saving takes a poll to apply: %q", err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions packages/agentvault/upstream_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ func upstreamAuthBody(code, message string) string {
// For a credential the user stored, which only they can replace.
func staticCredentialRejectedBody(svc *resolvedService) string {
if svc.memberProvided {
return upstreamAuthBody("upstream_auth_failed", fmt.Sprintf("The %s service rejected your credential. Update your personal value on access bundle %q in Infisical Agent Vault.", svc.name, svc.accessBundleName))
return upstreamAuthBody("upstream_auth_failed", fmt.Sprintf("The %s service rejected your credential. Update your personal value for it under Services in Infisical Agent Vault.", svc.name))
}
return upstreamAuthBody("upstream_auth_failed", fmt.Sprintf("The %s service's credential was rejected. Update it in Infisical Agent Vault.", svc.name))
}

func reauthorizationNeededBody(svc *resolvedService) string {
if svc.memberProvided {
return upstreamAuthBody("upstream_auth_failed", fmt.Sprintf("Reconnect your account for the %s service on access bundle %q in Infisical Agent Vault.", svc.name, svc.accessBundleName))
return upstreamAuthBody("upstream_auth_failed", fmt.Sprintf("Reconnect your account for the %s service under Services in Infisical Agent Vault.", svc.name))
}
return upstreamAuthBody("upstream_auth_failed", fmt.Sprintf("The %s service needs to be reauthorized in Infisical Agent Vault.", svc.name))
}
Expand Down
4 changes: 2 additions & 2 deletions packages/agentvault/upstream_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ func TestAMemberProvidedRejectionTellsTheMemberWhatToFix(t *testing.T) {
}, acceptOnly("nothing"))

resp, body := doWith(t, client, http.MethodPost, fmt.Sprintf("https://%s/mcp", host), "application/json", strings.NewReader(mcpCallBody))
assertUpstreamAuthFailed(t, resp, body, `{"error":"upstream_auth_failed","message":"The linear service rejected your credential. Update your personal value on access bundle \"bundle\" in Infisical Agent Vault."}`)
assertUpstreamAuthFailed(t, resp, body, `{"error":"upstream_auth_failed","message":"The linear service rejected your credential. Update your personal value for it under Services in Infisical Agent Vault."}`)
})

t.Run("oauth needs reauthorization", func(t *testing.T) {
Expand All @@ -486,7 +486,7 @@ func TestAMemberProvidedRejectionTellsTheMemberWhatToFix(t *testing.T) {
}, acceptOnly("nothing"))

resp, body := doWith(t, client, http.MethodGet, fmt.Sprintf("https://%s/mcp", host), "", nil)
assertUpstreamAuthFailed(t, resp, body, `{"error":"upstream_auth_failed","message":"Reconnect your account for the linear service on access bundle \"bundle\" in Infisical Agent Vault."}`)
assertUpstreamAuthFailed(t, resp, body, `{"error":"upstream_auth_failed","message":"Reconnect your account for the linear service under Services in Infisical Agent Vault."}`)
})
}

Expand Down
Loading