Skip to content

Commit e67c778

Browse files
author
Hanzhang Zeng (Roger)
committed
Only expose the endpoint when running on Linux Container
1 parent a5c4e52 commit e67c778

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/WebJobs.Script.WebHost/Controllers/InstanceController.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,25 @@ public IActionResult GetInstanceInfo()
6868
return Ok(_instanceManager.GetInstanceInfo());
6969
}
7070

71+
/// <summary>
72+
/// This endpoint generates a temporary x-ms-site-restricted-token for core tool
73+
/// to access KuduLite zipdeploy endpoint in Linux Consumption
74+
/// </summary>
75+
/// <returns>
76+
/// 200 on token generated
77+
/// 400 on non-Linux container environment
78+
/// 404 on WEBSITE_AUTH_ENCRYPTION_KEY is not set
79+
/// </returns>
7180
[HttpGet]
7281
[Route("admin/getsitetoken")]
7382
[Authorize(Policy = PolicyNames.AdminAuthLevel)]
7483
public IActionResult GetSiteToken()
7584
{
76-
// This endpoint is used by getting a temporary x-ms-site-restricted-token to for KuduLite request in Linux Consumption
85+
if (!_environment.IsLinuxContainerEnvironment())
86+
{
87+
return BadRequest("Endpoint is only available when running in Linux Container");
88+
}
89+
7790
string websiteEncryptionKey = _environment.GetEnvironmentVariable(EnvironmentSettingNames.WebSiteAuthEncryptionKey);
7891
if (string.IsNullOrEmpty(websiteEncryptionKey))
7992
{

0 commit comments

Comments
 (0)