Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add security headers in response #779

Merged
merged 9 commits into from
Nov 26, 2024
Merged

Conversation

arcoraven
Copy link
Contributor

@arcoraven arcoraven commented Nov 24, 2024

PR-Codex overview

This PR focuses on refactoring the middleware functions in the server codebase, changing export const to export function, updating CORS handling, and modifying address examples in schemas and tests. It also removes unused CORS test files and improves error handling.

Detailed summary

  • Deleted unused files: src/tests/cors.test.ts, src/server/middleware/cors/cors.ts, src/server/middleware/cors/vary.ts, src/server/middleware/cors/index.ts.
  • Updated AddressSchema and TransactionHashSchema to change examples.
  • Modified middleware functions to use export function instead of export const.
  • Improved CORS handling in withCors function.
  • Enhanced error messages in withEnforceEngineMode.
  • Updated address examples in tests to use 0x000000000000000000000000000000000000dead.
  • Refactored admin routes authentication.
  • Corrected imports for openApi files.
  • Added withSecurityHeaders middleware.
  • Adjusted rate limiting and request logging functions.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@@ -37,12 +37,10 @@ const QUEUES: Queue[] = [
export const withAdminRoutes = async (fastify: FastifyInstance) => {
// Configure basic auth.
await fastify.register(fastifyBasicAuth, {
validate: (username, password, req, reply, done) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating all fastify "callback style" or "async/await" style. This will be strictly enforced in a future fastify version.

Copy link

socket-security bot commented Nov 24, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] environment, filesystem, shell 0 16.1 kB satazor
npm/[email protected] None 0 13.5 kB sindresorhus

🚮 Removed packages: npm/@fastify/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

src/server/middleware/cors.ts Fixed Show fixed Hide fixed
src/server/middleware/cors.ts Fixed Show fixed Hide fixed
src/server/middleware/cors.ts Fixed Show fixed Hide fixed
@arcoraven arcoraven merged commit 77da8a4 into main Nov 26, 2024
5 checks passed
@arcoraven arcoraven deleted the ph/securityHeaderMiddleware branch November 26, 2024 10:15
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.

2 participants