我应该将 Glimpse 部署到生产站点吗?
我最近将 Glimpse Debugger 包添加到我的项目中。这添加了对Glimpse dll的引用,并修改了一些Web.Config。
我尽可能喜欢我的项目在我的开发和生产环境中的表现。
那么,将 Glimpse 部署到我的生产站点是否节省/明智,或者我应该创建一个不同的项目(或从我的 csproj 文件创建分支)以仅将其保留在本地?
我担心的事情包括:
- 性能
- 安全漏洞
I recently added the Glimpse Debugger package to my project. This added a reference to the Glimpse dll, and modified some Web.Config.
I like my project as much the same as possible on my development and production environment.
So is it save/wise to deploy Glimpse to my production site, or should I create a different project (or create branch from my csproj file) to keep it only locally?
Stuff that I'm worried about include:
- Performance
- Security breaches
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信如果没有找到 Glimpse 的 cookie,它就不会加载或执行任何操作,因此性能应该可以忽略不计。安全方面,您只需在 web.config 中为预览路径的位置设置用户限制即可。
或者,如果有管理员角色,您可以按角色而不是用户名来执行此操作。
如果您不想仅依赖 cookie 的存在,也可以将其关闭。这可以通过 web.config 转换轻松实现,我还没有测试标记,但类似的东西应该可以工作。
更新:Glimpse 最近看到了一些变化(我相信是从 1.0 开始?)转换现在如下所示。尝试设置
enabled
属性会在最新版本的 Glimpse 中出现配置错误。正如文档所说...
应该注意的是,此转换的唯一目的是如果您想要删除在部署过程中使用 Glimpse 的功能。如果您想根据其他条件(例如远程请求或授权检查)有条件地禁用它,最好通过策略来完成。 Glimpse 现在根据一系列策略运行(全部基于
IRuntimePolicy
),旨在帮助确定何时允许glimpse 执行其操作。事实上,一旦安装了 Glimpse,如果您导航到该页面底部的glimpse.axd,您将看到当前启用的策略列表。例如防止远程请求访问的LocalPolicy
(可配置的是,可以通过web.config忽略任何策略以允许远程请求)http://getglimpse.com/Help/Configuration。他们还有一个名为GlimpseSecurityPolicy
的示例类,当您使用 Nuget 安装 Glimpse 时会包含该类,您可以使用它来添加授权限制。现在,这些策略用于确定 glimpse 何时运行,但它们不会阻止用户打开 glimpse.axd 页面。据我所知,仍然可以启用 cookie,但是如果尽管存在 cookie,但一瞥仍拒绝运行,那么 cookie 就毫无意义了。话虽这么说,但仍然建议使用 web.config 中的位置标记将一闪一闪的页面包装在授权检查中。请注意,这是对上面的
GlimpseSecurityPolicy
的补充。I believe if the cookie for Glimpse is not found it doesn't load or do anything so performance should be negligible. Security wise you can just set a user restriction in the web.config for the location of the glimpse path.
Or if there is an administrator role you could do it by role instead of user name.
You can also switch it off if you don't want to rely on just the presence of the cookie. This easily achieved through web.config transforms, I haven't tested the markup yet but something like this should work.
UPDATE: Glimpse has seen some changes recently and (since 1.0 I believe?) the transform would now look as follows. Trying to set the
enabled
attribute will give a configuration error in the most recent version of Glimpse.As the documentation puts it...
It should be noted that the only purpose this transform serves, is if you want to remove the ability to use Glimpse as part of your deployment process. If you want to conditionally disable it based on other criteria such as remote requests or authorization check, these are better done via policies. Glimpse operates off of a series of policies now (all based off of
IRuntimePolicy
), designed to help determine when glimpse should be allowed to do it's thing. In fact once Glimpse is installed, if you navigate to glimpse.axd, at the bottom of that page, you'll see a list of policies that are currently enabled. Such as theLocalPolicy
that prevents it from being accessed by remote requests (configurably, any policy can be ignored via the web.config to allow remote requests) http://getglimpse.com/Help/Configuration. They also have a sample class calledGlimpseSecurityPolicy
that is included when you install Glimpse using Nuget, which you can use to add a authorization restrictions.Now the policies are used to determine when glimpse should run, but they don't prevent the user from being able to bring up the glimpse.axd page. The cookie can still be enabled from what from what I can tell, but the cookie is meaningless if glimpse refuses to run in spite of the cookie being present. That being said It's still advisable to wrap the glimpse.axd page in an authorization check using the location tag in your web.config. Note that this is in addition to the
GlimpseSecurityPolicy
above.Yarx 几乎在所有方面都是正确的。
从安全角度来看,您可以使用所描述的方法锁定路径。唯一的问题是,glimpse 使用了更多的 URL 端点,因此规则需要类似于
*Glimpse/*
(其中 * 表示任何内容都可以在它之前,任何内容都可以在它之后) )。一旦到位,一瞥就应该被锁定。另外,如果在配置中,您使用了 Yarx 提供的转换,即使您打开了 cookie,glimpse 也永远不会加载。
Yarx is right on pretty much all fronts.
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.
从 Glimpse 1.7 开始,有一种更通用的方法来保护
~/glimpse.axd
,其额外好处是您可以对所有人使用相同的策略。您只需要确保您的自定义策略也被资源调用:注意
| RuntimeEvent.ExecuteResource
。请参阅底部:保护 Glimpse .axd 前进的方向。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:Notice the
| RuntimeEvent.ExecuteResource
. See bottom of: Securing Glimpse.axd the way forward.