Skip to content

Commit 21b3bc4

Browse files
committed
Add option for partitioned auth cookies
1 parent b398df6 commit 21b3bc4

8 files changed

Lines changed: 59 additions & 11 deletions

File tree

cs/src/Contracts/TunnelOptions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,15 @@ public class TunnelOptions
8484
/// </summary>
8585
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
8686
public bool IsCrossSiteAuthenticationEnabled { get; set; }
87+
88+
/// <summary>
89+
/// Gets or sets a value indicating whether the tunnel web-forwarding authentication cookie is set as
90+
/// Partitioned (CHIPS). The default is false. This only applies to tunnels that require authentication.
91+
/// </summary>
92+
/// <remarks>
93+
/// A partitioned cookie always also has SameSite=None for compatbility with browsers that do not support partitioning.
94+
/// </remarks>
95+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
96+
public bool IsPartitionedSiteAuthenticationEnabled { get; set; }
8797
}
8898
}

go/tunnels/tunnel_options.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,53 @@ type TunnelOptions struct {
99
// Gets or sets a value indicating whether web-forwarding of this tunnel can run on any
1010
// cluster (region) without redirecting to the home cluster. This is only applicable if
1111
// the tunnel has a name and web-forwarding uses it.
12-
IsGloballyAvailable bool `json:"isGloballyAvailable,omitempty"`
12+
IsGloballyAvailable bool `json:"isGloballyAvailable,omitempty"`
1313

1414
// Gets or sets a value for `Host` header rewriting to use in web-forwarding of this
1515
// tunnel or port. By default, with this property null or empty, web-forwarding uses
1616
// "localhost" to rewrite the header. Web-fowarding will use this property instead if it
1717
// is not null or empty. Port-level option, if set, takes precedence over this option on
1818
// the tunnel level. The option is ignored if IsHostHeaderUnchanged is true.
19-
HostHeader string `json:"hostHeader,omitempty"`
19+
HostHeader string `json:"hostHeader,omitempty"`
2020

2121
// Gets or sets a value indicating whether `Host` header is rewritten or the header value
2222
// stays intact. By default, if false, web-forwarding rewrites the host header with the
2323
// value from HostHeader property or "localhost". If true, the host header will be
2424
// whatever the tunnel's web-forwarding host is, e.g. tunnel-name-8080.devtunnels.ms.
2525
// Port-level option, if set, takes precedence over this option on the tunnel level.
26-
IsHostHeaderUnchanged bool `json:"isHostHeaderUnchanged,omitempty"`
26+
IsHostHeaderUnchanged bool `json:"isHostHeaderUnchanged,omitempty"`
2727

2828
// Gets or sets a value for `Origin` header rewriting to use in web-forwarding of this
2929
// tunnel or port. By default, with this property null or empty, web-forwarding uses
3030
// "http(s)://localhost" to rewrite the header. Web-fowarding will use this property
3131
// instead if it is not null or empty. Port-level option, if set, takes precedence over
3232
// this option on the tunnel level. The option is ignored if IsOriginHeaderUnchanged is
3333
// true.
34-
OriginHeader string `json:"originHeader,omitempty"`
34+
OriginHeader string `json:"originHeader,omitempty"`
3535

3636
// Gets or sets a value indicating whether `Origin` header is rewritten or the header
3737
// value stays intact. By default, if false, web-forwarding rewrites the origin header
3838
// with the value from OriginHeader property or "http(s)://localhost". If true, the
3939
// Origin header will be whatever the tunnel's web-forwarding Origin is, e.g.
4040
// https://tunnel-name-8080.devtunnels.ms. Port-level option, if set, takes precedence
4141
// over this option on the tunnel level.
42-
IsOriginHeaderUnchanged bool `json:"isOriginHeaderUnchanged,omitempty"`
42+
IsOriginHeaderUnchanged bool `json:"isOriginHeaderUnchanged,omitempty"`
4343

4444
// Gets or sets if inspection is enabled for the tunnel.
45-
IsInspectionEnabled bool `json:"isInspectionEnabled,omitempty"`
45+
IsInspectionEnabled bool `json:"isInspectionEnabled,omitempty"`
4646

4747
// Gets or sets a value indicating whether web requests to a tunnel can use the tunnel
4848
// web authentication cookie if they come from a different site. Specifically, this
4949
// controls whether the tunnel web-forwarding authentication cookie is marked as
5050
// SameSite=None. The default is false, which means the cookie is marked as SameSite=Lax.
5151
// This only applies to tunnels that require authentication.
52-
IsCrossSiteAuthenticationEnabled bool `json:"isCrossSiteAuthenticationEnabled,omitempty"`
52+
IsCrossSiteAuthenticationEnabled bool `json:"isCrossSiteAuthenticationEnabled,omitempty"`
53+
54+
// Gets or sets a value indicating whether the tunnel web-forwarding authentication
55+
// cookie is set as Partitioned (CHIPS). The default is false. This only applies to
56+
// tunnels that require authentication.
57+
//
58+
// A partitioned cookie always also has SameSite=None for compatbility with browsers that
59+
// do not support partitioning.
60+
IsPartitionedSiteAuthenticationEnabled bool `json:"isPartitionedSiteAuthenticationEnabled,omitempty"`
5361
}

