Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: v8.2.0
_commit: v8.3.0
_src_path: gh:eccenca/cmem-plugin-template
author_mail: cmempy-developer@eccenca.com
author_name: eccenca GmbH
Expand Down
2 changes: 1 addition & 1 deletion .idea/cmem-plugin-reason.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

TODO: add at least one Added, Changed, Deprecated, Removed, Fixed or Security section
### Fixed

- Fix robot.jar vulnerability CVE-2026-1225

### Changed

- Update template to 8.3.0.
- Allow urn URIs in graph parameters.

## [2.2.1] 2025-11-27

Expand Down
2 changes: 1 addition & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ tasks:
Check poetry versioning plugin. Currently not under Windows
run: once
preconditions:
- sh: '[ -d .git ]'
- sh: git -C . rev-parse
msg: >
Your newly created project directory needs to be initialized
as a git repository.
Expand Down
8 changes: 4 additions & 4 deletions cmem_plugin_reason/plugin_reason.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from tempfile import TemporaryDirectory
from uuid import uuid4

import validators.url
from cmem.cmempy.dp.proxy.graph import get, get_graph_import_tree, get_graphs_list
from cmem.cmempy.dp.proxy.update import post
from cmem_plugin_base.dataintegration.context import ExecutionContext, ExecutionReport
Expand All @@ -33,6 +32,7 @@
create_xml_catalog_file,
get_file_with_datetime,
get_output_graph_label,
is_valid_uri,
post_profiles,
post_provenance,
robot,
Expand Down Expand Up @@ -342,11 +342,11 @@ def __init__( # noqa: PLR0913 C901
"ObjectPropertyDomain": object_property_domain,
}
errors = ""
if not validators.url(data_graph_iri):
if not is_valid_uri(data_graph_iri):
errors += 'Invalid IRI for parameter "Data graph IRI". '
if not validators.url(ontology_graph_iri):
if not is_valid_uri(ontology_graph_iri):
errors += 'Invalid IRI for parameter "Ontology graph IRI". '
if not validators.url(output_graph_iri):
if not is_valid_uri(output_graph_iri):
errors += 'Invalid IRI for parameter "Result graph IRI". '
if output_graph_iri == data_graph_iri:
errors += "Result graph IRI cannot be the same as the data graph IRI. "
Expand Down
6 changes: 3 additions & 3 deletions cmem_plugin_reason/plugin_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from tempfile import TemporaryDirectory
from uuid import uuid4

import validators.url
from cmem.cmempy.dp.proxy.graph import get, get_graph_import_tree, get_graphs_list
from cmem.cmempy.workspace.projects.resources.resource import create_resource
from cmem_plugin_base.dataintegration.context import ExecutionContext, ExecutionReport
Expand All @@ -33,6 +32,7 @@
create_xml_catalog_file,
get_file_with_datetime,
get_output_graph_label,
is_valid_uri,
post_profiles,
post_provenance,
robot,
Expand Down Expand Up @@ -130,9 +130,9 @@ def __init__( # noqa: PLR0912 PLR0913 C901
max_ram_percentage: int = MAX_RAM_PERCENTAGE_DEFAULT,
) -> None:
errors = ""
if not validators.url(ontology_graph_iri):
if not is_valid_uri(ontology_graph_iri):
errors += 'Invalid IRI for parameter "Ontology graph IRI." '
if output_graph_iri and not validators.url(output_graph_iri):
if output_graph_iri and not is_valid_uri(output_graph_iri):
errors += 'Invalid IRI for parameter "Output graph IRI". '
if output_graph_iri and output_graph_iri == ontology_graph_iri:
errors += "Output graph IRI cannot be the same as the Ontology graph IRI. "
Expand Down
Binary file modified cmem_plugin_reason/robot.jar
Binary file not shown.
10 changes: 10 additions & 0 deletions cmem_plugin_reason/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
from datetime import UTC, datetime
from io import BytesIO
from pathlib import Path
from re import IGNORECASE, match
from secrets import token_hex
from subprocess import CompletedProcess, run
from time import time
from xml.etree.ElementTree import Element, SubElement, tostring

import validators.url
from cmem.cmempy.dp.proxy.graph import get_graphs_list, post_streamed
from cmem.cmempy.dp.proxy.sparql import post as post_select
from cmem.cmempy.dp.proxy.update import post as post_update
Expand Down Expand Up @@ -265,3 +267,11 @@ def cancel_workflow(plugin: WorkflowPlugin) -> bool:
plugin.context.report.update(ExecutionReport(entity_count=0, operation_desc="(cancelled)"))
return True
return False


def is_valid_uri(uri: str | None) -> bool:
"""Validate URI"""
if not isinstance(uri, str):
return False
urn_pattern = r"^urn:[a-zA-Z0-9][a-zA-Z0-9-]{1,31}:.+$"
return validators.url(uri) is True or bool(match(urn_pattern, uri, IGNORECASE))
Loading