fix(security): address Snyk Code SAST findings (path traversal, secrets, command injection, info exposure) - #41
Open
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- app.py: reject static paths escaping static_folder (safe_join) - views/api.py: return JSON with proper content type via json_success - callApi.ts: use printf-style console.error instead of interpolated format string - map-box stories: read Mapbox token from STORYBOOK_MAPBOX_API_KEY - generate-database-docs.mjs: random/ env-provided SUPERSET_SECRET_KEY - manage-versions.mjs: execFileSync + section/version validation - webpack.proxy-config.js: don't leak stack traces to client Co-Authored-By: shayan <shayan@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
9 tasks
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.
SUMMARY
Minimal root-cause fixes for Snyk Code findings (companion to #40, which covers dependency findings). No behavior changes for valid inputs.
Fixed
superset/app.py:119,126—SupersetApp.send_static_filerejects filenames thatwerkzeug.security.safe_join(static_folder, filename)cannot resolve inside the static folder (raise NotFound()) before delegating to Flask.superset/views/api.py:76—Api.queryreturned a rawjson.dumpsstring (served astext/html); wrapped withjson_success(...)so the response isapplication/json.callApi.ts:158—console.erroruses a constant%sformat string withkey/urlas arguments instead of interpolating them into the format string.docs/scripts/generate-database-docs.mjs:71—SUPERSET_SECRET_KEYis taken from the environment or generated viacrypto.randomBytes(32)for the throwaway docs-build app instead of the literal'docs-build-key'.legacy-plugin-chart-map-box/src/stories/data.ts:5529— Mapbox token read fromprocess.env.STORYBOOK_MAPBOX_API_KEY(defaults to''; the story still renders, tiles just don't load without a token).docs/scripts/manage-versions.mjs:100,126,202—execSync(shell string)→execFileSync('yarn', [...args]);sectionmust be one ofdocs|developer_portal|componentsandversionmust match^\d+\.\d+(\.\d+)?$before being used as an object key / path segment / CLI arg.webpack.proxy-config.js:211— stack trace is logged server-side; client receives onlye.message.Assessed as false positives (no code change)
docs/docusaurus.config.ts:806— Algolia DocSearchapiKeyis the public, search-only key that must be shipped to browsers by design.superset-websocket/src/config.ts:66— flagged line isjwtCookieName: 'async-token', a cookie name, not a secret (jwtSecretdefaults to''and is supplied via config/env).cypress-base/cypress/support/e2e.ts:184(admin/general) — test-fixture credentials for the Cypress test instance.superset/db_engine_specs/*.py— these areparameters_json_schemadoc placeholders / example strings for the connection form, not credentials.ReDoS
callApi.ts:103,117— no regular expression exists at these lines (Cache.match(url)); Snyk's taint path is the URL string flowing into the Cache API. Treated as a false positive; the format-string finding in the same file was fixed.Snyk IDs addressed: Snyk Code findings have no SNYK-* IDs; the affected file:line locations are listed above.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
ruff check superset/app.py superset/views/api.pyandruff format --checkpass;mypyreports no new errors on changed lines (674 pre-existing errors identical before/after).cd superset-frontend && npx prettier --check+oxlinton changed files pass;jest packages/superset-ui-core/test/connection— 6 suites / 89 tests pass.node docs/scripts/manage-versions.mjs add 'docs; echo pwned' 1.0.0→Unknown section;... add docs '1.0.0;touch x'→Invalid version.pre-commit runon staged files passes (only pre-existingTS6305"lib not built" errors from the frontend type-check hook, unrelated to this change).GET /static/../../etc/passwd-style paths (URL-encoded) on a running Superset return 404.ADDITIONAL INFORMATION
Link to Devin session: https://app.devin.ai/sessions/d59c5fde422d413ebdccece790177516
Open in Devin Desktop: https://app.devin.ai/desktop/session/d59c5fde422d413ebdccece790177516?variant=devin