go/tunnels/tunnels.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/rodaine/table"
1111
)
1212

13-
const PackageVersion = "0.1.15"
13+
const PackageVersion = "0.1.16"
1414

1515
func (tunnel *Tunnel) requestObject() (*Tunnel, error) {
1616
convertedTunnel := &Tunnel{

java/src/main/java/com/microsoft/tunnels/contracts/TunnelOptions.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,15 @@ public class TunnelOptions {
7676
*/
7777
@Expose
7878
public boolean isCrossSiteAuthenticationEnabled;
79+
80+
/**
81+
* Gets or sets a value indicating whether the tunnel web-forwarding authentication
82+
* cookie is set as Partitioned (CHIPS). The default is false. This only applies to
83+
* tunnels that require authentication.
84+
*
85+
* A partitioned cookie always also has SameSite=None for compatbility with browsers
86+
* that do not support partitioning.
87+
*/
88+
@Expose
89+
public boolean isPartitionedSiteAuthenticationEnabled;
7990
}

rs/src/contracts/tunnel_options.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,13 @@ pub struct TunnelOptions {
6060
// SameSite=Lax. This only applies to tunnels that require authentication.
6161
#[serde(default)]
6262
pub is_cross_site_authentication_enabled: bool,
63+
64+
// Gets or sets a value indicating whether the tunnel web-forwarding authentication
65+
// cookie is set as Partitioned (CHIPS). The default is false. This only applies to
66+
// tunnels that require authentication.
67+
//
68+
// A partitioned cookie always also has SameSite=None for compatbility with browsers
69+
// that do not support partitioning.
70+
#[serde(default)]
71+
pub is_partitioned_site_authentication_enabled: bool,
6372
}

ts/src/connections/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"buffer": "^5.2.1",
1919
"debug": "^4.1.1",
2020
"vscode-jsonrpc": "^4.0.0",
21-
"@microsoft/dev-tunnels-contracts": ">1.2.4",
22-
"@microsoft/dev-tunnels-management": ">1.2.4",
21+
"@microsoft/dev-tunnels-contracts": ">1.2.5",
22+
"@microsoft/dev-tunnels-management": ">1.2.5",
2323
"@microsoft/dev-tunnels-ssh": "^3.12.5",
2424
"@microsoft/dev-tunnels-ssh-tcp": "^3.12.5",
2525
"uuid": "^3.3.3",

ts/src/contracts/tunnelOptions.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,14 @@ export interface TunnelOptions {
6666
* SameSite=Lax. This only applies to tunnels that require authentication.
6767
*/
6868
isCrossSiteAuthenticationEnabled?: boolean;
69+
70+
/**
71+
* Gets or sets a value indicating whether the tunnel web-forwarding authentication
72+
* cookie is set as Partitioned (CHIPS). The default is false. This only applies to
73+
* tunnels that require authentication.
74+
*
75+
* A partitioned cookie always also has SameSite=None for compatbility with browsers
76+
* that do not support partitioning.
77+
*/
78+
isPartitionedSiteAuthenticationEnabled?: boolean;
6979
}

ts/src/management/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"buffer": "^5.2.1",
1919
"debug": "^4.1.1",
2020
"vscode-jsonrpc": "^4.0.0",
21-
"@microsoft/dev-tunnels-contracts": ">1.2.4",
21+
"@microsoft/dev-tunnels-contracts": ">1.2.5",
2222
"axios": "^1.8.4"
2323
}
2424
}

0 commit comments

Comments
 (0)