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

feat: add allowedIpRanges widgets config #833

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

megheaiulian
Copy link

Adds allowedIpRanges widgets config that can be used specifically
allow some ip ranges even if its in disallowedIpRanges.

@megheaiulian megheaiulian requested a review from a team as a code owner October 23, 2023 16:22
Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

Seems reasonable, thank you!

changelog.d/833.feature Outdated Show resolved Hide resolved
auto-merge was automatically disabled October 24, 2023 13:21

Head branch was pushed to by a user without write access

megheaiulian and others added 4 commits December 28, 2023 09:27
Adds `allowedIpRanges` widgets config that can be used specifically
allow  some ip ranges even if its in `disallowedIpRanges`.

Signed-off-by: Iulian Meghea <[email protected]>
Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

A few things to think about. Generally looks good though :)

this.roomSetupWidget = yaml.roomSetupWidget;
if (yaml.disallowedIpRanges !== undefined && (!Array.isArray(yaml.disallowedIpRanges) || !yaml.disallowedIpRanges.every(s => typeof s === "string"))) {
throw new ConfigError("widgets.disallowedIpRanges", "must be a string array");
}
if (yaml.allowedIpRanges !== undefined && (!Array.isArray(yaml.allowedIpRanges) || !yaml.allowedIpRanges.every(s => typeof s === "string"))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

N.B. An empty array would skip this, would we allow empty values for allowedIpRanges (effectively blocking the feature entirely, seems a bit pointless :) )

@@ -40,6 +40,7 @@ export const DefaultConfigRoot: BridgeConfigRoot = {
roomSetupWidget: {
addOnInvite: false,
},
allowedIpRanges: [],
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we want this to actually show up as a default, because the default value would block everything currently :)

@@ -39,6 +39,7 @@ widgets:
# - 2001:db8::/32
# - ff00::/8
# - fec0::/10
# allowedIpRanges: []
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we would put in some examples of values here?

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.

2 participants