Canvas Map adds Google Maps and OpenStreetMap components to Drupal Canvas. Each provider is a submodule with its own component, and editors place maps in Canvas page layouts. The Google API key comes from a Key module entity.

Differences with similar projects

  • Geofield, Geofield Map and Leaflet store locations as field data on entities, with map widgets, formatters and Views displays, used when a site manages structured geographic data.
  • Map provider is for developers: a plugin type for map tile sources defined in YAML, and a map render element that draws a Leaflet map from PHP.

Canvas Map stores no geographic data and adds no field, widget, Views display or JavaScript map API. Each provider is a placeable Canvas component that renders the map service's own embed in an iframe, and editors add a single map to a page without writing code.

Project link

https://www.drupal.org/project/canvas_map

Manual reviews of other projects

AI-Generated: Yes, module is being written with AI coding agents. We direct the work and review every commit.

Comments

davituri created an issue. See original summary.

davituri’s picture

Issue summary: View changes
nickolaj’s picture

Hi,

I reviewed the 1.0.x branch of Canvas Map.

git clone --branch 1.0.x https://git.drupalcode.org/project/canvas_map.git

Manual read of the iframe path, Key handling, CSP subscribers, templates, and .gitattributes. I saw the note that the module is written with AI coding agents. I treated the iframe src and the API key as the places that had to be right.

Both providers hard-code an https:// endpoint (GoogleMapsEmbed::ENDPOINT, OsmEmbed::ENDPOINT) and append UrlHelper::buildQuery(). Location, zoom, map type, and region are gated before they go into the query. The Google key comes from a Key entity, not from exportable config. administer canvas map has restrict access: true.

templates/canvas-map-iframe.html.twig prints src and title through Twig autoescape and skips the iframe entirely when src is empty, so src="" cannot load the current page. I did not find |raw on those values.

.ddev/ is in the git tree but listed as export-ignore in .gitattributes, with a comment that Drupal.org tarballs use git archive. That is the right way to keep a local toolchain out of the packaged module.

README and docs/privacy.md state that the visitor's browser talks to Google or OpenStreetMap on page load, and that the Embed API key is visible in the iframe URL. That matches the code.

Branch 1.0.x, Drupal ^11.3, enough PHP, no vendor JS committed. I have no blocking findings.

One optional note, not a request to change status: the Google q parameter is the editor-supplied location, passed through unparsed (as the Embed API wants). That is fine for Canvas editors. It is worth keeping the "editors can place maps" permission model in mind if Canvas ever exposes these components to less trusted roles.

avpaderno’s picture

Issue tags: -PAreview: review bonus
avpaderno’s picture

Assigned: Unassigned » avpaderno

Thank you for applying!

Before giving links helpful to understand how the review process works, what to expect from a review, and what to do to avoid a review takes more time than needed, I would like to thank all the reviewers for the work they do.
These applications are volunters-driven, which also means it is not possible to predict when an application will be marked fixed and the applicant will get the permission to opt projects into security advisory policy. While we aim to make an application as quick as possible, it is also important for us that more people review the project used for an application. In this way, we make sure applications do not miss some important points that should be instead reported.
Applications are not meant to be complete debugging sessions that eliminate every existing bug, though. I apologize if sometimes applications seem to go into too-detailed reviews.

Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.

The important notes are the following.

  • If you have not done it yet, you should enable GitLab CI for the project and fix the PHP_CodeSniffer errors/warnings it reports.
  • For the time this application is open, only your commits are allowed.
  • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status will not be changed by this application; once this application is closed, you will be able to change the project status from Not covered to Opt into security advisory coverage. This is possible only 14 days after the project is created.

    Keep in mind that once the project is opted into security advisory coverage, only Security Team members may change coverage.
  • Only the person who created the application will get the permission to opt projects into security advisory coverage. No other person will get the same permission from the same application; that applies also to co-maintainers/maintainers of the project used for the application.
  • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

To the reviewers

Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.

The important notes are the following.

  • It is preferable to wait for a project moderator before posting the first comment on newly created applications. Project moderators will do some preliminary checks that are necessary before any change on the project files is suggested.
  • Reviewers should show the output of a CLI tool only once per application.
  • It may be best to have the applicant fix things before further review.

For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.

avpaderno’s picture

Assigned: avpaderno » Unassigned
Status: Needs review » Needs work
  • The following points are just a start and don't necessarily encompass all of the changes that may be necessary
  • A specific point may just be an example and may apply in other places
  • A review is about code that does not follow the coding standards, contains possible security issue, or does not correctly use the Drupal API
  • The single review points are not ordered, not even by importance

src/Form/CanvasMapSettingsForm.php

The class seems to be for plugin settings. In fact, it even has MapProviderPluginManager as dependency. ConfigFormBase is not the right base class to use in that case.

davituri’s picture

Thank you both for the reviews.

src/Form/CanvasMapSettingsForm.php

The form edits one simple configuration object, canvas_map.settings, declared as a config_object in the module's schema so that is why it extends ConfigFormBase. The providers do not own that configuration, each plugin contributes the elements of its own section through PluginFormInterface and the form stores the submitted values under the providers key, by plugin id.

Core has the same shape in \Drupal\system\Form\ImageToolkitForm: it extends ConfigFormBase, takes ImageToolkitManager in its constructor and calls buildConfigurationForm(), validateConfigurationForm() and submitConfigurationForm() on each toolkit. \Drupal\language\Form\NegotiationConfigureForm also extends ConfigFormBase with a plugin manager injected. The change record for #config_target says the new mechanism is optional and existing simple configuration forms continue to work as they are. This form cannot use it, because the elements come from the plugins.

@avpaderno I could not find documentation that names a different base class for a settings form that hosts plugin forms. If you have one in mind, please point me to it and I will change the class.

vishal.kadam’s picture

Remember to change status, when the project is ready to be reviewed. In this queue, projects are only reviewed when the status is Needs review.

avpaderno’s picture

Usually, plugins that use configuration implement at least a couple of interfaces, one for the configuration and one for the exposed form. That should have been done for image toolkits too. Probably, at the time image toolkits were converted to plugins, there was no interface for plugins with configuration.

avpaderno’s picture

@vishal.kadam I take the status was not changed because a reply was expected from me.

avpaderno’s picture

davituri’s picture

Status: Needs work » Needs review

@avpaderno Thanks, it's clear now. Done in this commit on 1.0.x:

  • MapProviderSettingsInterface extends PluginFormInterface and ConfigurableInterface.
  • EmbedIframeProviderBase extends ConfigurablePluginBase, so providers get getConfiguration() and others from core.
  • GoogleMapsEmbed declares defaultConfiguration() and writes the submitted values to its configuration in submitConfigurationForm().
  • CanvasMapSettingsForm now stores each plugin's getConfiguration() instead of the form values. A new kernel test covers that.

The form itself still extends ConfigFormBase: it edits the simple configuration object canvas_map.settings, and now stores each plugin's configuration there, as ImageToolkitForm stores the chosen toolkit in system.image. Please let me know if you see it differently.