Skip to content

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}

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.

@socket-security
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/cross-spawn@7.0.6 environment, filesystem, shell 0 16.1 kB satazor
npm/pretty-ms@9.2.0 None 0 13.5 kB sindresorhus

🚮 Removed packages: npm/@fastify/basic-auth@5.1.1, npm/cross-spawn@7.0.3, npm/pretty-ms@9.1.0

View full report↗︎

@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.

3 participants