Skip to content

feat: add ForbidHardcodedCredentialsRule to detect hardcoded credentials#30

Open
Martin Bens (SpiGAndromeda) wants to merge 4 commits intomainfrom
feat/forbid-hardcoded-credentials-rule
Open

feat: add ForbidHardcodedCredentialsRule to detect hardcoded credentials#30
Martin Bens (SpiGAndromeda) wants to merge 4 commits intomainfrom
feat/forbid-hardcoded-credentials-rule

Conversation

@SpiGAndromeda
Copy link
Copy Markdown
Collaborator

No description provided.

}

$value = $node->value->value;
if ($value === '' || $value === '0' || str_starts_with($value, '%') || str_contains($value, 'env(')) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($value === '' || $value === '0' || str_starts_with($value, '%') || str_contains($value, 'env(')) {
if ($value === '' || str_starts_with($value, '%') || str_contains($value, 'env(')) {


public function getNodeType(): string
{
return ArrayItem::class;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why array items? shouldn't this check on strings?

}

return [
RuleErrorBuilder::message('Possible hardcoded credentials detected. Use environment variables.')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why hinting to env variables? what is the audience for this error? plugin developers or maintainer of a project in GitHub or so?

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