Skip to content

Harden Apps Script forwarder validation#151

Draft
poulcarlsen53 wants to merge 1 commit into
Kianmhz:mainfrom
poulcarlsen53:optimization/appscript-forwarder-hardening
Draft

Harden Apps Script forwarder validation#151
poulcarlsen53 wants to merge 1 commit into
Kianmhz:mainfrom
poulcarlsen53:optimization/appscript-forwarder-hardening

Conversation

@poulcarlsen53
Copy link
Copy Markdown
Contributor

Summary

This tightens the Apps Script relay script without changing the tunnel protocol.

It rejects obvious non-tunnel POST bodies before spending UrlFetchApp quota, expands the relay loop guard to cover script.googleusercontent.com variants, and exposes a little more safe deployment metadata from doGet.

Why

A mispointed RELAY_URLS value or public probe can waste daily Apps Script quota and produce confusing non-batch responses in the client. This keeps the script as a simple encrypted forwarder, but makes the edges safer and easier to diagnose.

Notes

I intentionally did not add a custom UrlFetchApp.fetch timeout option here because Apps Script does not document a supported per-request timeout parameter for UrlFetchApp. The script still uses followRedirects: false and muteHttpExceptions: true, and still throws when every upstream fails so clients treat that as an endpoint failure instead of trying to decode an error string.

Validation

  • go test -count=1 ./apps_script ./internal/carrier
  • go test -count=1 ./...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant