feat: task add vercel bypass token - #51
Conversation
Greptile SummaryThis PR adds support for Vercel bypass tokens to the LensCore CI template, allowing accessibility scans to bypass Vercel's protection layer. The implementation also removes verbose logging and input descriptions to clean up the workflow. Critical Issues Found:
Minor Changes:
Confidence Score: 1/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant GHA as GitHub Actions
participant Docker as Docker Container
participant LensCore as LensCore Service
participant Target as Target URL (Vercel)
GHA->>Docker: Pull accesstimeco/lenscore image
GHA->>Docker: Start container with env vars
Docker->>LensCore: Initialize service
loop Health Check (max 60s)
GHA->>LensCore: GET /api/health
alt Service Ready
LensCore-->>GHA: 200 OK
else Not Ready
LensCore-->>GHA: Connection Failed
GHA->>GHA: Wait 2 seconds
end
end
alt VERCEL_BYPASS_TOKEN provided
GHA->>GHA: Construct HEADER_ARGS with token
GHA->>Docker: exec: node cli.js with --header flag
else No token
GHA->>Docker: exec: node cli.js without header
end
Docker->>LensCore: Execute accessibility scan
LensCore->>Target: HTTP Request (with/without bypass header)
Target-->>LensCore: HTML Response
LensCore->>LensCore: Run accessibility checks
LensCore->>Docker: Write report.json
Docker-->>GHA: Copy report.json
GHA->>GHA: Generate summary from report
GHA->>GHA: Upload artifact
GHA->>Docker: Stop and remove container
|
| HEADER_ARGS="" | ||
|
|
||
| if [ -n "${{ secrets.VERCEL_BYPASS_TOKEN }}" ]; then | ||
| HEADER_ARGS="--header \"${{ inputs.vercel_bypass_header_name }}: ${{ secrets.VERCEL_BYPASS_TOKEN }}\"" | ||
| fi |
There was a problem hiding this comment.
logic: Shell injection vulnerability: HEADER_ARGS is constructed with unescaped quotes and then used in sh -c, causing the --header flag to fail and potentially allowing command injection if the secret contains shell metacharacters.
| HEADER_ARGS="" | |
| if [ -n "${{ secrets.VERCEL_BYPASS_TOKEN }}" ]; then | |
| HEADER_ARGS="--header \"${{ inputs.vercel_bypass_header_name }}: ${{ secrets.VERCEL_BYPASS_TOKEN }}\"" | |
| fi | |
| if [ -n "${{ secrets.VERCEL_BYPASS_TOKEN }}" ]; then | |
| HEADER_ARGS="--header '${{ inputs.vercel_bypass_header_name }}: ${{ secrets.VERCEL_BYPASS_TOKEN }}'" | |
| fi |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/lens-core-template.yml
Line: 71:75
Comment:
**logic:** Shell injection vulnerability: `HEADER_ARGS` is constructed with unescaped quotes and then used in `sh -c`, causing the `--header` flag to fail and potentially allowing command injection if the secret contains shell metacharacters.
```suggestion
if [ -n "${{ secrets.VERCEL_BYPASS_TOKEN }}" ]; then
HEADER_ARGS="--header '${{ inputs.vercel_bypass_header_name }}: ${{ secrets.VERCEL_BYPASS_TOKEN }}'"
fi
```
How can I resolve this? If you propose a fix, please make it concise.| docker exec lenscore sh -c \ | ||
| "node dist/cli.js scan \"${{ inputs.url }}\" \ | ||
| --ci \ | ||
| -u ${{ inputs.max_urls }} \ | ||
| -d ${{ inputs.scan_depth }} \ | ||
| -t ${{ inputs.timeout }} \ | ||
| --skip-cache \ | ||
| $HEADER_ARGS \ | ||
| -o /app/report.json \ | ||
| --no-exit-on-violations" || true |
There was a problem hiding this comment.
logic: The sh -c with unquoted $HEADER_ARGS expansion will cause word splitting and quote removal, breaking the --header argument. The inner quotes in HEADER_ARGS won't be preserved.
| docker exec lenscore sh -c \ | |
| "node dist/cli.js scan \"${{ inputs.url }}\" \ | |
| --ci \ | |
| -u ${{ inputs.max_urls }} \ | |
| -d ${{ inputs.scan_depth }} \ | |
| -t ${{ inputs.timeout }} \ | |
| --skip-cache \ | |
| $HEADER_ARGS \ | |
| -o /app/report.json \ | |
| --no-exit-on-violations" || true | |
| docker exec lenscore sh -c \ | |
| "node dist/cli.js scan \"${{ inputs.url }}\" \ | |
| --ci \ | |
| -u ${{ inputs.max_urls }} \ | |
| -d ${{ inputs.scan_depth }} \ | |
| -t ${{ inputs.timeout }} \ | |
| --skip-cache \ | |
| ${HEADER_ARGS} \ | |
| -o /app/report.json \ | |
| --no-exit-on-violations" || true |
Note: This requires fixing HEADER_ARGS construction (line 74) to use single quotes as suggested.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/lens-core-template.yml
Line: 77:86
Comment:
**logic:** The `sh -c` with unquoted `$HEADER_ARGS` expansion will cause word splitting and quote removal, breaking the `--header` argument. The inner quotes in `HEADER_ARGS` won't be preserved.
```suggestion
docker exec lenscore sh -c \
"node dist/cli.js scan \"${{ inputs.url }}\" \
--ci \
-u ${{ inputs.max_urls }} \
-d ${{ inputs.scan_depth }} \
-t ${{ inputs.timeout }} \
--skip-cache \
${HEADER_ARGS} \
-o /app/report.json \
--no-exit-on-violations" || true
```
Note: This requires fixing `HEADER_ARGS` construction (line 74) to use single quotes as suggested.
How can I resolve this? If you propose a fix, please make it concise.
Refactor PR
Goals
Scope
Which code areas/components are touched.
Impact
Expected behavior changes (there should be none for a pure refactor).
Checklist