Support for Non-401 Error Codes from the validateFunc
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, node.js
调研方向
首先阅读 cookie plugin 对 validateFunc 的处理,并将其与 issue 中描述的 @hapi/basic validate 行为进行比较。完成的标准是:对于对请求区域无效的 cookie,validation 可以返回非 401 的 Boom 错误,例如 403 Forbidden,并且有覆盖响应状态的测试。
由索引模型根据 Issue 内容生成。
描述
Support plan
- is this issue currently blocking your project? (yes/no): No
- is this issue affecting a production system? (yes/no): No
Context
- node version:
v14.17.0 - module version:
11.0.2 - environment (e.g. node, browser, native): Node
- used with (e.g. hapi application, another framework, standalone, ...): Hapi application (Hapi version =
20.2.1) - any other relevant information:
What problem are you trying to solve?
I have a system that involves multiple different "regions" of authorization, I want a cookie to only be valid for one of these "regions", and I have added validation checks into the validateFunc. I would love be able to respond to the client with a 403 Forbidden when the cookie provided is for a different "region" than that which it is trying to access.
Example:
I have "regions" 1 and 2, and an authorization cookie is used for region 1, but the user is making a request to GET /region/2 I would like to be able to throw boom.forbidden(), and it set the response code to 403 instead of the plugin only throwing 401 to the user.
Do you have a new or modified API suggestion to solve the problem?
I think a solution following a similar vein as to how @hapi/basic does it where if the validateFunc throws an error(/Boom error) it replaces the default boom.unauthorized()
From the @hapi/basic API documentation for the validate function:
- Throwing an error from this function will replace default
Boom.unauthorizederror
- 主要语言
- JavaScript
- 星标
- 229
- 派生
- 99
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
hapijs/cookie 的其他 Issue
-
support
难度 4/5 3-5 天 新手友好度 45/100
-
bug
难度 4/5 3-5 天 新手友好度 30/100
-
support
难度 5/5 一周以上 新手友好度 25/100
-
support
难度 5/5 一周以上 新手友好度 10/100
-
support
难度 3/5 1-2 天 新手友好度 25/100
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
obsidianmd/obsidian-help#1169 ·
维护者通常 2 天内回复
-
[docs] RELEASE.md: wrong branch name, no check that the prepare PR merged with the right subject, manual publish step可能已有人在做 @albertteoh 今天认领。 未关闭documentation
难度 2/5 1-3 小时 新手友好度 85/100
jaegertracing/jaeger-ui#4739 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
-
documentation
难度 2/5 1-3 小时 新手友好度 74/100
keepassxreboot/keepassxc-browser#3159 · 1 条评论 ·
-
Add: ESP 2 RS未关闭approved check:passed feeds:add
难度 1/5 1 小时以内 新手友好度 67/100