fix: spec-author secrets 声明 + spec-check 精化(v1.5.3,W0-C4 #133,ADR-0050) - #39
Conversation
…3,W0-C4 #133,ADR-0050)
|
Warning Review limit reached
Next review available in: 3 minutes Limit details: You’ve used all 10 included reviews currently available. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Comment |
PR Summary by QodoFix spec-author secrets declaration and harden spec-check parsing/injection scan
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. Invalid secrets schema
|
| LLM_API_KEY: { type: environment, required: true } | ||
| CB_APP_ID: { type: environment, required: true } | ||
| AGENT_APP_SECRET: { type: environment, required: true } |
There was a problem hiding this comment.
1. Invalid secrets schema 🐞 Bug ≡ Correctness
.github/workflows/spec-author.yml 在 on.workflow_call.secrets 下为 secrets 声明了 `{ type: environment
},该字段不在 GitHub Actions 语法中,可能导致 workflow 解析/校验失败。并且官方文档明确提示 workflow_call 不支持 environment`
语义,试图以此传递/区分 environment secrets 也不会按预期工作。
Agent Prompt
### Issue description
Reusable workflow secrets are defined with `{ type: environment, required: true }`, but `on.workflow_call.secrets.<secret_id>` only supports fields like `required` (and optionally `description`). Using an unsupported key can fail workflow validation and will not implement “environment-typed secrets”.
### Issue Context
GitHub docs: `on.workflow_call.secrets` is a map of secret identifiers with `required` boolean; additionally `workflow_call` does not support environment secrets being passed from the caller.
### Fix Focus Areas
- .github/workflows/spec-author.yml[14-19]
### Proposed fix
- Replace each secret entry with:
- `LLM_API_KEY: { required: true }`
- `CB_APP_ID: { required: true }`
- `AGENT_APP_SECRET: { required: true }`
- Optionally add `description:` fields.
- If you truly need environment secrets behavior, don’t try to encode it in `workflow_call.secrets`; instead use job-level `environment:` in the called workflow and rely on that environment’s secrets (not caller-passed secrets).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| prefix = text[line_start:m.start()] | ||
| suffix = text[m.end():line_end] | ||
| quoted = (('"' in prefix and '"' in suffix) | ||
| or (QL in prefix and QR in suffix)) |
There was a problem hiding this comment.
2. Quote exemption too broad 🐞 Bug ⛨ Security
scripts/spec-check.py 的注入扫描新增“同行引号段豁免”逻辑仅判断同一行命中段前后是否分别出现过引号字符,这会把不在引号包裹内的命中段误判为 quoted,从而跳过注入报错,造成注入条款漏检。攻击者/误写 spec 只需在同一行前后放置无关引号即可触发豁免。
Agent Prompt
### Issue description
The new injection-scan exemption treats a match as “quoted” if there is any `"` before the match and any `"` after it on the same line. This does not prove the match is inside a quoted span, and can wrongly exempt real injection content.
### Issue Context
This script is a gatekeeper (“模式命中即报,宁枉勿纵”). Exemptions must be precise; otherwise a malicious/accidental spec line can bypass injection detection.
### Fix Focus Areas
- scripts/spec-check.py[121-137]
### Proposed fix
Implement proper ‘inside quoted span’ detection per-line:
- Extract the full line `[line_start:line_end]`.
- Find all quoted spans on that line via regex (support at least: `"..."`, `“...”`, optionally `'...'`).
- Consider the match exempt **only if** `m.start()`/`m.end()` is fully within one quoted span.
- Avoid relying on mere presence of quotes in prefix/suffix.
Add unit-test-like fixtures (even if just a small self-test block) for:
- injection inside quotes (should exempt)
- injection outside quotes but line contains other quotes (must NOT exempt)
- nested/multiple quoted segments
- single quotes if you want to keep doc-comment promise of supporting them.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
两个实测问题(首跑 run 32452510063):\n1. workflow_call 未声明 secrets——conductor 传 secrets 时 workflow 级 startup_failure(调用方向未声明的 secret 传值非法)。声明 LLM_API_KEY/CB_APP_ID/AGENT_APP_SECRET(environment 类型,required)。\n2. spec-check 两处精化:(a) 模型输出剥 ```围栏/前导说明行(首跑实测被围栏包裹→误判缺 frontmatter);(b) 注入豁免改同行引号段+16字否定前缀+『即fail』后缀——正例 IR-0001 v3 过、4 条注入负例全拦(回归套件在 PR 描述外的本地跑里)。