Skip to content

Add HTTP method matching to resource rules - #89

Open
Blacks-Army wants to merge 1 commit into
fosrl:devfrom
Blacks-Army:feat/http-method-rules
Open

Add HTTP method matching to resource rules#89
Blacks-Army wants to merge 1 commit into
fosrl:devfrom
Blacks-Army:feat/http-method-rules

Conversation

@Blacks-Army

Copy link
Copy Markdown
Contributor

Node-side half of fosrl/pangolin#3704, which resolves fosrl/pangolin#1408 and supersedes fosrl/pangolin#2131.

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

AI Disclosure

Claude Code (Opus) helped me with this one, including the implementation. I set the design constraints, went through every hunk myself and verified the result before opening this.

Description

This repo carries its own copy of checkRules, so without this change a METHOD rule would be honoured or ignored depending on which side handled the request.

A rule with match METHOD carries a comma-separated list of HTTP methods in its existing value, e.g. "POST,PUT", and applies when the request method is in that list. Matching is case-insensitive on both sides.

Same shape as the hub change: one else if at the end of the chain plus one short helper. No new columns, no migration. Validation and the UI live in the hub, so none of that is duplicated here.

Merge alongside fosrl/pangolin#3704. A METHOD rule can only be created over there, and this side ignores match types it does not know, so neither order breaks anything in the meantime.

How to test?

With fosrl/pangolin#3704 applied to the hub, create a PASS / METHOD / POST,PUT rule on an HTTP resource served through a node, then confirm curl -X GET is served and curl -X POST is sent to auth.

npx tsc --noEmit reports nothing beyond the two tsconfig.json deprecation errors that are already present on dev.

A rule with match "METHOD" carries a comma-separated list of HTTP
methods in its value, e.g. "POST,PUT", and applies when the request
method is in that list.
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.

1 participant