Files
Open_Ultra_SAST/benchmarks/pairs/agent-vfc/new-erp-final-app-6e9644/fixed.ts
T
Marius CiepluchandClaude Fable 5.1 8ab4207618 feat(pair-corpus-honesty): add vibe-py, vfc-js and agent-vfc slices with mechanism vocabulary
Tasks 1.1, 5.1, 5.2, 5.4 and the data half of 5.3.

- mechanisms.toml: closed vocabulary v1 (20 ids) every expected row cites.
- vibe-py: 35 Real-Vuln-Benchmark pairs (Apache-2.0), human provenance only
  because the LLM-generated repositories carry no license (escalated).
- vfc-js: 17 Node fix-commit pairs harvested upstream (MIT/Apache-2.0),
  SecBench.js itself is not vendored (no license); sinks derived on 13/17.
- agent-vfc: 29 agent-trailer fixes as catalog-candidates.toml plus
  REVIEW.md; the loaded catalog stays empty until a human reviews them.
- datasets.toml and README document every slice and its review status.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
2026-09-05 10:45:42 +02:00

73 lines
3.0 KiB
TypeScript

// Provenance: Sachin-Salgar/NEW_ERP_FINAL (fixed).
// repo: Sachin-Salgar/NEW_ERP_FINAL
// commit: 6e9644c81ce3fb356669157182a5ef09a70c4b59
// parent: 08976c5d7a07b0663669b875b4507446199f85d7
// commit_url: https://github.com/Sachin-Salgar/NEW_ERP_FINAL/commit/6e9644c81ce3fb356669157182a5ef09a70c4b59
// cve:
// license: Apache-2.0
// function: origin
// relpath: src/presentation/http/app.ts
// provenance: agent
// mechanism: permissive_default
export async function createApplication(config: AppConfig, providedPool?: Pool): Promise<FastifyInstance> {
const app = Fastify({
logger: createLogger(config),
requestIdHeader: 'x-request-id',
requestIdLogLabel: 'requestId',
ignoreTrailingSlash: true,
ajv: {
customOptions: {
allErrors: true,
coerceTypes: true,
removeAdditional: false,
},
},
});
const pool = providedPool ?? createDatabasePool(config);
const repository = new IdentityAwarePostgresPlatformRepository(pool);
const passwordHasher = new BcryptPasswordHasher();
const jwtTokenService = new JwtTokenService(config);
const authService = new AuthenticationService(repository, passwordHasher, jwtTokenService);
const authorizationService = new AuthorizationService(repository);
const branchService = new BranchService(repository);
const coreEnterpriseService = new CoreEnterpriseService(repository);
const locationService = new LocationService(repository);
const moduleAccessService = new ModuleAccessService(pool);
const registrationService = new UserRegistrationService(repository, passwordHasher);
const tenantMembershipService = new TenantMembershipService(repository);
app.decorate('appConfig', config);
app.decorate('authService', authService);
app.decorate('authorizationService', authorizationService);
app.decorate('branchService', branchService);
app.decorate('coreEnterpriseService', coreEnterpriseService);
app.decorate('locationService', locationService);
app.decorate('moduleAccessService', moduleAccessService);
app.decorate('registrationService', registrationService);
app.decorate('jwtTokenService', jwtTokenService);
app.decorate('tenantMembershipService', tenantMembershipService);
await app.register(cors, {
origin: (origin, callback) => {
callback(null, isCorsOriginAllowed(config, origin));
},
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization', 'x-tenant-id'],
credentials: true,
optionsSuccessStatus: 204,
});
app.setErrorHandler(buildErrorHandler(config));
await app.register(healthRoutes, { prefix: config.API_PREFIX });
await app.register(authRoutes, { prefix: config.API_PREFIX });
await app.register(rbacRoutes, { prefix: config.API_PREFIX });
await app.register(branchRoutes, { prefix: config.API_PREFIX });
await app.register(coreEnterpriseRoutes, { prefix: config.API_PREFIX });
await app.register(locationRoutes, { prefix: config.API_PREFIX });
return app;
}