Harden webhook authentication and document architecture#32
Open
stevenschling13 wants to merge 1 commit intomainfrom
Open
Harden webhook authentication and document architecture#32stevenschling13 wants to merge 1 commit intomainfrom
stevenschling13 wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a comprehensive configuration and testing infrastructure to the Notion-Grow-Ops application. The changes establish secure HMAC-based authentication, centralized configuration management, and a robust test suite.
Key Changes
- Configuration Management: Adds
src/config.tswith Zod-based validation for environment variables, supporting optional Notion integration with interdependency checks - Security Refactoring: Extracts HMAC functionality into
src/security/hmac.tswith timing-safe verification and hex format validation - Test Suite: Implements comprehensive unit tests for HMAC verification, request mapping utilities, and HTTP endpoint authentication
- Server Enhancement: Updates server initialization to support config overrides and decorates the Fastify instance with typed configuration
- Documentation: Adds extensive README with architecture overview, configuration reference, and troubleshooting guide
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/config.ts |
New configuration loader with Zod schema validation and interdependent Notion field checks |
src/security/hmac.ts |
Extracted HMAC signing and verification with timing-safe comparison and format validation |
src/server.ts |
Updated to accept config overrides, decorated Fastify instance with config, and configurable log level |
src/routes/analyze.ts |
Refactored to use centralized HMAC verification and config, integrated buildHistoryKey helper |
src/domain/mapping.ts |
Added buildHistoryKey function for deterministic SHA-256 key generation and updated buildHistoryProps signature |
src/index.ts |
Enhanced error handling with catch block and process exit on startup failure |
test/security/hmac.test.ts |
New tests for HMAC signature generation and verification edge cases |
test/mapping.test.ts |
New tests for writeback mapping and history property building |
test/hmac.test.ts |
Added silent logging configuration for cleaner test output |
README.md |
Comprehensive documentation covering architecture, configuration, testing, and troubleshooting |
pnpm-lock.yaml |
Updated lockfile with new dependencies and version updates |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
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.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_69069b3d237c832c828730c816ab76ea