Skip to content

Standardize rule endpoint client identification#643

Merged
TheJeffreyKuo merged 5 commits into
developfrom
561-standardize-rule-endpoint-client-identification-and-remove-basic-auth
Jun 7, 2026
Merged

Standardize rule endpoint client identification#643
TheJeffreyKuo merged 5 commits into
developfrom
561-standardize-rule-endpoint-client-identification-and-remove-basic-auth

Conversation

@TheJeffreyKuo

Copy link
Copy Markdown
Contributor

Changes

Standardized client identification across all rule endpoints by moving client_id into the URL path. Previously add_rule and delete_rule pulled it from a Basic Auth header while subscribe_rules and unsubscribe_rules pulled it from the JSON body. Instead, all rule endpoint reads client_id now. The frontend API layer was updated to match this.

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No package-lock.json changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #561

@TheJeffreyKuo TheJeffreyKuo requested a review from bracyw May 3, 2026 23:32
@TheJeffreyKuo TheJeffreyKuo self-assigned this May 3, 2026

@bracyw bracyw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually looking at this I think it would be better to add the client-id as a Header, instead of in the url param because rule_id forcing you to add the client_id after the "/rules/ " which makes querying possible conflict based on client_id. (so disregard the ticket recommendation of path param or body)
TLDR: let's pivot to Header based client-id

@bracyw

bracyw commented May 16, 2026

Copy link
Copy Markdown
Collaborator

actually looking at this I think it would be better to add the client-id as a Header, instead of in the url param because rule_id forcing you to add the client_id after the "/rules/ " which makes querying possible conflict based on client_id. (so disregard the ticket recommendation of path param or body) TLDR: let's pivot to Header based client-id

You can check rust axum docs on how to write the backend code for this.

TheJeffreyKuo and others added 3 commits May 25, 2026 03:40
…ient-identification-and-remove-basic-auth' into 561-standardize-rule-endpoint-client-identification-and-remove-basic-auth
@TheJeffreyKuo TheJeffreyKuo requested a review from bracyw May 30, 2026 00:12
bracyw
bracyw previously approved these changes Jun 7, 2026

@bracyw bracyw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few TODO's for ticket creation. But LGTM to merge!

'Content-Type': 'application/json',
Authorization: basicAuthHeader(clientId)
},
headers: { 'Content-Type': 'application/json', ...clientIdHeader(clientId) },

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For another ticket, task we can make: transitioning to a slightly more abstracted tool than fetch, or further abstracting headers into multiple lambdas or a recursive lambda setup... something along those lines.

});
};

export interface RuleSubscriptionRequest {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the future a type like this could be good, but rn no abstraction needed.

@@ -73,9 +73,11 @@ export class RulesTableComponent implements OnInit {
}

async onToggleSubscription(rule: ClientRule, subscribed: boolean): Promise<void> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a follow up ticket. I didn't really investigate the quality of toggle subscriptions when initially made. I will make this a ticket.

client_id: String,
const CLIENT_ID_HEADER: &str = "x-client-id";

/// client id comes from the x-client-id header, keeping it out of conflict-prone route paths

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you link to rust docs on this. like to keep everything more complex to the docs.

@TheJeffreyKuo TheJeffreyKuo merged commit dd72dfe into develop Jun 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize rule endpoint client identification and remove Basic Auth

2 participants