Repository navigation
LOU-D13: Trigger hardening: webhook authentication and real cron expressions - #47
Merged
Merged
Conversation
WIP commit before merging main.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
WebhookTriggerAdaptergetsauth:{ type: 'hmac' | 'bearer' | 'custom' }. HMAC verifies the RAW body bytes (header/algorithm/prefix configurable, optionaltimestampHeader+toleranceSecondsreplay protection signing${timestamp}.${body}), bearer and HMAC compares are constant-time, custom takesverify(req, rawBody). Failures return a generic401 {"error":"Unauthorized"}and are logged via the SDKLogger(newloggeroption) without secrets/signatures. Noauthon a non-loopback host logs a one-time warning.CronTriggerAdapteracceptscron(5-field expression or@hourly/@daily/@weekly/@monthly, plustimezone) alongside the existingintervalMs. New dependency-freesrc/triggers/cronExpression.ts(parseCronExpression(expr, tz).nextRun(after),CronExpressionError), exported from@loushy/build-ai-agent/triggers.docs/api-overview.mdwith a security note.Why
Audit findings: the webhook adapter accepted unauthenticated requests and cron only supported a fixed interval (eve has
defineSchedule({ cron })).How verified
Run on the result of merging origin/main (85c436d):
npx tsc --noEmit: cleannpm run lint: 0 errors (432 pre-existing warnings; none insrc/triggers)npm run build+ create-loushy-agent build: successnpm run test:coverage: 97 files passed, 1250 tests passed, 3 skipped, thresholds metnpm run fallow: exit 0 (0 above threshold)npm run docs:verify-snippets: all 34 snippets type-check, 5 run cleanlyNotes for reviewer
SlackTriggerAdapterdoes not verify signatures (it only posts replies), so there was nothing to share; the HMAC helpers live insrc/triggers/webhookAuth.ts. Slack inbound verification could reuse them in a follow-up.hmac.prefixdefaults to${algorithm}=(sosha1=with sha1;sha256=as specified for the default).*hours keep hourly cadence (documented + tested).CronTriggerAdapterOptionsis now a union (intervalMsxorcron); existing interval usage is unchanged.🤖 Generated with Claude Code