Glimpse를 프로덕션 사이트에 배포해야합니까?
최근에 Glimpse Debugger 패키지를 프로젝트에 추가했습니다. 이것은 Glimpse dll에 대한 참조를 추가하고 일부 Web.Config를 수정했습니다.
개발 및 프로덕션 환경에서 가능한 한 많이 내 프로젝트를 좋아합니다.
Glimpse를 프로덕션 사이트에 배포하는 것이 저장 / 현명한가요? 아니면 다른 프로젝트를 생성 (또는 내 csproj 파일에서 브랜치를 생성)하여 로컬로만 유지해야합니까?
내가 걱정하는 것은 다음과 같습니다.
- 공연
- 보안 침해
Glimpse에 대한 쿠키가 발견되지 않으면로드되지 않거나 아무것도 수행하지 않으므로 성능은 무시할 수있을 것입니다. 보안 측면에서는 web.config에서 엿보기 경로의 위치에 대한 사용자 제한을 설정할 수 있습니다.
<location path="Glimpse.axd" >
<system.web>
<authorization>
<allow users="Administrator" />
<deny users="*" />
</authorization>
</system.web>
</location>
또는 관리자 역할이있는 경우 사용자 이름 대신 역할별로 수행 할 수 있습니다.
쿠키의 존재에만 의존하고 싶지 않은 경우에도 해제 할 수 있습니다. 이것은 web.config 변환을 통해 쉽게 달성되었으며 아직 마크 업을 테스트하지 않았지만 이와 같은 것이 작동합니다.
<glimpse enabled="false" xdt:Transform="SetAttributes">
</glimpse>
업데이트 : Glimpse는 최근 몇 가지 변경 사항을 보았으며 (내가 생각하는 1.0 이후로?) 이제 변환은 다음과 같이 보일 것입니다. enabled
속성 을 설정하려고하면 최신 버전의 Glimpse에서 구성 오류가 발생합니다.
<glimpse defaultRuntimePolicy="Off" xdt:Transform="SetAttributes">
</glimpse>
문서에 나와 있듯이 ...
Glimpse는 .NET에 지정된 것보다 Http 응답으로 더 많은 작업을 수행 할 수 없습니다
DefaultRuntimePolicy
.
이 변환이 제공하는 유일한 목적은 배포 프로세스의 일부로 Glimpse를 사용하는 기능을 제거하려는 경우입니다. 원격 요청 또는 권한 확인과 같은 다른 기준에 따라 조건부로 비활성화하려면 정책을 통해 수행하는 것이 좋습니다. Glimpse는 이제 IRuntimePolicy
일을 할 수 있도록 허용해야하는시기를 결정하는 데 도움이되도록 설계된 일련의 정책 (모두에 기반 )으로 작동합니다. 실제로 Glimpse가 설치되고 glimpse.axd로 이동하면 해당 페이지 하단에 현재 활성화 된 정책 목록이 표시됩니다. LocalPolicy
원격 요청에 의해 액세스되는 것을 방지하는 것과 같은 것 (구성 가능하게 원격 요청을 허용하기 위해 web.config를 통해 모든 정책을 무시할 수 있음) http://getglimpse.com/Help/Configuration. 또한 GlimpseSecurityPolicy
Nuget을 사용하여 Glimpse를 설치할 때 포함 된 라는 샘플 클래스 가 있으며,이를 사용하여 권한 부여 제한을 추가 할 수 있습니다.
public class GlimpseSecurityPolicy:IRuntimePolicy
{
public RuntimePolicy Execute(IRuntimePolicyContext policyContext)
{
// You can perform a check like the one below to control Glimpse's permissions within your application.
// More information about RuntimePolicies can be found at http://getglimpse.com/Help/Custom-Runtime-Policy
var httpContext = policyContext.GetHttpContext();
if (httpContext.User != null && !httpContext.User.IsInRole("Glimpse")) //Once glimpse is turned on, you have to be a member of this Role to see the Glimpse Panel.
{
return RuntimePolicy.Off;
}
return RuntimePolicy.On;
}
public RuntimeEvent ExecuteOn
{
get { return RuntimeEvent.EndRequest; }
}
}
이제 정책은 glimpse가 실행되어야하는시기를 결정하는 데 사용되지만 사용자가 glimpse.axd 페이지를 표시하는 것을 막지는 않습니다. 쿠키는 내가 알 수있는 것에서 여전히 활성화 될 수 있지만, 쿠키가 존재 함에도 불구하고 흘림이 실행을 거부하면 쿠키는 의미가 없습니다. web.config의 위치 태그를 사용하여 권한 확인에서 glimpse.axd 페이지를 래핑하는 것이 좋습니다. 이것은 GlimpseSecurityPolicy
위의 추가 사항입니다 .
<location path="glimpse.axd">
<system.web>
<authorization>
<allow roles="Glimpse" />
<deny users="*" />
</authorization>
</system.web>
</location>
Yarx는 거의 모든면에서 옳습니다.
From a security perspective you could lock down the path using the method described. Only thing is, there are more URL end points that glimpse uses, so the rule would need to be something like *Glimpse/*
(where * says that anything can come before it and anything can come after it). Once this is in place, glimpse should be pretty locked down.
Also, if in the config, you used the transform that Yarx provided, glimpse will never load, even if you have the cookie turned on.
Starting with Glimpse 1.7 there is a more generic way to secure ~/glimpse.axd
with the additional benefit that you use the same policy for all. You simply need to make sure that your custom policy is called for resources too:
public RuntimeEvent ExecuteOn
{
// The bit flag that signals to Glimpse that it should run on either event
get { return RuntimeEvent.Endrequest | RuntimeEvent.ExecuteResource; }
}
Notice the | RuntimeEvent.ExecuteResource
. See bottom of: Securing Glimpse.axd the way forward.
참고URL : https://stackoverflow.com/questions/5746444/should-i-deploy-glimpse-to-the-production-site
'developer tip' 카테고리의 다른 글
인증 자격 증명 제거 — django, elastic beanstalk, oauth (0) | 2020.10.27 |
---|---|
문자열을 사용하여 동적으로 메서드를 호출하는 Objective C (0) | 2020.10.27 |
string :: c_str ()은 C ++ 11에서 더 이상 null로 끝나지 않습니까? (0) | 2020.10.27 |
Mac에서 bashrc 파일은 어디에서 찾을 수 있습니까? (0) | 2020.10.27 |
Java는 0 년이 윤년이지만 0 년은 존재하지 않았다고 말합니다. (0) | 2020.10.27 |