Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed some RFI and dynamic parameter warnings from PHPCS #222

Closed
wants to merge 1 commit into from

Conversation

davearch
Copy link

@davearch davearch commented Jun 7, 2020

Description

The changes I made removed most but not all PHPCS warnings. The only warnings that were left over were 'possible RFI detected' by the use of drupal_get_path() in the az_barrio.theme file and the theme-settings file and 'filesystem function with dynamic parameter' on the use of file_get_contents() in the QuickstartConfigInstaller.php file. However I would argue that in keeping with the spirit of the security measures that PHPCS is helping us mitigate, these warnings should be acceptable. For one, the code sniffer tool is by its own admission a generator of 'false positives'. Please refer to their README as well as this interesting issue conversation. Secondly, seeing as how a Remote File Inclusion attack relies on user input I would think that the simple drupal_get_path() . '/includes/common.php'; would not be at a high risk. And with file_get_contents(), I simply could not figure out a way around it but to be fair it also relies on basically static input. The Drupal codebase itself is littered with this function also.

Related Issue

#174

How Has This Been Tested?

I ran lando phpcs and lando phpunit.

Types of changes

  • [x ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I've added this Pull Request to the AZ Quickstart project in the right column. (not sure what this means)
  • [x ] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • [x ] I have read the CONTRIBUTING document.
  • I have added tests to cover my changes. (I could write tests but I am not sure where to put them)
  • All new and existing tests passed.

@davearch davearch requested a review from a team as a code owner June 7, 2020 06:03
@davearch
Copy link
Author

davearch commented Jun 7, 2020

I've clearly done something wrong but I am not able to see the details of the CI checks.

@joeparsons
Copy link
Member

@davearch Thanks for working on this. We have the main CI tool we use (ProboCI) configured to work with dev branches on the main az-digital/az_quickstart repo but not forks (there are some hard-coded references to the main repo in the .probo.yaml file).

FWIW, it actually looks like ProboCI got farther along with building your PR than I would have expected so maybe we could look into to tweaking our .probo.yaml config file to better support PRs from forks.

@tadean
Copy link
Contributor

tadean commented Jun 8, 2020

I've clearly done something wrong but I am not able to see the details of the CI checks.

@davearch I don't see any immediate issues - I think the issue with CI checks might be because our CI script may make some incorrect assumptions about where the branch lives (I think it currently expects that the branch lives in the az_quickstart repo). We may need to make a few tweaks to allow for it to operate correctly with a fork. I'll check this out today.

@tadean
Copy link
Contributor

tadean commented Jun 8, 2020

To get around the update delay on packagist, we'd put in a fix a while back where the repository itself is set up as a direct vcs repository rather than using packagist. I think we might potentially be able to leverage this to support forks, if probo has access to the forked location.

@joeparsons
Copy link
Member

joeparsons commented Jun 8, 2020

@tadean It'd be cool if we could get that working but I'm afraid the info/variables provided by ProboCI might not give us all the context needed (at least not enough to make it very easy):
https://docs.probo.ci/build/environment-variables/

@tadean
Copy link
Contributor

tadean commented Jun 8, 2020

That's true ☹️ It looks like it might be missing some of the needed information. I'm wondering if maybe there isn't really any reason why the VCS repo needs to be one that's web-hosted...potentially we could set it up so that it treats the local copy of the repo inside the probo build as the package repository so we can disregard what account it's actually hosted on.

@joeparsons
Copy link
Member

Honestly I'm surprised ProboCI worked at all with this PR based on the experience we had early on when we first started using ProboCI. We explored the idea of supporting PRs from forks and ran into some pretty big issues mainly having to do with our ProboCI subscription being tied to the main repo and ProboCI refusing to even do anything on repos without an associated subscription. It's possible that either ProboCI has changed the way things work somewhat since then or that the ProboCI integration with GitHub works different than the integration with BitBucket so I'd definitely be open to exploring this fork PR workflow again.

@joeparsons
Copy link
Member

@jwmoore1 Suggested that it may be possible to use special code comments to basically whitelist certain lines in our code for certain PHPCS security checks. We discussed this in a meeting last week and agreed that we'd prefer to pursue that route instead of changing many of the affected lines of code.

@davearch
Copy link
Author

Hey @joeparsons thanks for the update! @jwmoore1 is the man! Let me know if there is anything else I can do to support.

@joeparsons
Copy link
Member

We decided to merge #239 instead.

@joeparsons joeparsons closed this Jul 8, 2020
joeparsons pushed a commit that referenced this pull request Mar 31, 2021
kevcooper pushed a commit that referenced this pull request Apr 3, 2021
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.

3 participants