Skip to content
Merged
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 docs/connector.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Token lifetime is set by the requester. Snowflake accepts whole days only, and t
</Warning>

<Note>
**Service users must have a granted default role.** For a user of type `SERVICE`, `SERVICE_AGENT`, or `LEGACY_SERVICE`, the connector restricts the issued token to the user's `DEFAULT_ROLE` and verifies that role is actually granted to the user first. If the user has no default role, or the default role is not granted, issuance fails before any token is created.
**Service users must have a granted default role.** For a user of type `SERVICE`, `SERVICE_AGENT`, or `LEGACY_SERVICE`, the connector restricts the issued token to the user's `DEFAULT_ROLE`, and verifies that role is granted to the user when its own role can read the user's grants. If the user has no default role, issuance fails before any token is created. If the default role is not granted, issuance fails either on that check or on Snowflake's own rejection of the statement.
</Note>

<Note>
Expand Down
7 changes: 4 additions & 3 deletions pkg/connector/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (o *credentialUserBuilder) Issue(ctx context.Context, input *connectorbuild
// SHOW GRANTS TO USER needs privileges that creating the token does not.
// This check only turns a Snowflake rejection into a better message, so a
// role that cannot run it must still be allowed to issue.
ctxzap.Extract(ctx).Debug("baton-snowflake: skipping default-role check: insufficient privileges",
ctxzap.Extract(ctx).Warn("baton-snowflake: skipping default-role check: insufficient privileges",
zap.String("username", input.IdentityID.Resource))
case err != nil:
return nil, fmt.Errorf("baton-snowflake: verify service user's default role: %w", err)
Expand Down Expand Up @@ -167,8 +167,9 @@ func (o *credentialUserBuilder) Issue(ctx context.Context, input *connectorbuild
// locally computed expiry is never later than Snowflake's, so reporting it
// errs towards early rotation rather than towards a credential that outlives
// what C1 believes.
ctxzap.Extract(ctx).Debug("baton-snowflake: cannot read back token expiry: insufficient privileges",
zap.String("username", input.IdentityID.Resource))
ctxzap.Extract(ctx).Warn("baton-snowflake: reporting a locally computed token expiry: insufficient privileges to read it back",
zap.String("username", input.IdentityID.Resource),
zap.Time("estimated_expires_at", expiresAt))
default:
return nil, fmt.Errorf("baton-snowflake: read created programmatic access token expiry: %w", err)
}
Expand Down
Loading