Skip to content
Open

, #1

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
373 changes: 0 additions & 373 deletions .github/workflows/ci.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/lint-fixer.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/lock.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Scan
on:
pull_request:
types: [opened, reopened]

jobs:
Scan:
name: "Scan"
runs-on: ubuntu-latest
if: github.event.pull_request.user.login != 'zeropath-ai-dev[bot]'
permissions:
pull-requests: write
security-events: write
statuses: write
contents: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: adventure8812/test-github-actions@main
with:
zeropath-token: ${{ secrets.ZEROPATH_API_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
pull-url: ${{ github.event.pull_request.html_url }}
- name: Run the action
uses: guibranco/github-status-action-v2@v1.1.8
if: success()
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'ZeroPath'
description: 'scan completed.'
state: 'success'
26 changes: 0 additions & 26 deletions .github/workflows/rebase.yml

This file was deleted.

96 changes: 0 additions & 96 deletions .github/workflows/release.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/stale.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/update-challenges-www.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/update-news-www.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/zap_scan.yml

This file was deleted.

15 changes: 13 additions & 2 deletions data/static/codefixes/dbSchemaChallenge_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@ module.exports = function searchProducts () {
return (req: Request, res: Response, next: NextFunction) => {
let criteria: any = req.query.q === 'undefined' ? '' : req.query.q ?? ''
criteria = (criteria.length <= 200) ? criteria : criteria.substring(0, 200)
models.sequelize.query("SELECT * FROM Products WHERE ((name LIKE '%"+criteria+"%' OR description LIKE '%"+criteria+"%') AND deletedAt IS NULL) ORDER BY name")
// Fix: Use parameterized query to prevent SQL injection
// The previous version concatenated user input directly into the SQL query,
// which could allow malicious users to inject arbitrary SQL commands.
// This new version uses a parameterized query with the :criteria placeholder,
// ensuring that user input is properly escaped and treated as data, not code.
models.sequelize.query(
"SELECT * FROM Products WHERE ((name LIKE :criteria OR description LIKE :criteria) AND deletedAt IS NULL) ORDER BY name",
{
replacements: { criteria: `%${criteria}%` },
type: models.sequelize.QueryTypes.SELECT
}
)
.then(([products]: any) => {
const dataString = JSON.stringify(products)
for (let i = 0; i < products.length; i++) {
Expand All @@ -14,4 +25,4 @@ module.exports = function searchProducts () {
next(error.parent)
})
}
}
}