lint fehler behoben
Some checks failed
Code Analysis and Production Deploy / analyze (push) Failing after 10m21s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Has been skipped

This commit is contained in:
Torsten Schulz (local)
2026-08-12 12:03:29 +02:00
parent 9889430109
commit 0475e3084d
3 changed files with 17 additions and 20 deletions

View File

@@ -42,8 +42,6 @@ export default defineEventHandler(async (event) => {
}) })
} }
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
const dataDir = getServerDataPath('membership-applications')
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
const filePath = getServerDataPath('membership-applications', `${id}.json`) const filePath = getServerDataPath('membership-applications', `${id}.json`)

View File

@@ -46,13 +46,8 @@ async function withIdentityLock(hash, operation) {
} }
async function findMatchingApplication(data) { async function findMatchingApplication(data) {
let files = []
try { try {
files = await fs.readdir(APPLICATIONS_DIR) const files = await fs.readdir(APPLICATIONS_DIR)
} catch (error) {
if (error?.code !== 'ENOENT') throw error
return null
}
const target = identityHash(data) const target = identityHash(data)
for (const file of files.filter(file => file.endsWith('.json'))) { for (const file of files.filter(file => file.endsWith('.json'))) {
try { try {
@@ -67,6 +62,10 @@ async function findMatchingApplication(data) {
} }
} }
return null return null
} catch (error) {
if (error?.code !== 'ENOENT') throw error
return null
}
} }
export async function createMembershipApplication(data) { export async function createMembershipApplication(data) {

View File

@@ -102,7 +102,7 @@ export function upsertPushToken(user, { token, platform = 'android', appVersion
return user return user
} }
async function sendFcmMessage({ serviceAccount, accessToken, token, title, body, data = {} }) { async function sendFcmMessage({ serviceAccount, accessToken, token, data = {} }) {
const projectId = projectIdFromServiceAccount(serviceAccount) const projectId = projectIdFromServiceAccount(serviceAccount)
if (!projectId) throw new Error('FCM project_id fehlt.') if (!projectId) throw new Error('FCM project_id fehlt.')
const response = await fetch(`https://fcm.googleapis.com/v1/projects/${projectId}/messages:send`, { const response = await fetch(`https://fcm.googleapis.com/v1/projects/${projectId}/messages:send`, {
@@ -185,7 +185,7 @@ export async function sendPushToUsers({ title, body, data = {}, predicate, bodyF
const validTokens = [] const validTokens = []
for (const entry of tokens) { for (const entry of tokens) {
try { try {
await sendFcmMessage({ serviceAccount, accessToken, token: entry.token, title, body: userBody, data: payload }) await sendFcmMessage({ serviceAccount, accessToken, token: entry.token, data: payload })
sent += 1 sent += 1
validTokens.push(entry) validTokens.push(entry)
} catch (error) { } catch (error) {