Skip to content

Commit 74e02e9

Browse files
committed
fix: add parseInt radix, return 403 on unauthorized log export
- bedrock provider and firecrawl block were calling Number.parseInt without a radix parameter which can misinterpret strings with leading zeros. added explicit radix 10 to both. - logs export route was returning 200 with just CSV headers when access was denied — changed to return 403 so clients and monitoring can actually tell the request was unauthorized
1 parent 4fcfe76 commit 74e02e9

3 files changed

Lines changed: 4 additions & 9 deletions

File tree

apps/sim/app/api/logs/export/route.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,8 @@ export const GET = withRouteHandler(async (request: NextRequest) => {
7575

7676
const access = await checkWorkspaceAccess(params.workspaceId, userId)
7777
if (!access.hasAccess) {
78-
return new NextResponse(`${header}\n`, {
79-
status: 200,
80-
headers: {
81-
'Content-Type': 'text/csv; charset=utf-8',
82-
'Content-Disposition': 'attachment; filename="logs-export.csv"',
83-
'Cache-Control': 'no-cache',
84-
},
78+
return new NextResponse('Forbidden', {
79+
status: 403,
8580
})
8681
}
8782

apps/sim/blocks/blocks/firecrawl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ Example 2 - Product Data:
660660
}
661661
if (onlyMainContent != null) result.onlyMainContent = onlyMainContent
662662
if (params.maxConcurrency != null && params.maxConcurrency !== '') {
663-
result.maxConcurrency = Number.parseInt(String(params.maxConcurrency))
663+
result.maxConcurrency = Number.parseInt(String(params.maxConcurrency), 10)
664664
}
665665
if (params.ignoreInvalidURLs != null) {
666666
result.ignoreInvalidURLs = params.ignoreInvalidURLs

apps/sim/providers/bedrock/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export const bedrockProvider: ProviderConfig = {
344344
temperature: Number.parseFloat(String(request.temperature ?? 0.7)),
345345
}
346346
if (request.maxTokens != null) {
347-
inferenceConfig.maxTokens = Number.parseInt(String(request.maxTokens))
347+
inferenceConfig.maxTokens = Number.parseInt(String(request.maxTokens), 10)
348348
}
349349

350350
const shouldStreamToolCalls = request.streamToolCalls ?? false

0 commit comments

Comments
 (0)