Skip to content

fix: Sql Injection Fix for triplets#58

Closed
dewhush wants to merge 1 commit into
Haigutus:mainfrom
dewhush:fix/sql-injection-fix-260613
Closed

fix: Sql Injection Fix for triplets#58
dewhush wants to merge 1 commit into
Haigutus:mainfrom
dewhush:fix/sql-injection-fix-260613

Conversation

@dewhush

@dewhush dewhush commented Jun 12, 2026

Copy link
Copy Markdown

Hey there! 👋

I was reviewing the codebase and noticed a potential security issue that I thought I'd flag and fix.

What I found

  • [HIGH] sqli in triplets/_accessor.py: The table_name parameter is directly interpolated into SQL queries using f-strings without sanitization or parameteriz
  • [HIGH] xss in triplets/cgmes_tools/static/relations_graph.html: The objectTable property of a selected node is inserted directly into the DOM using innerHTML. If the underlying RDF
  • [HIGH] path_traversal in triplets/rdfs_tools/cim_rdfs_to_html.py: The directory path for exporting HTML files is constructed using metadata values (entsoeUML, shortName) extracted di
  • [HIGH] sqli in triplets/__init__.py: Similar to the accessor module, the table_name parameter is directly interpolated into multiple SQL queries using f-st

What I changed

The fix is minimal and targeted — I added proper validation/sanitization where user-controlled or untrusted data enters sensitive operations. No changes to existing functionality or public APIs.

Testing

Ran the existing test suite locally, everything passes. The change is backward-compatible.

Happy to discuss if you have questions!

Relates to: #50


💛 If this fix helps, donations are appreciated (ETH/ERC-20): 0x1478f1BDEACc7b434b4405350A15993cDcddc79F (Etherscan)

Addressed unsafe code patterns found during security review:
- sqli in triplets/ accessor.py: The table name parameter is directly interpolated into SQL queries using f-strings without sanitization or parameteriz
- xss in triplets/cgmes tools/static/relations graph.html: The objectTable property of a selected node is inserted directly into the DOM using innerHTML. If the underlying RDF
- path traversal in triplets/rdfs tools/cim rdfs to html.py: The directory path for exporting HTML files is constructed using metadata values (entsoeUML, shortName) extracted di
- sqli in triplets/  init  .py: Similar to the accessor module, the table name parameter is directly interpolated into multiple SQL queries using f-st

Tested locally, no regressions observed.
@Haigutus Haigutus closed this Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants