T09 · Insecure Skill Coding Practices
- Location
scripts/generate_qt_code.js:430- Finding
Unvalidated Mapping Data Enables Path Traversal and Generated-Code Injection
- Content
View full analysis
namespace Ui { class ${className}; } class ${className} : public QWidget { Q_OBJECT public: explicit ${className}(QWidget *parent = nullptr); ~${className}(); private slots: ${form.events.map(event => `void ${event.handler}();`).join('\n ')} private: Ui::${className} *ui; // Control member variables ${form.controls.map(control => `QWidget *${control.name}; // WinForms type: ${control.type}`).join('\n ')} }; #endif // ${className.toUpperCase()}_H `; const headerPath = path.join(options.output, `include/${lowerName}.h`); fs.writeFileSync(headerPath, headerContent); } ``` The same unvalidated value is used to construct source-file paths and C++ source code: ```js function generateFormSource(form) { const className = form.name; const lowerName = className.toLowerCase(); const sourceContent = `#include "${lowerName}.h" #include "ui_${lowerName}.h" #include #include ${className}::${className}(QWidget *parent) : QWidget(parent) , ui(new Ui::${className}) { ui->setupUi(this); setupUi(); setupConnections(); } void ${className}::setupConnections() { ${form.events.map(event => ` // ${event.control}.${event.event} -> ${event.handler} connect(${event.control}, &${getQtSignalForEvent(event.event)}, this, &${className}::${ev ...[truncated 3896 chars]- Remediation
View remediation
