Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a Service Bus Connection String Parser #11893

Closed
jsquire opened this issue Oct 16, 2020 · 4 comments
Closed

Implement a Service Bus Connection String Parser #11893

jsquire opened this issue Oct 16, 2020 · 4 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Service Bus

Comments

@jsquire
Copy link
Member

jsquire commented Oct 16, 2020

Summary

Service Bus allows for authorization using a shared key and shared access signature that is supported using a service-specific shared access key credential. It is common for the shared key or shared access signature to be passed with the service endpoint and entity path as part of a connection string. To align with best practices, we would like to guide library users to down the path of using credentials for authorization within production applications. In order to assist with transforming a connection string for use with credential-based client creation, a parsing utility is desirable.

Scope of Work

  • Design and implementation of a means for parsing a Service Bus connection string into its components. These should include:

    • FullyQualifiedNamespace
    • Endpoint
    • EntityPath
    • SharedAccessSignature
    • SharedAccessKeyName
    • SharedAccessKey

  • The parser should adhere to the current validation rules for connection string correctness. For example:

    • Only one form of authorization should be allowed (shared key or shared access signature)
    • The Endpoint must be present
    • The EntityPath is optional
    • All tokens which are present must have an associated value

  • The host name of the Endpoint should be reflected as the FullyQualifiedNamespace.

  • Unknown tokens in the connection string are rejected or ignored; they are not reflected in the set of parsed tokens.

  • The parsed values should be treated as read-only, if idiomatic to the language.

  • The proposed surface area of the parser, as well as any associated types that change the public API surface should be reviewed with the language architect, and approval obtained. Full board review is not necessary.

Success Criteria

  • The design of a parser detailed by the scope has been completed and approved by the language architect.

  • The parser has been implemented according to the design and is exposed as part of the public API of the library.

  • The tests necessary for its validation have been created or adjusted and pass reliably.

  • The existing test suite continues to produce deterministic results and pass reliably.

References

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Oct 16, 2020
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. needs-team-triage Workflow: This issue needs the team to triage. Service Bus labels Oct 16, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Oct 16, 2020
@ramya-rao-a ramya-rao-a added this to the [2020] November milestone Oct 19, 2020
@ramya-rao-a ramya-rao-a removed the needs-team-triage Workflow: This issue needs the team to triage. label Oct 19, 2020
@ramya-rao-a
Copy link
Contributor

@jsquire Can you share the error message you are using so that we use similar verbiage for the below error scenarios:

  • Missing endpoint in connection string
  • Both SAS and key present in connection string
  • No SAS or Key name, but key present in connection string

@jsquire
Copy link
Member Author

jsquire commented Oct 20, 2020

@jsquire Can you share the error message you are using so that we use similar verbiage for the below error scenarios:

We're using the same messages that we currently do during parsing.

  • Missing endpoint in connection string
  • No SAS or Key name, but key present in connection string

The connection string used for an Event Hub client must specify the Event Hubs namespace host, and either a Shared Access Key (both the name and value) or Shared Access Signature to be valid. The path to an Event Hub must be included in the connection string or specified separately.

  • Both SAS and key present in connection string

The authorization for a connection string may specify a shared key or pre-computed shared access signature, but not both. Please verify that your connection string does not have the SharedAccessSignature token if you are passing the SharedKeyName and SharedKey.

Event Hub name specified in the connection string and also the constructor

The path to an Event Hub may be specified as part of the connection string or as a separate value, but not both. Please verify that your connection string does not have the EntityPath token if you are passing an explicit Event Hub name.

The endpoint token exists, but it's not a well-formed URL (or we couldn't override the scheme due to the weird formatting)

The endpoint address could not be parsed; it was either malformed or not using the sb:// scheme.

@ramya-rao-a
Copy link
Contributor

I am thinking of going with the below for JS:

  • Connection string should have the Endpoint.
  • Connection string cannot have both SharedAccessSignature and SharedAccessKey details.
  • Connection string with SharedAccessKey should have SharedAccessKeyName as well.
  • Connection string with SharedAccessKeyName should have SharedAccessKey as well.

@ramya-rao-a ramya-rao-a self-assigned this Oct 20, 2020
@ramya-rao-a
Copy link
Contributor

Done with #11949

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Service Bus
Projects
None yet
Development

No branches or pull requests

2 participants