Merge upstream PRs: security deps + chart.js-v4 engine fix#1
Merged
Conversation
Bumps [socket.io-parser](https://github.com/Automattic/socket.io-parser) from 3.3.3 to 3.3.4. - [Release notes](https://github.com/Automattic/socket.io-parser/releases) - [Changelog](https://github.com/socketio/socket.io-parser/blob/3.3.4/CHANGELOG.md) - [Commits](socketio/socket.io-parser@3.3.3...3.3.4) --- updated-dependencies: - dependency-name: socket.io-parser dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [express](https://github.com/expressjs/express) from 4.19.2 to 4.20.0. - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/master/History.md) - [Commits](expressjs/express@4.19.2...4.20.0) --- updated-dependencies: - dependency-name: express dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
This commit integrates a chart template storage and retrieval system, which was previously unavailable due to lack of FOSS implementations. Key additions include: - SQLite database integration for persistent storage of chart templates - New API endpoints for chart template creation and retrieval - Database schema with automatic cleanup of expired templates - Template overrides allowing customization of stored templates via URL parameters - Docker volume support for persistent database storage - Additional documentation for the template feature - Test suite for template creation and retrieval functionality The template system allows users to: 1. Store complex chart configurations as reusable templates 2. Retrieve and render templates with a simple ID 3. Dynamically override template parameters (title, labels, etc.) 4. Set expiration dates for temporary templates This significantly enhances the utility of QuickChart by enabling persistent chart configurations without requiring long URLs for each chart instance.
- Added json-schema ^0.4.0 to both resolutions and overrides in package.json - Modified GitHub Actions workflow to run tests on any branch push
- Added flat ^5.0.1 to both resolutions and overrides - Added crypto-js ^4.2.0 to both resolutions and overrides - Resolves Dependabot alert typpo#11 - Eliminates critical security vulnerabilities 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added resolutions for known high severity vulnerabilities: - cross-spawn ^6.0.6 (ReDoS vulnerability) - axios ^1.8.2 (SSRF and Credential Leakage) - minimatch ^3.0.5 (ReDoS vulnerability) - ws ^7.5.10 (DoS vulnerability) - nth-check ^2.0.1 (ReDoS vulnerability) - body-parser ^1.20.3 (DoS vulnerability) - path-to-regexp ^0.1.12 (ReDoS vulnerability) - Reduced high severity vulnerabilities from 10 to 1 - Remaining high severity vulnerability in lodash.pick has no patch available 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…lities' into fix-security
…s' into fix-security
…n.lock with typpo#209 version)
….3→2.11.2, add moment dep (engine fix)
There was a problem hiding this comment.
Pull request overview
This PR merges upstream dependency/security updates and Chart.js v4/canvas updates, and also introduces a new SQLite-backed chart persistence API (/chart/create + /chart/render) along with new CI workflows and tests.
Changes:
- Update dependencies/lockfile (including Chart.js v4 + canvas) and add
moment/sqlite3. - Add SQLite-backed chart create/render endpoints with template-style query overrides.
- Add/update CI workflows, Dockerfiles, tests, and README documentation for the new endpoints.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
yarn.lock |
Updates transitive dependency graph for security/engine fixes and new deps. |
package.json |
Bumps version, adds deps (moment, sqlite3), and expands overrides/resolutions + test scripts. |
index.js |
Adds SQLite-backed /chart/create + /chart/render endpoints and template override logic. |
lib/db.js |
Introduces SQLite connection and schema initialization for stored charts. |
test/ci/charts.js |
Makes SVG assertion less brittle for updated Chart.js/canvas rendering. |
test/ci/chart-create.test.js |
Adds integration tests for chart create/render + overrides. |
README.md |
Documents new endpoints and docker volume usage. |
Dockerfile |
Installs sqlite, adds DB volume, and adjusts entrypoint. |
Dockerfile.test |
Adds test container image definition (deps + test entrypoint). |
template_feature.patch |
Adds a patch artifact file (not used by build/runtime). |
.github/workflows/test.yml |
Adds CI test + lint workflow (currently skips new chart-create tests). |
.github/workflows/docker-build.yml |
Adds Docker build/publish workflow (has quoting issues). |
.github/workflows/docker-build-dev.yml |
Adds dev Docker build/publish workflow (has quoting issues). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return res.status(400).json({ error: 'Chart config is required' }); | ||
| } | ||
|
|
||
| const id = crypto.randomUUID(); |
Comment on lines
+539
to
+549
| db.get('SELECT config FROM charts WHERE id = ?', [key], function(err, row) { | ||
| if (err) { | ||
| res.status(500).json({ error: err.message }); | ||
| } | ||
|
|
||
| if (!row) { | ||
| return res.status(404).json({ error: 'Template not found' }); | ||
| } | ||
| //return res.status(200).json({status: 'success'}); | ||
| let chartConfig = JSON.parse(row.config); | ||
| chartConfig = applyTemplateOverrides(chartConfig, req.query); |
Comment on lines
+557
to
+559
| logger.error(`Request for unsupported format ${outputFormat}`); | ||
| res.status(500).end(`Unsupported format ${outputFormat}`); | ||
| } |
Comment on lines
+494
to
+505
| function applyTemplateOverrides(chartConfig, params) { | ||
| if (params.title) { | ||
| chartConfig.chart.options = chartConfig.chart.options || {}; | ||
| chartConfig.chart.options.title = chartConfig.chart.options.title || {}; | ||
| chartConfig.chart.options.title.text = params.title; | ||
| chartConfig.chart.options.title.display = true; | ||
| } | ||
|
|
||
| if (params.labels) { | ||
| chartConfig.chart.data.labels = params.labels.split(','); | ||
| } | ||
|
|
Comment on lines
+518
to
+521
| chartConfig.chart.data.datasets[index].backgroundColor = params[paramKey] | ||
| .split(',') | ||
| .map(Number); | ||
| } |
Comment on lines
+54
to
+57
| after(function(done) { | ||
| db.run('DELETE FROM charts WHERE id = ?', [chartId]); | ||
| db.close(done); | ||
| }); |
| EXPOSE 3400 | ||
|
|
||
| ENTRYPOINT ["node", "--max-http-header-size=65536", "index.js"] | ||
| ENTRYPOINT ["node", "--max-http-header-size=65536", "--experimental-global-webcrypto", "index.js"] |
Comment on lines
+3
to
+5
| ENV NODE_ENV test | ||
| ENV NODE_OPTIONS --experimental-global-webcrypto | ||
| WORKDIR /quickchart |
Comment on lines
+47
to
+51
| env: | ||
| NODE_ENV: test | ||
| PORT: 3400 | ||
| NODE_OPTIONS: --experimental-global-webcrypto | ||
|
|
Comment on lines
+459
to
+463
| app.post('/chart/create', (req, res) => { | ||
| const { neverExpire = false } = req.body; | ||
| const outputFormat = (req.body.f || req.body.format || 'png').toLowerCase(); | ||
| const config = { | ||
| chart: req.body.c || req.body.chart, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merged upstream PRs from typpo/quickchart:
Skipped: typpo#205 (short URLs/templates - complex feature), typpo#197 (datalabels v3 - no merge base), typpo#198 (image API), typpo#181/typpo#183 (CI/deployment).