Address semgrep 0.86.x breakage (#14771)

* Fix semgrep 0.86.5 parsing failures
 - semgrep https://github.com/returntocorp/semgrep/pull/4671 seems to have
   introduce this parsing failure within version 0.86.0 and higher
 - Workaround parsing failure by breaking out the if error check.

* Pin semgrep version to 0.86.5

* Fix formatting issues
This commit is contained in:
Steven Clark 2022-03-30 15:03:21 -04:00 committed by GitHub
parent 3a75683aa5
commit f31dee885b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

2
.circleci/config.yml generated
View File

@ -807,7 +807,7 @@ jobs:
- run:
command: |
apk add --no-cache python3 py3-pip make
python3 -m pip install --user semgrep
python3 -m pip install --user semgrep==0.86.5
export PATH="$HOME/.local/bin:$PATH"
echo "$ semgrep --version"

View File

@ -7,7 +7,7 @@ steps:
name: Setup Semgrep
command: |
apk add --no-cache python3 py3-pip make
python3 -m pip install --user semgrep
python3 -m pip install --user semgrep==0.86.5
export PATH="$HOME/.local/bin:$PATH"
echo "$ semgrep --version"

View File

@ -127,7 +127,7 @@ func (b *backend) pathCredsRead(ctx context.Context, req *logical.Request, d *fr
// If the role had vhost permissions specified, assign those permissions
// to the created username for respective vhosts.
for vhost, permission := range role.VHosts {
if err := func() error {
err := func() error {
resp, err := client.UpdatePermissionsIn(vhost, username, rabbithole.Permissions{
Configure: permission.Configure,
Write: permission.Write,
@ -146,7 +146,8 @@ func (b *backend) pathCredsRead(ctx context.Context, req *logical.Request, d *fr
return fmt.Errorf("error updating vhost permissions for %s - %d: %s", vhost, resp.StatusCode, body)
}
return nil
}(); err != nil {
}()
if err != nil {
return nil, err
}
}
@ -155,7 +156,7 @@ func (b *backend) pathCredsRead(ctx context.Context, req *logical.Request, d *fr
// to the created username for respective vhosts and exchange.
for vhost, permissions := range role.VHostTopics {
for exchange, permission := range permissions {
if err := func() error {
err := func() error {
resp, err := client.UpdateTopicPermissionsIn(vhost, username, rabbithole.TopicPermissions{
Exchange: exchange,
Write: permission.Write,
@ -174,7 +175,8 @@ func (b *backend) pathCredsRead(ctx context.Context, req *logical.Request, d *fr
return fmt.Errorf("error updating vhost permissions for %s - %d: %s", vhost, resp.StatusCode, body)
}
return nil
}(); err != nil {
}()
if err != nil {
return nil, err
}
}