Skip to content

fix: send User-Agent on upload-url request (edge WAF NoUserAgent block) - #11

Closed
loera140 wants to merge 1 commit into
mainfrom
fix/user-agent-header
Closed

loera140 wants to merge 1 commit into
mainfrom
fix/user-agent-header

Conversation

@loera140

Copy link
Copy Markdown
Contributor

Problem

Since the SOC 2 edge WAF (environment PR #189, applied 2026-07-11 00:49 UTC) attached AWS CommonRuleSet to the app2/apex CloudFront distribution, every test-result upload has been failing with a bare 403, surfacing to users as:

Uploading to BuildPulse...
Error: API request failed with status 403

Root cause: the CommonRuleSet NoUserAgent_HEADER rule blocks any request that arrives with no User-Agent. The getUploadUrl POST is issued via Node core https.request, which sends no default User-Agent, so the request was dropped at the edge before reaching the API. (curl always sends a UA, which is why manual tests passed.)

Fix

Set an explicit User-Agent: buildpulse-test-reporter-action/<version> on the upload-url request. The S3 PUT goes directly to S3 (bypasses CloudFront/WAF) and is unaffected.

Verified

  • npm test — 31/31 pass
  • Runtime UA resolves to buildpulse-test-reporter-action/3.0.0
  • With a UA present, POST /api/test-results/upload-url returns 200/401 (reaches the app) instead of the WAF 403

Related

  • environment WAF override (keeps whole CRS enforcing except NoUserAgent_HEADER) — companion PR
  • Incident: all uploaders 403d 2026-07-11 → 2026-07-13; reported by retailnext

🤖 Generated with Claude Code

Node core http sends no default User-Agent, so the getUploadUrl POST reached
the BuildPulse edge WAF (AWS CommonRuleSet) with no UA and was blocked by the
NoUserAgent_HEADER rule with a bare 403 — surfacing to users as the generic
"API request failed with status 403". Set an explicit
buildpulse-test-reporter-action/<version> User-Agent so the request reaches the API.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@buildpulse-agent buildpulse-agent Bot added the agent-review-pending Agent code-review dispatched; verdict in flight label Jul 13, 2026
@loera140 loera140 added agent-reviewed Reviewed - approved and removed agent-review-pending Agent code-review dispatched; verdict in flight labels Jul 13, 2026

@loera140 loera140 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agent code review

Walkthrough

Adds an explicit User-Agent: buildpulse-test-reporter-action/<version> header to the getUploadUrl POST in src/upload.js, sourcing the version from package.json. Node's core http/https client sends no default UA, which was tripping AWS CommonRuleSet's NoUserAgent_HEADER rule at the edge WAF and returning a bare 403. The dist/index.js bundle is rebuilt to match, including the ncc-inlined package.json module.

Findings

  • No issues found.

Verdict

APPROVE. Change is tightly scoped to the described fix, the src edit and the regenerated dist bundle are consistent, ACTION_VERSION resolves to the real 3.0.0 from package.json (confirmed against both package.json and the inlined module 8330), and there are no auto-merge red flags: no scope drift, no hallucinated APIs (require('../package.json') is standard Node), no tests weakened (repo has no unit tests), no prompt-injection content. The S3 PUT in uploadToS3 also lacks a UA, but S3 signed URLs bypass the BuildPulse WAF, so that's correctly out of scope.

Confidence

HIGH — read both changed files fully, verified version wiring, and confirmed the dist change is a faithful rebuild of the src change.

@loera140

Copy link
Copy Markdown
Contributor Author

Closing as redundant. origin/main (e3301a5, PR #10 fix/user-agent-cloudfront) already sends an explicit User-Agent (BuildPulse-TestReporter/3.0) on the upload-url request and S3 PUT — my local checkout was stale when I branched. The new action is already fixed and v3 is re-tagged; demo uploads recovered 2026-07-12. The remaining exposure is the LEGACY buildpulse-action (no User-Agent, e.g. retailnext pin 0b048a4), which is covered by the WAF override in environment PR #191.

@loera140 loera140 closed this Jul 13, 2026
@loera140
loera140 deleted the fix/user-agent-header branch July 13, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-reviewed Reviewed - approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant