Skip to main content

Matriz de Serviços — #07 SQL Injection

Data: 2026-07-08


Legenda

SímboloSignificado
Já usa IUserProvider — protegido automaticamente
🔧Precisa migrar leitura direta → IUserProvider
Não afetado (não lê api-company-target)

Matriz Completa

ServiçoSchema sourceTipo de leituraQueries DapperEF CoreDMLCache keyAção
cartIUserProviderIndireta~15UPDATE✅ 2✅ Nenhuma
checkoutIUserProviderIndireta~17UPDATE✅ Nenhuma
jobsIUserProviderIndireta~10INSERT✅ Nenhuma
authJWT claim only⬜ Nenhuma
productDatabaseConfig direto + IUserProviderTipo A~5✅ dinamico🔧 Migrar DatabaseConfig.GetSchema()
storeIUserProvider + DatabaseConfig diretoTipo A~7INSERT, UPDATE, DELETE✅ 4🔧 Migrar DatabaseConfig.GetSchema()
backofficeIUserProvider + DatabaseConfig diretoTipo A~9INSERT✅ 3🔧 Migrar DatabaseConfig.GetSchema()
integrationDatabaseConfig diretoTipo A + B🔧 Migrar DatabaseConfig.GetSchema() + 3 handlers
messageDatabaseConfig diretoTipo A🔧 Migrar DatabaseConfig.GetSchema()
payments-reportsDireto (6 locais)Tipo A + B + C~17🔧 Migrar 6 pontos + DatabaseConfig
showcaseDireto (3 locais)Tipo A + C~5🔧 Migrar 3 pontos + DatabaseConfig
bffPropaga apenas⬜ Nenhuma (só repassa)

Detalhamento por Serviço

✅ Serviços já protegidos (usam IUserProvider)

coezzion-service-cart

  • CartService.cs_userProvider.GetSchemaName()
  • ProductRepository.cs → schema via parâmetro (do caller via IUserProvider)
  • CartRepository.cs → schema via _userProvider
  • AttendanceRepository.cs → schema via _userProvider
  • CacheStoreRepositoryDecorator.cs → schema via _userProvider
  • CacheUserReadRepositoryDecorator.cs → schema via _userProvider

coezzion-service-checkout

  • ControlOperationRepository.cs_userProvider.GetSchemaName()
  • PaymentRepository.cs_userProvider.GetSchemaName()
  • CoreSqlRepository.cs_userProvider.GetSchemaName()
  • PaymentSqlRepository.cs_userProvider.GetSchemaName()

coezzion-service-jobs

  • Todos os repositórios usam _userProvider.GetSchemaName()

🔧 Serviços que precisam de migração

coezzion-service-product (3 pontos)

#ArquivoLinhaTipoAção
1Product.API/Configuration/DatabaseConfig.cs78Tipo AInjetar IUserProvider via provider.GetService<IUserProvider>()
2Product.API/gRPC/ProductAppService.cs31Tipo DMiddleware/interceptador gRPC que popula SchemaNameScopedWrapper
3Product.API/Filters/CompanyTargetHeaderAttribute.cs66-70FiltroJá popula SchemaNameScopedWrapper — após fix no UserProvider, o fallback (E) valida

coezzion-service-store (2 pontos)

#ArquivoLinhaTipoAção
1Store.API/Configuration/DatabaseConfig.cs79Tipo AInjetar IUserProvider
2Store.Infrastructure/Data/Repositories/SellerVacationRepository.csvariaIndiretaJá usa _userProvider.GetSchemaName()

coezzion-service-backoffice (1 ponto)

#ArquivoLinhaTipoAção
1Backoffice.API/Configuration/DatabaseConfig.cs100Tipo AInjetar IUserProvider

coezzion-service-integration (4 pontos)

#ArquivoLinhaTipoAção
1Integration.API/Configuration/DatabaseConfig.cs95Tipo AInjetar IUserProvider
2Integration.Infrastructure/EventHandlers/PaymentCreatedEventHandler.cs22Tipo BInjetar IUserProvider no handler
3Integration.Infrastructure/EventHandlers/ChangeCartDataEventHandler.cs24Tipo BInjetar IUserProvider no handler
4Integration.Infrastructure/EventHandlers/UpdateStatusPaymentEventHandler.cs27Tipo BInjetar IUserProvider no handler

coezzion-service-message (1 ponto)

#ArquivoLinhaTipoAção
1Message.API/Configuration/DatabaseConfig.cs44Tipo AInjetar IUserProvider

coezzion-service-payments-reports (6 pontos)

#ArquivoLinhaTipoAção
1Payments.Reports.API/Configuration/DatabaseConfig.cs112Tipo AInjetar IUserProvider
2Payments.Reports.Infraestructure/Data/Repositories/PaymentRepository.cs293, 367Tipo CInjetar IUserProvider no construtor
3Payments.Reports.Infraestructure/Data/Repositories/Read/CartRepository.cs245, 322Tipo CInjetar IUserProvider no construtor
4Payments.Reports.Infraestructure/Data/Repositories/Read/IntegrationRepository.cs110Tipo CInjetar IUserProvider no construtor
5Payments.Reports.Infraestructure/Utils/CreateCodePaymentsForIntegrations.cs20Tipo BInjetar IUserProvider
6Payments.Reports.Infraestructure/EventHandlers/PaymentCreatedEventHandler.cs22Tipo BInjetar IUserProvider

coezzion-service-showcase (3 pontos)

#ArquivoLinhaTipoAção
1ShowCase.Api/Configuration/DatabaseConfig.cs60Tipo AInjetar IUserProvider
2ShowCase.Infrastructure/Data/Repositories/Read/UserRepository.cs22Tipo CInjetar IUserProvider no construtor
3ShowCase.Infrastructure/Services/PushNotification/PushNotificationService.cs26Tipo CInjetar IUserProvider

⬜ Serviços não afetados

coezzion-service-auth

Usa apenas JWT claim schema — não lê o header api-company-target.

coezzion-service-bff

Repassa o header via HttpClientDelegatingHandlerSchema, mas não executa queries SQL diretamente.


Resumo de esforço

CategoriaQuantidadeEsforço estimado
Fix central (UserProvider)1 arquivo~15 linhas
DatabaseConfig.GetSchema()8 arquivos~2 linhas cada
Event handlers5 arquivos~2 linhas cada
Repositórios (construtor)5 arquivos~3 linhas cada
gRPC1 arquivo~10 linhas (interceptador)
Total20 arquivos~80 linhas