sim-setup 1.0.6-dev.63.1 → 1.0.6-dev.77.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docker-compose.prod.yml +5 -0
- package/dist/index.js +1266 -14
- package/package.json +7 -5
package/dist/index.js
CHANGED
|
@@ -1570,7 +1570,7 @@ var init_env_capabilities = __esm(() => {
|
|
|
1570
1570
|
var integrations_default;
|
|
1571
1571
|
var init_integrations = __esm(() => {
|
|
1572
1572
|
integrations_default = {
|
|
1573
|
-
updatedAt: "2026-
|
|
1573
|
+
updatedAt: "2026-09-01",
|
|
1574
1574
|
integrations: [
|
|
1575
1575
|
{
|
|
1576
1576
|
type: "onepassword",
|
|
@@ -5376,6 +5376,121 @@ var init_integrations = __esm(() => {
|
|
|
5376
5376
|
integrationType: "sales",
|
|
5377
5377
|
tags: ["enrichment", "data-analytics"]
|
|
5378
5378
|
},
|
|
5379
|
+
{
|
|
5380
|
+
type: "circleback",
|
|
5381
|
+
slug: "circleback",
|
|
5382
|
+
name: "Circleback",
|
|
5383
|
+
description: "AI-powered meeting notes, action items, and transcripts",
|
|
5384
|
+
longDescription: "Integrate Circleback into your workflow to read meetings, notes, transcripts, and insights, search across meetings, manage action items and tags, and browse the people and companies you meet with. Circleback can also trigger workflows when meetings are processed.",
|
|
5385
|
+
bgColor: "linear-gradient(180deg, #E0F7FA 0%, #FFFFFF 100%)",
|
|
5386
|
+
iconName: "CirclebackIcon",
|
|
5387
|
+
docsUrl: "https://docs.sim.ai/integrations/circleback",
|
|
5388
|
+
operations: [
|
|
5389
|
+
{
|
|
5390
|
+
name: "List Meetings",
|
|
5391
|
+
description: "Lists meetings from Circleback with optional ownership, status, tag, and attendee filters."
|
|
5392
|
+
},
|
|
5393
|
+
{
|
|
5394
|
+
name: "Get Meeting",
|
|
5395
|
+
description: "Gets a Circleback meeting by ID, including notes, attendees, action items, insights, and recording details."
|
|
5396
|
+
},
|
|
5397
|
+
{
|
|
5398
|
+
name: "Search Meetings",
|
|
5399
|
+
description: "Searches Circleback meetings by name and content, with optional filters for specific meetings, tags, and people."
|
|
5400
|
+
},
|
|
5401
|
+
{
|
|
5402
|
+
name: "Get Transcript",
|
|
5403
|
+
description: "Gets the full transcript for a Circleback meeting."
|
|
5404
|
+
},
|
|
5405
|
+
{
|
|
5406
|
+
name: "Update Meeting",
|
|
5407
|
+
description: "Updates the name, notes, or private notes of a Circleback meeting. The API returns only the fields that were updated."
|
|
5408
|
+
},
|
|
5409
|
+
{
|
|
5410
|
+
name: "Delete Meeting",
|
|
5411
|
+
description: "Deletes a Circleback meeting. Only the owner of the meeting can delete it. Returns the deleted meeting."
|
|
5412
|
+
},
|
|
5413
|
+
{
|
|
5414
|
+
name: "List Action Items",
|
|
5415
|
+
description: "Lists action items across the authenticated user meetings, filtered by assignee, status, tags, and attendees. Defaults to incomplete action items assigned to the API key owner."
|
|
5416
|
+
},
|
|
5417
|
+
{
|
|
5418
|
+
name: "Update Action Item",
|
|
5419
|
+
description: "Updates the title, description, status, or assignee of a Circleback action item. Returns the updated action item."
|
|
5420
|
+
},
|
|
5421
|
+
{
|
|
5422
|
+
name: "Delete Action Item",
|
|
5423
|
+
description: "Deletes a Circleback action item. Returns the deleted action item."
|
|
5424
|
+
},
|
|
5425
|
+
{
|
|
5426
|
+
name: "List Calendar Events",
|
|
5427
|
+
description: "Lists upcoming calendar events from the authenticated user connected calendars, with pagination and a configurable time window."
|
|
5428
|
+
},
|
|
5429
|
+
{
|
|
5430
|
+
name: "List Companies",
|
|
5431
|
+
description: "Lists the companies whose people attend the authenticated user meetings, with optional tag filters."
|
|
5432
|
+
},
|
|
5433
|
+
{
|
|
5434
|
+
name: "Get Company",
|
|
5435
|
+
description: "Gets a company by its domain from Circleback, including its people and external links."
|
|
5436
|
+
},
|
|
5437
|
+
{
|
|
5438
|
+
name: "List People",
|
|
5439
|
+
description: "Lists the people who attend the authenticated user meetings, ordered by most recent meeting, with optional company and tag filters."
|
|
5440
|
+
},
|
|
5441
|
+
{
|
|
5442
|
+
name: "Get Person",
|
|
5443
|
+
description: "Gets a person by their profile ID from Circleback, including their profile details and external links."
|
|
5444
|
+
},
|
|
5445
|
+
{
|
|
5446
|
+
name: "List Tags",
|
|
5447
|
+
description: "Lists every tag available to the authenticated Circleback user."
|
|
5448
|
+
},
|
|
5449
|
+
{
|
|
5450
|
+
name: "Create Tag",
|
|
5451
|
+
description: "Creates a new tag in Circleback. If a tag with the same name already exists, a conflict error is returned."
|
|
5452
|
+
},
|
|
5453
|
+
{
|
|
5454
|
+
name: "Update Tag",
|
|
5455
|
+
description: "Updates the name or description of a Circleback tag."
|
|
5456
|
+
},
|
|
5457
|
+
{
|
|
5458
|
+
name: "Delete Tag",
|
|
5459
|
+
description: "Permanently deletes a Circleback tag and removes it from every meeting it was applied to."
|
|
5460
|
+
},
|
|
5461
|
+
{
|
|
5462
|
+
name: "Add Tag to Meetings",
|
|
5463
|
+
description: "Applies an existing Circleback tag to one or more meetings and returns the updated meetings."
|
|
5464
|
+
},
|
|
5465
|
+
{
|
|
5466
|
+
name: "Remove Tag from Meetings",
|
|
5467
|
+
description: "Removes a Circleback tag from one or more meetings and returns the updated meetings."
|
|
5468
|
+
}
|
|
5469
|
+
],
|
|
5470
|
+
operationCount: 20,
|
|
5471
|
+
triggers: [
|
|
5472
|
+
{
|
|
5473
|
+
id: "circleback_meeting_completed",
|
|
5474
|
+
name: "Circleback Meeting Completed",
|
|
5475
|
+
description: "Trigger workflow when a meeting is processed and ready in Circleback"
|
|
5476
|
+
},
|
|
5477
|
+
{
|
|
5478
|
+
id: "circleback_meeting_notes",
|
|
5479
|
+
name: "Circleback Meeting Notes Ready",
|
|
5480
|
+
description: "Trigger workflow when meeting notes and action items are ready"
|
|
5481
|
+
},
|
|
5482
|
+
{
|
|
5483
|
+
id: "circleback_webhook",
|
|
5484
|
+
name: "Circleback Webhook",
|
|
5485
|
+
description: "Generic webhook trigger for all Circleback events"
|
|
5486
|
+
}
|
|
5487
|
+
],
|
|
5488
|
+
triggerCount: 3,
|
|
5489
|
+
authType: "api-key",
|
|
5490
|
+
category: "tools",
|
|
5491
|
+
integrationType: "ai",
|
|
5492
|
+
tags: ["meeting", "note-taking"]
|
|
5493
|
+
},
|
|
5379
5494
|
{
|
|
5380
5495
|
type: "managed_agent",
|
|
5381
5496
|
slug: "claude-managed-agents",
|
|
@@ -9584,7 +9699,7 @@ var init_integrations = __esm(() => {
|
|
|
9584
9699
|
},
|
|
9585
9700
|
{
|
|
9586
9701
|
name: "List workflow runs",
|
|
9587
|
-
description: "List workflow runs for a repository. Supports filtering by actor, branch, event, and status. Returns run details including status, conclusion, and links."
|
|
9702
|
+
description: "List workflow runs for a repository, or for a single workflow when a workflow ID or filename is given. Supports filtering by actor, branch, event, and status. Returns run details including status, conclusion, and links."
|
|
9588
9703
|
},
|
|
9589
9704
|
{
|
|
9590
9705
|
name: "Get workflow run",
|
|
@@ -20897,6 +21012,185 @@ var init_integrations = __esm(() => {
|
|
|
20897
21012
|
integrationType: "documents",
|
|
20898
21013
|
tags: ["cloud", "automation"]
|
|
20899
21014
|
},
|
|
21015
|
+
{
|
|
21016
|
+
type: "sailpoint",
|
|
21017
|
+
slug: "sailpoint",
|
|
21018
|
+
name: "SailPoint",
|
|
21019
|
+
description: "Govern identities and access in SailPoint Identity Security Cloud",
|
|
21020
|
+
longDescription: "Read and act on identity-governance data in SailPoint Identity Security Cloud (ISC) with a Personal Access Token (PAT) exchanged through OAuth2 client credentials at https://TENANT.api.identitynow.com/oauth/token. SailPoint versions each service independently, so the integration uses current service paths such as /search/v1, /identities/v1, and /access-requests/v1; there is no shared annual API-version setting. Use a PAT whose owner has the ISC user level required by each endpoint because many identity, role, access-profile, certification, approval, and access-request operations require user context in addition to scopes. Common read scopes include sp:search:read, idn:identity:read, idn:accounts:read, idn:entitlement:read, idn:role-unchecked:read or idn:role-checked:read, idn:access-profile:read, idn:sources:read, idn:campaign:read, idn:access-request-status:read, idn:access-request-config:read, idn:task-management:read, and idn:access-request-approvals:read. Mutations additionally use idn:sources:manage for account aggregation, idn:entitlement:manage for entitlement aggregation and entitlement request configuration, idn:campaign:manage for certification decisions and sign-off, the access-request scopes listed by SailPoint for request submission, idn:access-request:create for account-selection discovery, and idn:access-request-approvals:manage for approval actions. A scope alone does not grant authority beyond the PAT owner's ISC permissions, and authorization failures may be returned as provider errors or filtered visibility depending on the endpoint and tenant policy.",
|
|
21021
|
+
bgColor: "#FFFFFF",
|
|
21022
|
+
iconName: "SailPointIcon",
|
|
21023
|
+
docsUrl: "https://docs.sim.ai/integrations/sailpoint",
|
|
21024
|
+
operations: [
|
|
21025
|
+
{
|
|
21026
|
+
name: "Search",
|
|
21027
|
+
description: "Search current SailPoint indices with every documented search query mode."
|
|
21028
|
+
},
|
|
21029
|
+
{
|
|
21030
|
+
name: "Search Count",
|
|
21031
|
+
description: "Count documents matching a complete SailPoint search body."
|
|
21032
|
+
},
|
|
21033
|
+
{
|
|
21034
|
+
name: "Search Aggregate",
|
|
21035
|
+
description: "Run an Elasticsearch DSL or SailPoint aggregation over current search indices."
|
|
21036
|
+
},
|
|
21037
|
+
{
|
|
21038
|
+
name: "List Identities",
|
|
21039
|
+
description: "List identities with documented filtering, sorting, and pagination."
|
|
21040
|
+
},
|
|
21041
|
+
{
|
|
21042
|
+
name: "Get Identity",
|
|
21043
|
+
description: "Get an identity from the current /identities/v1 service by ID."
|
|
21044
|
+
},
|
|
21045
|
+
{
|
|
21046
|
+
name: "List Accounts",
|
|
21047
|
+
description: "List accounts with documented filtering, sorting, detail, and pagination."
|
|
21048
|
+
},
|
|
21049
|
+
{
|
|
21050
|
+
name: "Get Account",
|
|
21051
|
+
description: "Get an account from the current /accounts/v1 service by ID."
|
|
21052
|
+
},
|
|
21053
|
+
{
|
|
21054
|
+
name: "Get Account Entitlements",
|
|
21055
|
+
description: "List entitlements granted to one account."
|
|
21056
|
+
},
|
|
21057
|
+
{
|
|
21058
|
+
name: "Get Account Selections",
|
|
21059
|
+
description: "Resolve eligible source accounts before submitting a machine or multi-account access request."
|
|
21060
|
+
},
|
|
21061
|
+
{
|
|
21062
|
+
name: "List Entitlements",
|
|
21063
|
+
description: "List entitlements with current segmentation, cursor, filter, and page controls."
|
|
21064
|
+
},
|
|
21065
|
+
{
|
|
21066
|
+
name: "Get Entitlement",
|
|
21067
|
+
description: "Get an entitlement by ID."
|
|
21068
|
+
},
|
|
21069
|
+
{
|
|
21070
|
+
name: "Get Entitlement Request Config",
|
|
21071
|
+
description: "Get grant, revocation, duration, approval, and form settings for an entitlement."
|
|
21072
|
+
},
|
|
21073
|
+
{
|
|
21074
|
+
name: "List Identity Entitlements",
|
|
21075
|
+
description: "List tagged entitlement references held by one identity."
|
|
21076
|
+
},
|
|
21077
|
+
{
|
|
21078
|
+
name: "List Roles",
|
|
21079
|
+
description: "List roles with current visibility, segmentation, filtering, and pagination controls."
|
|
21080
|
+
},
|
|
21081
|
+
{
|
|
21082
|
+
name: "Get Role",
|
|
21083
|
+
description: "Get a role by ID."
|
|
21084
|
+
},
|
|
21085
|
+
{
|
|
21086
|
+
name: "Get Role Entitlements",
|
|
21087
|
+
description: "List entitlements in one role using the current non-experimental roles service."
|
|
21088
|
+
},
|
|
21089
|
+
{
|
|
21090
|
+
name: "List Access Profiles",
|
|
21091
|
+
description: "List access profiles with current visibility and segmentation controls."
|
|
21092
|
+
},
|
|
21093
|
+
{
|
|
21094
|
+
name: "Get Access Profile",
|
|
21095
|
+
description: "Get an access profile by ID."
|
|
21096
|
+
},
|
|
21097
|
+
{
|
|
21098
|
+
name: "Get Access Profile Entitlements",
|
|
21099
|
+
description: "List entitlements in one access profile."
|
|
21100
|
+
},
|
|
21101
|
+
{
|
|
21102
|
+
name: "Get Access Request Config",
|
|
21103
|
+
description: "Get tenant access-request, request-on-behalf-of, and machine-identity configuration."
|
|
21104
|
+
},
|
|
21105
|
+
{
|
|
21106
|
+
name: "List Sources",
|
|
21107
|
+
description: "List identity sources with visibility, filtering, sorting, and pagination controls."
|
|
21108
|
+
},
|
|
21109
|
+
{
|
|
21110
|
+
name: "Get Source",
|
|
21111
|
+
description: "Get an identity source by ID."
|
|
21112
|
+
},
|
|
21113
|
+
{
|
|
21114
|
+
name: "List Account Activities",
|
|
21115
|
+
description: "List provisioning activities with identity, filter, sort, and page controls."
|
|
21116
|
+
},
|
|
21117
|
+
{
|
|
21118
|
+
name: "Get Account Activity",
|
|
21119
|
+
description: "Get an account activity by ID."
|
|
21120
|
+
},
|
|
21121
|
+
{
|
|
21122
|
+
name: "List Campaigns",
|
|
21123
|
+
description: "List certification campaigns with detail, filtering, sorting, and pagination."
|
|
21124
|
+
},
|
|
21125
|
+
{
|
|
21126
|
+
name: "Get Campaign",
|
|
21127
|
+
description: "Get a certification campaign by ID."
|
|
21128
|
+
},
|
|
21129
|
+
{
|
|
21130
|
+
name: "List Certifications",
|
|
21131
|
+
description: "List identity certifications assigned to a reviewer."
|
|
21132
|
+
},
|
|
21133
|
+
{
|
|
21134
|
+
name: "Get Certification",
|
|
21135
|
+
description: "Get an identity certification by ID."
|
|
21136
|
+
},
|
|
21137
|
+
{
|
|
21138
|
+
name: "List Certification Review Items",
|
|
21139
|
+
description: "List access-review items in one identity certification."
|
|
21140
|
+
},
|
|
21141
|
+
{
|
|
21142
|
+
name: "Decide Certification Review Items",
|
|
21143
|
+
description: "Approve or revoke 1-250 review items in an identity certification."
|
|
21144
|
+
},
|
|
21145
|
+
{
|
|
21146
|
+
name: "Sign Off Certification",
|
|
21147
|
+
description: "Sign off a completed identity certification."
|
|
21148
|
+
},
|
|
21149
|
+
{
|
|
21150
|
+
name: "Request Access",
|
|
21151
|
+
description: "Submit a current human or machine identity access request."
|
|
21152
|
+
},
|
|
21153
|
+
{
|
|
21154
|
+
name: "Cancel Access Request",
|
|
21155
|
+
description: "Cancel an access request that has not passed approval."
|
|
21156
|
+
},
|
|
21157
|
+
{
|
|
21158
|
+
name: "Get Access Request Status",
|
|
21159
|
+
description: "List requested-item status records for access requests."
|
|
21160
|
+
},
|
|
21161
|
+
{
|
|
21162
|
+
name: "List Pending Access Request Approvals",
|
|
21163
|
+
description: "List pending access-request approvals visible to the caller."
|
|
21164
|
+
},
|
|
21165
|
+
{
|
|
21166
|
+
name: "Approve Access Request",
|
|
21167
|
+
description: "Approve one pending access-request approval."
|
|
21168
|
+
},
|
|
21169
|
+
{
|
|
21170
|
+
name: "Reject Access Request",
|
|
21171
|
+
description: "Reject one pending access-request approval with a reviewer comment."
|
|
21172
|
+
},
|
|
21173
|
+
{
|
|
21174
|
+
name: "Load Accounts (CSV)",
|
|
21175
|
+
description: "Start account aggregation for a source, optionally using a CSV file."
|
|
21176
|
+
},
|
|
21177
|
+
{
|
|
21178
|
+
name: "Load Entitlements (CSV)",
|
|
21179
|
+
description: "Start entitlement aggregation for a source, optionally using a CSV file."
|
|
21180
|
+
},
|
|
21181
|
+
{
|
|
21182
|
+
name: "Get Task Status",
|
|
21183
|
+
description: "Get the current status of a SailPoint background task by ID."
|
|
21184
|
+
}
|
|
21185
|
+
],
|
|
21186
|
+
operationCount: 40,
|
|
21187
|
+
triggers: [],
|
|
21188
|
+
triggerCount: 0,
|
|
21189
|
+
authType: "api-key",
|
|
21190
|
+
category: "tools",
|
|
21191
|
+
integrationType: "security",
|
|
21192
|
+
tags: ["identity", "automation"]
|
|
21193
|
+
},
|
|
20900
21194
|
{
|
|
20901
21195
|
type: "salesforce",
|
|
20902
21196
|
slug: "salesforce",
|
|
@@ -22519,8 +22813,8 @@ var init_integrations = __esm(() => {
|
|
|
22519
22813
|
type: "slack_v2",
|
|
22520
22814
|
slug: "slack",
|
|
22521
22815
|
name: "Slack",
|
|
22522
|
-
description: "Send
|
|
22523
|
-
longDescription: "Integrate Slack
|
|
22816
|
+
description: "Send and manage Slack messages, Agent Sessions, streamed replies, views, reactions, conversations, and canvases",
|
|
22817
|
+
longDescription: "Integrate Slack messaging and administration into a workflow. Custom Slack bots can manage Agent Sessions, stream incremental Markdown or structured chunks, react to Agent Session events, and configure Agent View suggested prompts. Standard messaging and management operations support both the Sim app and custom bot credentials.",
|
|
22524
22818
|
bgColor: "#611f69",
|
|
22525
22819
|
iconName: "SlackIcon",
|
|
22526
22820
|
docsUrl: "https://docs.sim.ai/integrations/slack",
|
|
@@ -22570,12 +22864,24 @@ var init_integrations = __esm(() => {
|
|
|
22570
22864
|
description: "Set the title of a Slack assistant thread (shown in the AI app thread header)."
|
|
22571
22865
|
},
|
|
22572
22866
|
{
|
|
22573
|
-
name: "Set Suggested Prompts",
|
|
22867
|
+
name: "Set Assistant Suggested Prompts",
|
|
22574
22868
|
description: "Set the clickable suggested prompts shown in a Slack assistant thread (the prompt chips in an AI app)."
|
|
22575
22869
|
},
|
|
22870
|
+
{
|
|
22871
|
+
name: "Set Agent Suggested Prompts",
|
|
22872
|
+
description: "Set suggested prompts in Slack Agent View, optionally scoped to a specific thread."
|
|
22873
|
+
},
|
|
22874
|
+
{
|
|
22875
|
+
name: "Set Agent Session Status",
|
|
22876
|
+
description: "Create or update the state of a Slack agent session associated with a thread."
|
|
22877
|
+
},
|
|
22878
|
+
{
|
|
22879
|
+
name: "Rename Agent Session",
|
|
22880
|
+
description: "Rename the Slack agent session associated with a thread."
|
|
22881
|
+
},
|
|
22576
22882
|
{
|
|
22577
22883
|
name: "List Channels",
|
|
22578
|
-
description: "List
|
|
22884
|
+
description: "List accessible Slack conversations. Credential-group user tokens also return one-to-one and group direct messages."
|
|
22579
22885
|
},
|
|
22580
22886
|
{
|
|
22581
22887
|
name: "List Channel Members",
|
|
@@ -22694,12 +23000,12 @@ var init_integrations = __esm(() => {
|
|
|
22694
23000
|
description: "Set the purpose (description) for a Slack channel (max 250 characters)."
|
|
22695
23001
|
}
|
|
22696
23002
|
],
|
|
22697
|
-
operationCount:
|
|
23003
|
+
operationCount: 45,
|
|
22698
23004
|
triggers: [
|
|
22699
23005
|
{
|
|
22700
23006
|
id: "slack_oauth",
|
|
22701
23007
|
name: "Slack",
|
|
22702
|
-
description: "Trigger from Slack events
|
|
23008
|
+
description: "Trigger from Slack events, interactions, and slash commands"
|
|
22703
23009
|
}
|
|
22704
23010
|
],
|
|
22705
23011
|
triggerCount: 1,
|
|
@@ -26494,7 +26800,7 @@ var init_integrations = __esm(() => {
|
|
|
26494
26800
|
operations: [
|
|
26495
26801
|
{
|
|
26496
26802
|
name: "List Items",
|
|
26497
|
-
description: "List
|
|
26803
|
+
description: "List items from a Webflow CMS collection"
|
|
26498
26804
|
},
|
|
26499
26805
|
{
|
|
26500
26806
|
name: "Get Item",
|
|
@@ -35827,6 +36133,923 @@ var init_capability_setup = __esm(() => {
|
|
|
35827
36133
|
init_prompter();
|
|
35828
36134
|
});
|
|
35829
36135
|
|
|
36136
|
+
// ../../node_modules/ipaddr.js/lib/ipaddr.js
|
|
36137
|
+
var require_ipaddr = __commonJS((exports, module) => {
|
|
36138
|
+
(function(root) {
|
|
36139
|
+
const ipv4Part = "(0?\\d+|0x[a-f0-9]+)";
|
|
36140
|
+
const ipv4Regexes = {
|
|
36141
|
+
fourOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, "i"),
|
|
36142
|
+
threeOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, "i"),
|
|
36143
|
+
twoOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}$`, "i"),
|
|
36144
|
+
longValue: new RegExp(`^${ipv4Part}$`, "i")
|
|
36145
|
+
};
|
|
36146
|
+
const octalRegex = new RegExp(`^0[0-7]+$`, "i");
|
|
36147
|
+
const hexRegex = new RegExp(`^0x[a-f0-9]+$`, "i");
|
|
36148
|
+
const zoneIndex = "%[0-9a-z]{1,}";
|
|
36149
|
+
const ipv6Part = "(?:[0-9a-f]+::?)+";
|
|
36150
|
+
const ipv6Regexes = {
|
|
36151
|
+
zoneIndex: new RegExp(zoneIndex, "i"),
|
|
36152
|
+
native: new RegExp(`^(::)?(${ipv6Part})?([0-9a-f]+)?(::)?(${zoneIndex})?$`, "i"),
|
|
36153
|
+
deprecatedTransitional: new RegExp(`^(?:::)(${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?)$`, "i"),
|
|
36154
|
+
transitional: new RegExp(`^((?:${ipv6Part})|(?:::)(?:${ipv6Part})?)${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?$`, "i")
|
|
36155
|
+
};
|
|
36156
|
+
function expandIPv6(string, parts) {
|
|
36157
|
+
if (string.indexOf("::") !== string.lastIndexOf("::")) {
|
|
36158
|
+
return null;
|
|
36159
|
+
}
|
|
36160
|
+
let colonCount = 0;
|
|
36161
|
+
let lastColon = -1;
|
|
36162
|
+
let zoneId = (string.match(ipv6Regexes.zoneIndex) || [])[0];
|
|
36163
|
+
let replacement, replacementCount;
|
|
36164
|
+
if (zoneId) {
|
|
36165
|
+
zoneId = zoneId.substring(1);
|
|
36166
|
+
string = string.replace(/%.+$/, "");
|
|
36167
|
+
}
|
|
36168
|
+
while ((lastColon = string.indexOf(":", lastColon + 1)) >= 0) {
|
|
36169
|
+
colonCount++;
|
|
36170
|
+
}
|
|
36171
|
+
if (string.substr(0, 2) === "::") {
|
|
36172
|
+
colonCount--;
|
|
36173
|
+
}
|
|
36174
|
+
if (string.substr(-2, 2) === "::") {
|
|
36175
|
+
colonCount--;
|
|
36176
|
+
}
|
|
36177
|
+
if (colonCount > parts) {
|
|
36178
|
+
return null;
|
|
36179
|
+
}
|
|
36180
|
+
replacementCount = parts - colonCount;
|
|
36181
|
+
replacement = ":";
|
|
36182
|
+
while (replacementCount--) {
|
|
36183
|
+
replacement += "0:";
|
|
36184
|
+
}
|
|
36185
|
+
string = string.replace("::", replacement);
|
|
36186
|
+
if (string[0] === ":") {
|
|
36187
|
+
string = string.slice(1);
|
|
36188
|
+
}
|
|
36189
|
+
if (string[string.length - 1] === ":") {
|
|
36190
|
+
string = string.slice(0, -1);
|
|
36191
|
+
}
|
|
36192
|
+
parts = function() {
|
|
36193
|
+
const ref = string.split(":");
|
|
36194
|
+
const results = [];
|
|
36195
|
+
for (let i2 = 0;i2 < ref.length; i2++) {
|
|
36196
|
+
results.push(parseInt(ref[i2], 16));
|
|
36197
|
+
}
|
|
36198
|
+
return results;
|
|
36199
|
+
}();
|
|
36200
|
+
return {
|
|
36201
|
+
parts,
|
|
36202
|
+
zoneId
|
|
36203
|
+
};
|
|
36204
|
+
}
|
|
36205
|
+
function matchCIDR(first, second, partSize, cidrBits) {
|
|
36206
|
+
if (first.length !== second.length) {
|
|
36207
|
+
throw new Error("ipaddr: cannot match CIDR for objects with different lengths");
|
|
36208
|
+
}
|
|
36209
|
+
let part = 0;
|
|
36210
|
+
let shift;
|
|
36211
|
+
while (cidrBits > 0) {
|
|
36212
|
+
shift = partSize - cidrBits;
|
|
36213
|
+
if (shift < 0) {
|
|
36214
|
+
shift = 0;
|
|
36215
|
+
}
|
|
36216
|
+
if (first[part] >> shift !== second[part] >> shift) {
|
|
36217
|
+
return false;
|
|
36218
|
+
}
|
|
36219
|
+
cidrBits -= partSize;
|
|
36220
|
+
part += 1;
|
|
36221
|
+
}
|
|
36222
|
+
return true;
|
|
36223
|
+
}
|
|
36224
|
+
function parseIntAuto(string) {
|
|
36225
|
+
if (hexRegex.test(string)) {
|
|
36226
|
+
return parseInt(string, 16);
|
|
36227
|
+
}
|
|
36228
|
+
if (string[0] === "0" && !isNaN(parseInt(string[1], 10))) {
|
|
36229
|
+
if (octalRegex.test(string)) {
|
|
36230
|
+
return parseInt(string, 8);
|
|
36231
|
+
}
|
|
36232
|
+
throw new Error(`ipaddr: cannot parse ${string} as octal`);
|
|
36233
|
+
}
|
|
36234
|
+
return parseInt(string, 10);
|
|
36235
|
+
}
|
|
36236
|
+
function padPart(part, length) {
|
|
36237
|
+
while (part.length < length) {
|
|
36238
|
+
part = `0${part}`;
|
|
36239
|
+
}
|
|
36240
|
+
return part;
|
|
36241
|
+
}
|
|
36242
|
+
const ipaddr = {};
|
|
36243
|
+
ipaddr.IPv4 = function() {
|
|
36244
|
+
function IPv4(octets) {
|
|
36245
|
+
if (octets.length !== 4) {
|
|
36246
|
+
throw new Error("ipaddr: ipv4 octet count should be 4");
|
|
36247
|
+
}
|
|
36248
|
+
let i2, octet;
|
|
36249
|
+
for (i2 = 0;i2 < octets.length; i2++) {
|
|
36250
|
+
octet = octets[i2];
|
|
36251
|
+
if (!(0 <= octet && octet <= 255)) {
|
|
36252
|
+
throw new Error("ipaddr: ipv4 octet should fit in 8 bits");
|
|
36253
|
+
}
|
|
36254
|
+
}
|
|
36255
|
+
this.octets = octets;
|
|
36256
|
+
}
|
|
36257
|
+
IPv4.prototype.SpecialRanges = {
|
|
36258
|
+
unspecified: [[new IPv4([0, 0, 0, 0]), 8]],
|
|
36259
|
+
broadcast: [[new IPv4([255, 255, 255, 255]), 32]],
|
|
36260
|
+
multicast: [[new IPv4([224, 0, 0, 0]), 4]],
|
|
36261
|
+
linkLocal: [[new IPv4([169, 254, 0, 0]), 16]],
|
|
36262
|
+
loopback: [[new IPv4([127, 0, 0, 0]), 8]],
|
|
36263
|
+
carrierGradeNat: [[new IPv4([100, 64, 0, 0]), 10]],
|
|
36264
|
+
private: [
|
|
36265
|
+
[new IPv4([10, 0, 0, 0]), 8],
|
|
36266
|
+
[new IPv4([172, 16, 0, 0]), 12],
|
|
36267
|
+
[new IPv4([192, 168, 0, 0]), 16]
|
|
36268
|
+
],
|
|
36269
|
+
reserved: [
|
|
36270
|
+
[new IPv4([192, 0, 0, 0]), 24],
|
|
36271
|
+
[new IPv4([192, 0, 2, 0]), 24],
|
|
36272
|
+
[new IPv4([192, 88, 99, 0]), 24],
|
|
36273
|
+
[new IPv4([198, 18, 0, 0]), 15],
|
|
36274
|
+
[new IPv4([198, 51, 100, 0]), 24],
|
|
36275
|
+
[new IPv4([203, 0, 113, 0]), 24],
|
|
36276
|
+
[new IPv4([240, 0, 0, 0]), 4]
|
|
36277
|
+
],
|
|
36278
|
+
as112: [
|
|
36279
|
+
[new IPv4([192, 175, 48, 0]), 24],
|
|
36280
|
+
[new IPv4([192, 31, 196, 0]), 24]
|
|
36281
|
+
],
|
|
36282
|
+
amt: [
|
|
36283
|
+
[new IPv4([192, 52, 193, 0]), 24]
|
|
36284
|
+
]
|
|
36285
|
+
};
|
|
36286
|
+
IPv4.prototype.kind = function() {
|
|
36287
|
+
return "ipv4";
|
|
36288
|
+
};
|
|
36289
|
+
IPv4.prototype.match = function(other, cidrRange) {
|
|
36290
|
+
let ref;
|
|
36291
|
+
if (cidrRange === undefined) {
|
|
36292
|
+
ref = other;
|
|
36293
|
+
other = ref[0];
|
|
36294
|
+
cidrRange = ref[1];
|
|
36295
|
+
}
|
|
36296
|
+
if (other.kind() !== "ipv4") {
|
|
36297
|
+
throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");
|
|
36298
|
+
}
|
|
36299
|
+
return matchCIDR(this.octets, other.octets, 8, cidrRange);
|
|
36300
|
+
};
|
|
36301
|
+
IPv4.prototype.prefixLengthFromSubnetMask = function() {
|
|
36302
|
+
let cidr = 0;
|
|
36303
|
+
let stop = false;
|
|
36304
|
+
const zerotable = {
|
|
36305
|
+
0: 8,
|
|
36306
|
+
128: 7,
|
|
36307
|
+
192: 6,
|
|
36308
|
+
224: 5,
|
|
36309
|
+
240: 4,
|
|
36310
|
+
248: 3,
|
|
36311
|
+
252: 2,
|
|
36312
|
+
254: 1,
|
|
36313
|
+
255: 0
|
|
36314
|
+
};
|
|
36315
|
+
let i2, octet, zeros;
|
|
36316
|
+
for (i2 = 3;i2 >= 0; i2 -= 1) {
|
|
36317
|
+
octet = this.octets[i2];
|
|
36318
|
+
if (octet in zerotable) {
|
|
36319
|
+
zeros = zerotable[octet];
|
|
36320
|
+
if (stop && zeros !== 0) {
|
|
36321
|
+
return null;
|
|
36322
|
+
}
|
|
36323
|
+
if (zeros !== 8) {
|
|
36324
|
+
stop = true;
|
|
36325
|
+
}
|
|
36326
|
+
cidr += zeros;
|
|
36327
|
+
} else {
|
|
36328
|
+
return null;
|
|
36329
|
+
}
|
|
36330
|
+
}
|
|
36331
|
+
return 32 - cidr;
|
|
36332
|
+
};
|
|
36333
|
+
IPv4.prototype.range = function() {
|
|
36334
|
+
return ipaddr.subnetMatch(this, this.SpecialRanges);
|
|
36335
|
+
};
|
|
36336
|
+
IPv4.prototype.toByteArray = function() {
|
|
36337
|
+
return this.octets.slice(0);
|
|
36338
|
+
};
|
|
36339
|
+
IPv4.prototype.toIPv4MappedAddress = function() {
|
|
36340
|
+
return ipaddr.IPv6.parse(`::ffff:${this.toString()}`);
|
|
36341
|
+
};
|
|
36342
|
+
IPv4.prototype.toNormalizedString = function() {
|
|
36343
|
+
return this.toString();
|
|
36344
|
+
};
|
|
36345
|
+
IPv4.prototype.toString = function() {
|
|
36346
|
+
return this.octets.join(".");
|
|
36347
|
+
};
|
|
36348
|
+
return IPv4;
|
|
36349
|
+
}();
|
|
36350
|
+
ipaddr.IPv4.broadcastAddressFromCIDR = function(string) {
|
|
36351
|
+
try {
|
|
36352
|
+
const cidr = this.parseCIDR(string);
|
|
36353
|
+
const ipInterfaceOctets = cidr[0].toByteArray();
|
|
36354
|
+
const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
|
|
36355
|
+
const octets = [];
|
|
36356
|
+
let i2 = 0;
|
|
36357
|
+
while (i2 < 4) {
|
|
36358
|
+
octets.push(parseInt(ipInterfaceOctets[i2], 10) | parseInt(subnetMaskOctets[i2], 10) ^ 255);
|
|
36359
|
+
i2++;
|
|
36360
|
+
}
|
|
36361
|
+
return new this(octets);
|
|
36362
|
+
} catch (e) {
|
|
36363
|
+
throw new Error("ipaddr: the address does not have IPv4 CIDR format");
|
|
36364
|
+
}
|
|
36365
|
+
};
|
|
36366
|
+
ipaddr.IPv4.isIPv4 = function(string) {
|
|
36367
|
+
return this.parser(string) !== null;
|
|
36368
|
+
};
|
|
36369
|
+
ipaddr.IPv4.isValid = function(string) {
|
|
36370
|
+
try {
|
|
36371
|
+
new this(this.parser(string));
|
|
36372
|
+
return true;
|
|
36373
|
+
} catch (e) {
|
|
36374
|
+
return false;
|
|
36375
|
+
}
|
|
36376
|
+
};
|
|
36377
|
+
ipaddr.IPv4.isValidCIDR = function(string) {
|
|
36378
|
+
try {
|
|
36379
|
+
this.parseCIDR(string);
|
|
36380
|
+
return true;
|
|
36381
|
+
} catch (e) {
|
|
36382
|
+
return false;
|
|
36383
|
+
}
|
|
36384
|
+
};
|
|
36385
|
+
ipaddr.IPv4.isValidFourPartDecimal = function(string) {
|
|
36386
|
+
if (ipaddr.IPv4.isValid(string) && string.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)) {
|
|
36387
|
+
return true;
|
|
36388
|
+
} else {
|
|
36389
|
+
return false;
|
|
36390
|
+
}
|
|
36391
|
+
};
|
|
36392
|
+
ipaddr.IPv4.isValidCIDRFourPartDecimal = function(string) {
|
|
36393
|
+
const match = string.match(/^(.+)\/(\d+)$/);
|
|
36394
|
+
if (!ipaddr.IPv4.isValidCIDR(string) || !match) {
|
|
36395
|
+
return false;
|
|
36396
|
+
}
|
|
36397
|
+
return ipaddr.IPv4.isValidFourPartDecimal(match[1]);
|
|
36398
|
+
};
|
|
36399
|
+
ipaddr.IPv4.networkAddressFromCIDR = function(string) {
|
|
36400
|
+
let cidr, i2, ipInterfaceOctets, octets, subnetMaskOctets;
|
|
36401
|
+
try {
|
|
36402
|
+
cidr = this.parseCIDR(string);
|
|
36403
|
+
ipInterfaceOctets = cidr[0].toByteArray();
|
|
36404
|
+
subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
|
|
36405
|
+
octets = [];
|
|
36406
|
+
i2 = 0;
|
|
36407
|
+
while (i2 < 4) {
|
|
36408
|
+
octets.push(parseInt(ipInterfaceOctets[i2], 10) & parseInt(subnetMaskOctets[i2], 10));
|
|
36409
|
+
i2++;
|
|
36410
|
+
}
|
|
36411
|
+
return new this(octets);
|
|
36412
|
+
} catch (e) {
|
|
36413
|
+
throw new Error("ipaddr: the address does not have IPv4 CIDR format");
|
|
36414
|
+
}
|
|
36415
|
+
};
|
|
36416
|
+
ipaddr.IPv4.parse = function(string) {
|
|
36417
|
+
const parts = this.parser(string);
|
|
36418
|
+
if (parts === null) {
|
|
36419
|
+
throw new Error("ipaddr: string is not formatted like an IPv4 Address");
|
|
36420
|
+
}
|
|
36421
|
+
return new this(parts);
|
|
36422
|
+
};
|
|
36423
|
+
ipaddr.IPv4.parseCIDR = function(string) {
|
|
36424
|
+
let match;
|
|
36425
|
+
if (match = string.match(/^(.+)\/(\d+)$/)) {
|
|
36426
|
+
const maskLength = parseInt(match[2]);
|
|
36427
|
+
if (maskLength >= 0 && maskLength <= 32) {
|
|
36428
|
+
const parsed = [this.parse(match[1]), maskLength];
|
|
36429
|
+
Object.defineProperty(parsed, "toString", {
|
|
36430
|
+
value: function() {
|
|
36431
|
+
return this.join("/");
|
|
36432
|
+
}
|
|
36433
|
+
});
|
|
36434
|
+
return parsed;
|
|
36435
|
+
}
|
|
36436
|
+
}
|
|
36437
|
+
throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range");
|
|
36438
|
+
};
|
|
36439
|
+
ipaddr.IPv4.parser = function(string) {
|
|
36440
|
+
let match, part, value;
|
|
36441
|
+
if (match = string.match(ipv4Regexes.fourOctet)) {
|
|
36442
|
+
return function() {
|
|
36443
|
+
const ref = match.slice(1, 6);
|
|
36444
|
+
const results = [];
|
|
36445
|
+
for (let i2 = 0;i2 < ref.length; i2++) {
|
|
36446
|
+
part = ref[i2];
|
|
36447
|
+
results.push(parseIntAuto(part));
|
|
36448
|
+
}
|
|
36449
|
+
return results;
|
|
36450
|
+
}();
|
|
36451
|
+
} else if (match = string.match(ipv4Regexes.longValue)) {
|
|
36452
|
+
value = parseIntAuto(match[1]);
|
|
36453
|
+
if (value > 4294967295 || value < 0) {
|
|
36454
|
+
throw new Error("ipaddr: address outside defined range");
|
|
36455
|
+
}
|
|
36456
|
+
return function() {
|
|
36457
|
+
const results = [];
|
|
36458
|
+
let shift;
|
|
36459
|
+
for (shift = 0;shift <= 24; shift += 8) {
|
|
36460
|
+
results.push(value >> shift & 255);
|
|
36461
|
+
}
|
|
36462
|
+
return results;
|
|
36463
|
+
}().reverse();
|
|
36464
|
+
} else if (match = string.match(ipv4Regexes.twoOctet)) {
|
|
36465
|
+
return function() {
|
|
36466
|
+
const ref = match.slice(1, 4);
|
|
36467
|
+
const results = [];
|
|
36468
|
+
value = parseIntAuto(ref[1]);
|
|
36469
|
+
if (value > 16777215 || value < 0) {
|
|
36470
|
+
throw new Error("ipaddr: address outside defined range");
|
|
36471
|
+
}
|
|
36472
|
+
results.push(parseIntAuto(ref[0]));
|
|
36473
|
+
results.push(value >> 16 & 255);
|
|
36474
|
+
results.push(value >> 8 & 255);
|
|
36475
|
+
results.push(value & 255);
|
|
36476
|
+
return results;
|
|
36477
|
+
}();
|
|
36478
|
+
} else if (match = string.match(ipv4Regexes.threeOctet)) {
|
|
36479
|
+
return function() {
|
|
36480
|
+
const ref = match.slice(1, 5);
|
|
36481
|
+
const results = [];
|
|
36482
|
+
value = parseIntAuto(ref[2]);
|
|
36483
|
+
if (value > 65535 || value < 0) {
|
|
36484
|
+
throw new Error("ipaddr: address outside defined range");
|
|
36485
|
+
}
|
|
36486
|
+
results.push(parseIntAuto(ref[0]));
|
|
36487
|
+
results.push(parseIntAuto(ref[1]));
|
|
36488
|
+
results.push(value >> 8 & 255);
|
|
36489
|
+
results.push(value & 255);
|
|
36490
|
+
return results;
|
|
36491
|
+
}();
|
|
36492
|
+
} else {
|
|
36493
|
+
return null;
|
|
36494
|
+
}
|
|
36495
|
+
};
|
|
36496
|
+
ipaddr.IPv4.subnetMaskFromPrefixLength = function(prefix) {
|
|
36497
|
+
prefix = parseInt(prefix);
|
|
36498
|
+
if (prefix < 0 || prefix > 32) {
|
|
36499
|
+
throw new Error("ipaddr: invalid IPv4 prefix length");
|
|
36500
|
+
}
|
|
36501
|
+
const octets = [0, 0, 0, 0];
|
|
36502
|
+
let j = 0;
|
|
36503
|
+
const filledOctetCount = Math.floor(prefix / 8);
|
|
36504
|
+
while (j < filledOctetCount) {
|
|
36505
|
+
octets[j] = 255;
|
|
36506
|
+
j++;
|
|
36507
|
+
}
|
|
36508
|
+
if (filledOctetCount < 4) {
|
|
36509
|
+
octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - prefix % 8;
|
|
36510
|
+
}
|
|
36511
|
+
return new this(octets);
|
|
36512
|
+
};
|
|
36513
|
+
ipaddr.IPv6 = function() {
|
|
36514
|
+
function IPv6(parts, zoneId) {
|
|
36515
|
+
let i2, part;
|
|
36516
|
+
if (parts.length === 16) {
|
|
36517
|
+
this.parts = [];
|
|
36518
|
+
for (i2 = 0;i2 <= 14; i2 += 2) {
|
|
36519
|
+
this.parts.push(parts[i2] << 8 | parts[i2 + 1]);
|
|
36520
|
+
}
|
|
36521
|
+
} else if (parts.length === 8) {
|
|
36522
|
+
this.parts = parts;
|
|
36523
|
+
} else {
|
|
36524
|
+
throw new Error("ipaddr: ipv6 part count should be 8 or 16");
|
|
36525
|
+
}
|
|
36526
|
+
for (i2 = 0;i2 < this.parts.length; i2++) {
|
|
36527
|
+
part = this.parts[i2];
|
|
36528
|
+
if (!(0 <= part && part <= 65535)) {
|
|
36529
|
+
throw new Error("ipaddr: ipv6 part should fit in 16 bits");
|
|
36530
|
+
}
|
|
36531
|
+
}
|
|
36532
|
+
if (zoneId) {
|
|
36533
|
+
this.zoneId = zoneId;
|
|
36534
|
+
}
|
|
36535
|
+
}
|
|
36536
|
+
IPv6.prototype.SpecialRanges = {
|
|
36537
|
+
unspecified: [new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128],
|
|
36538
|
+
linkLocal: [new IPv6([65152, 0, 0, 0, 0, 0, 0, 0]), 10],
|
|
36539
|
+
multicast: [new IPv6([65280, 0, 0, 0, 0, 0, 0, 0]), 8],
|
|
36540
|
+
loopback: [new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128],
|
|
36541
|
+
uniqueLocal: [new IPv6([64512, 0, 0, 0, 0, 0, 0, 0]), 7],
|
|
36542
|
+
ipv4Mapped: [new IPv6([0, 0, 0, 0, 0, 65535, 0, 0]), 96],
|
|
36543
|
+
discard: [new IPv6([256, 0, 0, 0, 0, 0, 0, 0]), 64],
|
|
36544
|
+
rfc6145: [new IPv6([0, 0, 0, 0, 65535, 0, 0, 0]), 96],
|
|
36545
|
+
rfc6052: [new IPv6([100, 65435, 0, 0, 0, 0, 0, 0]), 96],
|
|
36546
|
+
"6to4": [new IPv6([8194, 0, 0, 0, 0, 0, 0, 0]), 16],
|
|
36547
|
+
teredo: [new IPv6([8193, 0, 0, 0, 0, 0, 0, 0]), 32],
|
|
36548
|
+
benchmarking: [new IPv6([8193, 2, 0, 0, 0, 0, 0, 0]), 48],
|
|
36549
|
+
amt: [new IPv6([8193, 3, 0, 0, 0, 0, 0, 0]), 32],
|
|
36550
|
+
as112v6: [
|
|
36551
|
+
[new IPv6([8193, 4, 274, 0, 0, 0, 0, 0]), 48],
|
|
36552
|
+
[new IPv6([9760, 79, 32768, 0, 0, 0, 0, 0]), 48]
|
|
36553
|
+
],
|
|
36554
|
+
deprecated: [new IPv6([8193, 16, 0, 0, 0, 0, 0, 0]), 28],
|
|
36555
|
+
orchid2: [new IPv6([8193, 32, 0, 0, 0, 0, 0, 0]), 28],
|
|
36556
|
+
droneRemoteIdProtocolEntityTags: [new IPv6([8193, 48, 0, 0, 0, 0, 0, 0]), 28],
|
|
36557
|
+
reserved: [
|
|
36558
|
+
[new IPv6([8193, 0, 0, 0, 0, 0, 0, 0]), 23],
|
|
36559
|
+
[new IPv6([8193, 3512, 0, 0, 0, 0, 0, 0]), 32]
|
|
36560
|
+
]
|
|
36561
|
+
};
|
|
36562
|
+
IPv6.prototype.isIPv4MappedAddress = function() {
|
|
36563
|
+
return this.range() === "ipv4Mapped";
|
|
36564
|
+
};
|
|
36565
|
+
IPv6.prototype.kind = function() {
|
|
36566
|
+
return "ipv6";
|
|
36567
|
+
};
|
|
36568
|
+
IPv6.prototype.match = function(other, cidrRange) {
|
|
36569
|
+
let ref;
|
|
36570
|
+
if (cidrRange === undefined) {
|
|
36571
|
+
ref = other;
|
|
36572
|
+
other = ref[0];
|
|
36573
|
+
cidrRange = ref[1];
|
|
36574
|
+
}
|
|
36575
|
+
if (other.kind() !== "ipv6") {
|
|
36576
|
+
throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");
|
|
36577
|
+
}
|
|
36578
|
+
return matchCIDR(this.parts, other.parts, 16, cidrRange);
|
|
36579
|
+
};
|
|
36580
|
+
IPv6.prototype.prefixLengthFromSubnetMask = function() {
|
|
36581
|
+
let cidr = 0;
|
|
36582
|
+
let stop = false;
|
|
36583
|
+
const zerotable = {
|
|
36584
|
+
0: 16,
|
|
36585
|
+
32768: 15,
|
|
36586
|
+
49152: 14,
|
|
36587
|
+
57344: 13,
|
|
36588
|
+
61440: 12,
|
|
36589
|
+
63488: 11,
|
|
36590
|
+
64512: 10,
|
|
36591
|
+
65024: 9,
|
|
36592
|
+
65280: 8,
|
|
36593
|
+
65408: 7,
|
|
36594
|
+
65472: 6,
|
|
36595
|
+
65504: 5,
|
|
36596
|
+
65520: 4,
|
|
36597
|
+
65528: 3,
|
|
36598
|
+
65532: 2,
|
|
36599
|
+
65534: 1,
|
|
36600
|
+
65535: 0
|
|
36601
|
+
};
|
|
36602
|
+
let part, zeros;
|
|
36603
|
+
for (let i2 = 7;i2 >= 0; i2 -= 1) {
|
|
36604
|
+
part = this.parts[i2];
|
|
36605
|
+
if (part in zerotable) {
|
|
36606
|
+
zeros = zerotable[part];
|
|
36607
|
+
if (stop && zeros !== 0) {
|
|
36608
|
+
return null;
|
|
36609
|
+
}
|
|
36610
|
+
if (zeros !== 16) {
|
|
36611
|
+
stop = true;
|
|
36612
|
+
}
|
|
36613
|
+
cidr += zeros;
|
|
36614
|
+
} else {
|
|
36615
|
+
return null;
|
|
36616
|
+
}
|
|
36617
|
+
}
|
|
36618
|
+
return 128 - cidr;
|
|
36619
|
+
};
|
|
36620
|
+
IPv6.prototype.range = function() {
|
|
36621
|
+
return ipaddr.subnetMatch(this, this.SpecialRanges);
|
|
36622
|
+
};
|
|
36623
|
+
IPv6.prototype.toByteArray = function() {
|
|
36624
|
+
let part;
|
|
36625
|
+
const bytes = [];
|
|
36626
|
+
const ref = this.parts;
|
|
36627
|
+
for (let i2 = 0;i2 < ref.length; i2++) {
|
|
36628
|
+
part = ref[i2];
|
|
36629
|
+
bytes.push(part >> 8);
|
|
36630
|
+
bytes.push(part & 255);
|
|
36631
|
+
}
|
|
36632
|
+
return bytes;
|
|
36633
|
+
};
|
|
36634
|
+
IPv6.prototype.toFixedLengthString = function() {
|
|
36635
|
+
const addr = function() {
|
|
36636
|
+
const results = [];
|
|
36637
|
+
for (let i2 = 0;i2 < this.parts.length; i2++) {
|
|
36638
|
+
results.push(padPart(this.parts[i2].toString(16), 4));
|
|
36639
|
+
}
|
|
36640
|
+
return results;
|
|
36641
|
+
}.call(this).join(":");
|
|
36642
|
+
let suffix = "";
|
|
36643
|
+
if (this.zoneId) {
|
|
36644
|
+
suffix = `%${this.zoneId}`;
|
|
36645
|
+
}
|
|
36646
|
+
return addr + suffix;
|
|
36647
|
+
};
|
|
36648
|
+
IPv6.prototype.toIPv4Address = function() {
|
|
36649
|
+
if (!this.isIPv4MappedAddress()) {
|
|
36650
|
+
throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");
|
|
36651
|
+
}
|
|
36652
|
+
const ref = this.parts.slice(-2);
|
|
36653
|
+
const high = ref[0];
|
|
36654
|
+
const low = ref[1];
|
|
36655
|
+
return new ipaddr.IPv4([high >> 8, high & 255, low >> 8, low & 255]);
|
|
36656
|
+
};
|
|
36657
|
+
IPv6.prototype.toNormalizedString = function() {
|
|
36658
|
+
const addr = function() {
|
|
36659
|
+
const results = [];
|
|
36660
|
+
for (let i2 = 0;i2 < this.parts.length; i2++) {
|
|
36661
|
+
results.push(this.parts[i2].toString(16));
|
|
36662
|
+
}
|
|
36663
|
+
return results;
|
|
36664
|
+
}.call(this).join(":");
|
|
36665
|
+
let suffix = "";
|
|
36666
|
+
if (this.zoneId) {
|
|
36667
|
+
suffix = `%${this.zoneId}`;
|
|
36668
|
+
}
|
|
36669
|
+
return addr + suffix;
|
|
36670
|
+
};
|
|
36671
|
+
IPv6.prototype.toRFC5952String = function() {
|
|
36672
|
+
const regex = /((^|:)(0(:|$)){2,})/g;
|
|
36673
|
+
const string = this.toNormalizedString();
|
|
36674
|
+
let bestMatchIndex = 0;
|
|
36675
|
+
let bestMatchLength = -1;
|
|
36676
|
+
let match;
|
|
36677
|
+
while (match = regex.exec(string)) {
|
|
36678
|
+
if (match[0].length > bestMatchLength) {
|
|
36679
|
+
bestMatchIndex = match.index;
|
|
36680
|
+
bestMatchLength = match[0].length;
|
|
36681
|
+
}
|
|
36682
|
+
}
|
|
36683
|
+
if (bestMatchLength < 0) {
|
|
36684
|
+
return string;
|
|
36685
|
+
}
|
|
36686
|
+
return `${string.substring(0, bestMatchIndex)}::${string.substring(bestMatchIndex + bestMatchLength)}`;
|
|
36687
|
+
};
|
|
36688
|
+
IPv6.prototype.toString = function() {
|
|
36689
|
+
return this.toRFC5952String();
|
|
36690
|
+
};
|
|
36691
|
+
return IPv6;
|
|
36692
|
+
}();
|
|
36693
|
+
ipaddr.IPv6.broadcastAddressFromCIDR = function(string) {
|
|
36694
|
+
try {
|
|
36695
|
+
const cidr = this.parseCIDR(string);
|
|
36696
|
+
const ipInterfaceOctets = cidr[0].toByteArray();
|
|
36697
|
+
const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
|
|
36698
|
+
const octets = [];
|
|
36699
|
+
let i2 = 0;
|
|
36700
|
+
while (i2 < 16) {
|
|
36701
|
+
octets.push(parseInt(ipInterfaceOctets[i2], 10) | parseInt(subnetMaskOctets[i2], 10) ^ 255);
|
|
36702
|
+
i2++;
|
|
36703
|
+
}
|
|
36704
|
+
return new this(octets);
|
|
36705
|
+
} catch (e) {
|
|
36706
|
+
throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);
|
|
36707
|
+
}
|
|
36708
|
+
};
|
|
36709
|
+
ipaddr.IPv6.isIPv6 = function(string) {
|
|
36710
|
+
return this.parser(string) !== null;
|
|
36711
|
+
};
|
|
36712
|
+
ipaddr.IPv6.isValid = function(string) {
|
|
36713
|
+
if (typeof string === "string" && string.indexOf(":") === -1) {
|
|
36714
|
+
return false;
|
|
36715
|
+
}
|
|
36716
|
+
try {
|
|
36717
|
+
const addr = this.parser(string);
|
|
36718
|
+
new this(addr.parts, addr.zoneId);
|
|
36719
|
+
return true;
|
|
36720
|
+
} catch (e) {
|
|
36721
|
+
return false;
|
|
36722
|
+
}
|
|
36723
|
+
};
|
|
36724
|
+
ipaddr.IPv6.isValidCIDR = function(string) {
|
|
36725
|
+
if (typeof string === "string" && string.indexOf(":") === -1) {
|
|
36726
|
+
return false;
|
|
36727
|
+
}
|
|
36728
|
+
try {
|
|
36729
|
+
this.parseCIDR(string);
|
|
36730
|
+
return true;
|
|
36731
|
+
} catch (e) {
|
|
36732
|
+
return false;
|
|
36733
|
+
}
|
|
36734
|
+
};
|
|
36735
|
+
ipaddr.IPv6.networkAddressFromCIDR = function(string) {
|
|
36736
|
+
let cidr, i2, ipInterfaceOctets, octets, subnetMaskOctets;
|
|
36737
|
+
try {
|
|
36738
|
+
cidr = this.parseCIDR(string);
|
|
36739
|
+
ipInterfaceOctets = cidr[0].toByteArray();
|
|
36740
|
+
subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
|
|
36741
|
+
octets = [];
|
|
36742
|
+
i2 = 0;
|
|
36743
|
+
while (i2 < 16) {
|
|
36744
|
+
octets.push(parseInt(ipInterfaceOctets[i2], 10) & parseInt(subnetMaskOctets[i2], 10));
|
|
36745
|
+
i2++;
|
|
36746
|
+
}
|
|
36747
|
+
return new this(octets);
|
|
36748
|
+
} catch (e) {
|
|
36749
|
+
throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);
|
|
36750
|
+
}
|
|
36751
|
+
};
|
|
36752
|
+
ipaddr.IPv6.parse = function(string) {
|
|
36753
|
+
const addr = this.parser(string);
|
|
36754
|
+
if (addr.parts === null) {
|
|
36755
|
+
throw new Error("ipaddr: string is not formatted like an IPv6 Address");
|
|
36756
|
+
}
|
|
36757
|
+
return new this(addr.parts, addr.zoneId);
|
|
36758
|
+
};
|
|
36759
|
+
ipaddr.IPv6.parseCIDR = function(string) {
|
|
36760
|
+
let maskLength, match, parsed;
|
|
36761
|
+
if (match = string.match(/^(.+)\/(\d+)$/)) {
|
|
36762
|
+
maskLength = parseInt(match[2]);
|
|
36763
|
+
if (maskLength >= 0 && maskLength <= 128) {
|
|
36764
|
+
parsed = [this.parse(match[1]), maskLength];
|
|
36765
|
+
Object.defineProperty(parsed, "toString", {
|
|
36766
|
+
value: function() {
|
|
36767
|
+
return this.join("/");
|
|
36768
|
+
}
|
|
36769
|
+
});
|
|
36770
|
+
return parsed;
|
|
36771
|
+
}
|
|
36772
|
+
}
|
|
36773
|
+
throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range");
|
|
36774
|
+
};
|
|
36775
|
+
ipaddr.IPv6.parser = function(string) {
|
|
36776
|
+
let addr, i2, match, octet, octets, zoneId;
|
|
36777
|
+
if (match = string.match(ipv6Regexes.deprecatedTransitional)) {
|
|
36778
|
+
return this.parser(`::ffff:${match[1]}`);
|
|
36779
|
+
}
|
|
36780
|
+
if (ipv6Regexes.native.test(string)) {
|
|
36781
|
+
return expandIPv6(string, 8);
|
|
36782
|
+
}
|
|
36783
|
+
if (match = string.match(ipv6Regexes.transitional)) {
|
|
36784
|
+
zoneId = match[6] || "";
|
|
36785
|
+
addr = match[1];
|
|
36786
|
+
if (!match[1].endsWith("::")) {
|
|
36787
|
+
addr = addr.slice(0, -1);
|
|
36788
|
+
}
|
|
36789
|
+
addr = expandIPv6(addr + zoneId, 6);
|
|
36790
|
+
if (addr.parts) {
|
|
36791
|
+
octets = [
|
|
36792
|
+
parseInt(match[2]),
|
|
36793
|
+
parseInt(match[3]),
|
|
36794
|
+
parseInt(match[4]),
|
|
36795
|
+
parseInt(match[5])
|
|
36796
|
+
];
|
|
36797
|
+
for (i2 = 0;i2 < octets.length; i2++) {
|
|
36798
|
+
octet = octets[i2];
|
|
36799
|
+
if (!(0 <= octet && octet <= 255)) {
|
|
36800
|
+
return null;
|
|
36801
|
+
}
|
|
36802
|
+
}
|
|
36803
|
+
addr.parts.push(octets[0] << 8 | octets[1]);
|
|
36804
|
+
addr.parts.push(octets[2] << 8 | octets[3]);
|
|
36805
|
+
return {
|
|
36806
|
+
parts: addr.parts,
|
|
36807
|
+
zoneId: addr.zoneId
|
|
36808
|
+
};
|
|
36809
|
+
}
|
|
36810
|
+
}
|
|
36811
|
+
return null;
|
|
36812
|
+
};
|
|
36813
|
+
ipaddr.IPv6.subnetMaskFromPrefixLength = function(prefix) {
|
|
36814
|
+
prefix = parseInt(prefix);
|
|
36815
|
+
if (prefix < 0 || prefix > 128) {
|
|
36816
|
+
throw new Error("ipaddr: invalid IPv6 prefix length");
|
|
36817
|
+
}
|
|
36818
|
+
const octets = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
36819
|
+
let j = 0;
|
|
36820
|
+
const filledOctetCount = Math.floor(prefix / 8);
|
|
36821
|
+
while (j < filledOctetCount) {
|
|
36822
|
+
octets[j] = 255;
|
|
36823
|
+
j++;
|
|
36824
|
+
}
|
|
36825
|
+
if (filledOctetCount < 16) {
|
|
36826
|
+
octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - prefix % 8;
|
|
36827
|
+
}
|
|
36828
|
+
return new this(octets);
|
|
36829
|
+
};
|
|
36830
|
+
ipaddr.fromByteArray = function(bytes) {
|
|
36831
|
+
const length = bytes.length;
|
|
36832
|
+
if (length === 4) {
|
|
36833
|
+
return new ipaddr.IPv4(bytes);
|
|
36834
|
+
} else if (length === 16) {
|
|
36835
|
+
return new ipaddr.IPv6(bytes);
|
|
36836
|
+
} else {
|
|
36837
|
+
throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address");
|
|
36838
|
+
}
|
|
36839
|
+
};
|
|
36840
|
+
ipaddr.isValid = function(string) {
|
|
36841
|
+
return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string);
|
|
36842
|
+
};
|
|
36843
|
+
ipaddr.isValidCIDR = function(string) {
|
|
36844
|
+
return ipaddr.IPv6.isValidCIDR(string) || ipaddr.IPv4.isValidCIDR(string);
|
|
36845
|
+
};
|
|
36846
|
+
ipaddr.parse = function(string) {
|
|
36847
|
+
if (ipaddr.IPv6.isValid(string)) {
|
|
36848
|
+
return ipaddr.IPv6.parse(string);
|
|
36849
|
+
} else if (ipaddr.IPv4.isValid(string)) {
|
|
36850
|
+
return ipaddr.IPv4.parse(string);
|
|
36851
|
+
} else {
|
|
36852
|
+
throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format");
|
|
36853
|
+
}
|
|
36854
|
+
};
|
|
36855
|
+
ipaddr.parseCIDR = function(string) {
|
|
36856
|
+
try {
|
|
36857
|
+
return ipaddr.IPv6.parseCIDR(string);
|
|
36858
|
+
} catch (e) {
|
|
36859
|
+
try {
|
|
36860
|
+
return ipaddr.IPv4.parseCIDR(string);
|
|
36861
|
+
} catch (e2) {
|
|
36862
|
+
throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format");
|
|
36863
|
+
}
|
|
36864
|
+
}
|
|
36865
|
+
};
|
|
36866
|
+
ipaddr.process = function(string) {
|
|
36867
|
+
const addr = this.parse(string);
|
|
36868
|
+
if (addr.kind() === "ipv6" && addr.isIPv4MappedAddress()) {
|
|
36869
|
+
return addr.toIPv4Address();
|
|
36870
|
+
} else {
|
|
36871
|
+
return addr;
|
|
36872
|
+
}
|
|
36873
|
+
};
|
|
36874
|
+
ipaddr.subnetMatch = function(address, rangeList, defaultName) {
|
|
36875
|
+
let i2, rangeName, rangeSubnets, subnet;
|
|
36876
|
+
if (defaultName === undefined || defaultName === null) {
|
|
36877
|
+
defaultName = "unicast";
|
|
36878
|
+
}
|
|
36879
|
+
for (rangeName in rangeList) {
|
|
36880
|
+
if (Object.prototype.hasOwnProperty.call(rangeList, rangeName)) {
|
|
36881
|
+
rangeSubnets = rangeList[rangeName];
|
|
36882
|
+
if (rangeSubnets[0] && !(rangeSubnets[0] instanceof Array)) {
|
|
36883
|
+
rangeSubnets = [rangeSubnets];
|
|
36884
|
+
}
|
|
36885
|
+
for (i2 = 0;i2 < rangeSubnets.length; i2++) {
|
|
36886
|
+
subnet = rangeSubnets[i2];
|
|
36887
|
+
if (address.kind() === subnet[0].kind() && address.match.apply(address, subnet)) {
|
|
36888
|
+
return rangeName;
|
|
36889
|
+
}
|
|
36890
|
+
}
|
|
36891
|
+
}
|
|
36892
|
+
}
|
|
36893
|
+
return defaultName;
|
|
36894
|
+
};
|
|
36895
|
+
if (typeof module !== "undefined" && module.exports) {
|
|
36896
|
+
module.exports = ipaddr;
|
|
36897
|
+
} else {
|
|
36898
|
+
root.ipaddr = ipaddr;
|
|
36899
|
+
}
|
|
36900
|
+
})(exports);
|
|
36901
|
+
});
|
|
36902
|
+
|
|
36903
|
+
// ../security/src/hostnames.ts
|
|
36904
|
+
function unwrapIpv6Brackets(host) {
|
|
36905
|
+
return host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
|
|
36906
|
+
}
|
|
36907
|
+
var LOOPBACK_HOSTNAMES;
|
|
36908
|
+
var init_hostnames = __esm(() => {
|
|
36909
|
+
LOOPBACK_HOSTNAMES = new Set(["localhost", "127.0.0.1", "::1"]);
|
|
36910
|
+
});
|
|
36911
|
+
|
|
36912
|
+
// ../security/src/egress.ts
|
|
36913
|
+
function splitEntries(value) {
|
|
36914
|
+
if (value === undefined)
|
|
36915
|
+
return [];
|
|
36916
|
+
const parts = typeof value === "string" ? value.split(",") : value;
|
|
36917
|
+
return parts.map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
36918
|
+
}
|
|
36919
|
+
function normalizeHost(host) {
|
|
36920
|
+
return unwrapIpv6Brackets(host.toLowerCase()).replace(/\.$/, "");
|
|
36921
|
+
}
|
|
36922
|
+
function parseHostPattern(entry, sourceName) {
|
|
36923
|
+
const value = normalizeHost(entry);
|
|
36924
|
+
const wildcard = value.startsWith("*.");
|
|
36925
|
+
const host = wildcard ? value.slice(2) : value;
|
|
36926
|
+
if (host.includes("*")) {
|
|
36927
|
+
throw new Error(`Invalid ${sourceName} entry "${entry}": a wildcard is only supported as a leading "*." label`);
|
|
36928
|
+
}
|
|
36929
|
+
if (host.includes("/") || /\s/.test(host)) {
|
|
36930
|
+
throw new Error(`Invalid ${sourceName} entry "${entry}": expected a hostname, not a URL or CIDR`);
|
|
36931
|
+
}
|
|
36932
|
+
if (host.includes(",") || host.includes(":")) {
|
|
36933
|
+
throw new Error(`Invalid ${sourceName} entry "${entry}": a hostname has no port, comma, or colon`);
|
|
36934
|
+
}
|
|
36935
|
+
if (host.length === 0 || host.split(".").some((label) => label.length === 0)) {
|
|
36936
|
+
throw new Error(`Invalid ${sourceName} entry "${entry}": every label must be non-empty`);
|
|
36937
|
+
}
|
|
36938
|
+
if (/[^\x21-\x7e]/.test(host)) {
|
|
36939
|
+
throw new Error(`Invalid ${sourceName} entry "${entry}": use the punycode form of an internationalized name`);
|
|
36940
|
+
}
|
|
36941
|
+
if (wildcard && !host.includes(".")) {
|
|
36942
|
+
throw new Error(`Invalid ${sourceName} entry "${entry}": a wildcard must cover at least two labels, e.g. "*.example.com"`);
|
|
36943
|
+
}
|
|
36944
|
+
return wildcard ? { value: `.${host}`, wildcard: true } : { value: host, wildcard: false };
|
|
36945
|
+
}
|
|
36946
|
+
function parseCidrRange(entry, sourceName) {
|
|
36947
|
+
if (entry.includes("/")) {
|
|
36948
|
+
if (!ipaddr.isValidCIDR(entry)) {
|
|
36949
|
+
throw new Error(`Invalid ${sourceName} entry "${entry}"`);
|
|
36950
|
+
}
|
|
36951
|
+
const [address2, prefixLength] = ipaddr.parseCIDR(entry);
|
|
36952
|
+
if (prefixLength < 8) {
|
|
36953
|
+
throw new Error(`Invalid ${sourceName} entry "${entry}": catch-all networks are unsafe`);
|
|
36954
|
+
}
|
|
36955
|
+
return { address: address2, prefixLength };
|
|
36956
|
+
}
|
|
36957
|
+
const value = unwrapIpv6Brackets(entry);
|
|
36958
|
+
if (!ipaddr.isValid(value)) {
|
|
36959
|
+
throw new Error(`Invalid ${sourceName} entry "${entry}"`);
|
|
36960
|
+
}
|
|
36961
|
+
const address = ipaddr.parse(value);
|
|
36962
|
+
return { address, prefixLength: address.kind() === "ipv4" ? 32 : 128 };
|
|
36963
|
+
}
|
|
36964
|
+
function createEgressPolicy(spec = {}) {
|
|
36965
|
+
const sourceNames = spec.sourceNames ?? DEFAULT_SOURCE_NAMES;
|
|
36966
|
+
return {
|
|
36967
|
+
insecureHttp: spec.insecureHttp ?? "never",
|
|
36968
|
+
allowLoopback: spec.allowLoopback ?? false,
|
|
36969
|
+
allowPrivate: spec.allowPrivate ?? false,
|
|
36970
|
+
allowedHosts: splitEntries(spec.allowedHosts).map((entry) => parseHostPattern(entry, sourceNames.hosts)),
|
|
36971
|
+
allowedRanges: splitEntries(spec.allowedRanges).map((entry) => parseCidrRange(entry, sourceNames.ranges))
|
|
36972
|
+
};
|
|
36973
|
+
}
|
|
36974
|
+
function embeddedIpv4(parts) {
|
|
36975
|
+
return ipaddr.fromByteArray([
|
|
36976
|
+
parts[6] >> 8 & 255,
|
|
36977
|
+
parts[6] & 255,
|
|
36978
|
+
parts[7] >> 8 & 255,
|
|
36979
|
+
parts[7] & 255
|
|
36980
|
+
]).toString();
|
|
36981
|
+
}
|
|
36982
|
+
function transitionIpv4(parts) {
|
|
36983
|
+
if (parts[0] === 8194) {
|
|
36984
|
+
return ipaddr.fromByteArray([
|
|
36985
|
+
parts[1] >> 8 & 255,
|
|
36986
|
+
parts[1] & 255,
|
|
36987
|
+
parts[2] >> 8 & 255,
|
|
36988
|
+
parts[2] & 255
|
|
36989
|
+
]).toString();
|
|
36990
|
+
}
|
|
36991
|
+
if (isTeredo(parts))
|
|
36992
|
+
return null;
|
|
36993
|
+
if (parts[4] === 0 && parts[5] === 24318)
|
|
36994
|
+
return embeddedIpv4(parts);
|
|
36995
|
+
if (parts[4] === 512 && parts[5] === 24318)
|
|
36996
|
+
return embeddedIpv4(parts);
|
|
36997
|
+
return null;
|
|
36998
|
+
}
|
|
36999
|
+
function isTeredo(parts) {
|
|
37000
|
+
return parts[0] === 8193 && parts[1] === 0;
|
|
37001
|
+
}
|
|
37002
|
+
function canonicalAddress(address) {
|
|
37003
|
+
const clean = unwrapIpv6Brackets(address).split("%")[0];
|
|
37004
|
+
if (!ipaddr.isValid(clean))
|
|
37005
|
+
return null;
|
|
37006
|
+
const parsed = ipaddr.process(clean);
|
|
37007
|
+
if (parsed.kind() === "ipv6") {
|
|
37008
|
+
const parts = parsed.parts;
|
|
37009
|
+
if (IPV4_EMBEDDING_PREFIXES.some((prefix) => prefix.every((part, index) => parts[index] === part))) {
|
|
37010
|
+
return embeddedIpv4(parts);
|
|
37011
|
+
}
|
|
37012
|
+
const embedded = (parts[6] << 16 >>> 0) + parts[7];
|
|
37013
|
+
if (parts.slice(0, 6).every((part) => part === 0) && embedded > 1) {
|
|
37014
|
+
return embeddedIpv4(parts);
|
|
37015
|
+
}
|
|
37016
|
+
const transition = transitionIpv4(parts);
|
|
37017
|
+
if (transition !== null)
|
|
37018
|
+
return transition;
|
|
37019
|
+
}
|
|
37020
|
+
return parsed.toString();
|
|
37021
|
+
}
|
|
37022
|
+
var ipaddr, METADATA_ADDRESSES, DENIED_PORTS, DEFAULT_SOURCE_NAMES, STRICT_EGRESS_POLICY, IPV4_EMBEDDING_PREFIXES, CANONICAL_METADATA_ADDRESSES;
|
|
37023
|
+
var init_egress = __esm(() => {
|
|
37024
|
+
init_hostnames();
|
|
37025
|
+
ipaddr = __toESM(require_ipaddr(), 1);
|
|
37026
|
+
METADATA_ADDRESSES = [
|
|
37027
|
+
"169.254.169.254",
|
|
37028
|
+
"169.254.170.2",
|
|
37029
|
+
"100.100.100.200",
|
|
37030
|
+
"192.0.0.192",
|
|
37031
|
+
"168.63.129.16",
|
|
37032
|
+
"fd00:ec2::254"
|
|
37033
|
+
];
|
|
37034
|
+
DENIED_PORTS = new Set([
|
|
37035
|
+
22,
|
|
37036
|
+
23,
|
|
37037
|
+
25,
|
|
37038
|
+
3306,
|
|
37039
|
+
5432,
|
|
37040
|
+
6379,
|
|
37041
|
+
27017,
|
|
37042
|
+
9200
|
|
37043
|
+
]);
|
|
37044
|
+
DEFAULT_SOURCE_NAMES = { hosts: "allowedHosts", ranges: "allowedRanges" };
|
|
37045
|
+
STRICT_EGRESS_POLICY = createEgressPolicy();
|
|
37046
|
+
IPV4_EMBEDDING_PREFIXES = [
|
|
37047
|
+
[100, 65435, 0, 0, 0, 0],
|
|
37048
|
+
[0, 0, 0, 0, 65535, 0]
|
|
37049
|
+
];
|
|
37050
|
+
CANONICAL_METADATA_ADDRESSES = new Set(METADATA_ADDRESSES.map((address) => canonicalAddress(address) ?? address));
|
|
37051
|
+
});
|
|
37052
|
+
|
|
35830
37053
|
// ../security/src/hash.ts
|
|
35831
37054
|
import { createHash } from "node:crypto";
|
|
35832
37055
|
function sha256Base64Url(input) {
|
|
@@ -36095,6 +37318,18 @@ function collectSecrets(existing) {
|
|
|
36095
37318
|
}
|
|
36096
37319
|
return secrets;
|
|
36097
37320
|
}
|
|
37321
|
+
function validateEgressEntries(spec) {
|
|
37322
|
+
try {
|
|
37323
|
+
createEgressPolicy({
|
|
37324
|
+
allowedHosts: spec.allowedHosts?.trim() || undefined,
|
|
37325
|
+
allowedRanges: spec.allowedRanges?.trim() || undefined,
|
|
37326
|
+
sourceNames: { hosts: "EGRESS_ALLOWED_HOSTS", ranges: "EGRESS_ALLOWED_IP_RANGES" }
|
|
37327
|
+
});
|
|
37328
|
+
return;
|
|
37329
|
+
} catch (error) {
|
|
37330
|
+
return getErrorMessage(error, "invalid entry");
|
|
37331
|
+
}
|
|
37332
|
+
}
|
|
36098
37333
|
async function promptCopilotKey(existing) {
|
|
36099
37334
|
if (existing) {
|
|
36100
37335
|
const keep = await confirm2({
|
|
@@ -36214,12 +37449,28 @@ async function promptSecurity(vars) {
|
|
|
36214
37449
|
sim.DISABLE_AUTH = "true";
|
|
36215
37450
|
mirrorToRealtime.DISABLE_AUTH = "true";
|
|
36216
37451
|
}
|
|
36217
|
-
const
|
|
36218
|
-
|
|
36219
|
-
|
|
37452
|
+
const existingEgressHosts = vars.get("EGRESS_ALLOWED_HOSTS");
|
|
37453
|
+
const egressHosts = await text2({
|
|
37454
|
+
message: "Hosts on your private network that workflows may reach? (comma-separated, blank for none — widens the SSRF guard)",
|
|
37455
|
+
placeholder: "host.docker.internal,*.svc.cluster.local",
|
|
37456
|
+
initialValue: existingEgressHosts ?? "",
|
|
37457
|
+
defaultValue: "",
|
|
37458
|
+
validate: (value) => validateEgressEntries({ allowedHosts: value })
|
|
37459
|
+
});
|
|
37460
|
+
if (typeof egressHosts === "string" && egressHosts.trim()) {
|
|
37461
|
+
sim.EGRESS_ALLOWED_HOSTS = egressHosts.trim();
|
|
37462
|
+
}
|
|
37463
|
+
const existingEgressRanges = vars.get("EGRESS_ALLOWED_IP_RANGES");
|
|
37464
|
+
const egressRanges = await text2({
|
|
37465
|
+
message: "Address ranges on your private network that workflows may reach? (CIDRs, comma-separated)",
|
|
37466
|
+
placeholder: "10.0.0.0/8,192.168.65.254/32",
|
|
37467
|
+
initialValue: existingEgressRanges ?? "",
|
|
37468
|
+
defaultValue: "",
|
|
37469
|
+
validate: (value) => validateEgressEntries({ allowedRanges: value })
|
|
36220
37470
|
});
|
|
36221
|
-
if (
|
|
36222
|
-
sim.
|
|
37471
|
+
if (typeof egressRanges === "string" && egressRanges.trim()) {
|
|
37472
|
+
sim.EGRESS_ALLOWED_IP_RANGES = egressRanges.trim();
|
|
37473
|
+
}
|
|
36223
37474
|
const existingAdminKey = vars.get("ADMIN_API_KEY");
|
|
36224
37475
|
if (!existingAdminKey || isPlaceholder(existingAdminKey)) {
|
|
36225
37476
|
const wantsAdmin = await confirm2({
|
|
@@ -36264,6 +37515,7 @@ async function promptUnlocks(vars) {
|
|
|
36264
37515
|
}
|
|
36265
37516
|
var DEFAULT_CLI_AUTH_ORIGIN = "https://www.sim.ai", PROVIDER_CONSOLES;
|
|
36266
37517
|
var init_steps = __esm(() => {
|
|
37518
|
+
init_egress();
|
|
36267
37519
|
init_capability_config();
|
|
36268
37520
|
init_capability_setup();
|
|
36269
37521
|
init_cli_auth();
|