question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

context.config() does not take event context into account

See original GitHub issue

In followup from #264 (I cannot reopen that issue, and the issue was auto-closed without having a solution/fix.

Bug Report

This problem makes it impossible to change the configuration of a probot bot IN the pull request where the probot is active/receives events. Only configuration in the repo’s master branch is taken into account.

Problematic code: https://github.com/probot/probot/blob/master/src/context.ts#L230

Assume the files

# .github/my-config.yaml
# branch: master (the default branch)
property: 1
# .github/my-config.yaml
# branch: my-feature
property: 2

Current Behavior

  • I open a pull request

  • I have my probot bot listen to pull request events

  • I create a pull request to merge my-feature into master

  • When the bot receives a pull request event:

    context.config('my-config.yaml').property == 1
    

Expected behavior/code

  • I open a pull request

  • I have my probot bot listen to pull request events

  • I create a pull request to merge my-feature into master

  • When the bot receives a pull request event:

    context.config('my-config.yaml').property == 2
    

Possible Solution

Take the branch information that is stored in the context into account. For pull requests, that means the changes of the pull request branch.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gr2mcommented, Apr 20, 2020

Isn’t the same true for having CI config in the repo, where the branch is also used when the CI configuration is read? How are those security issues mitigated in such cases?

The CIs take care of that.

Feel free to close this issue if this is not a priority feature

We can leave it open for a while to see if anyone else has a similar need

Maybe some documentation would be useful for explaining this behaviour and the security risks

Always! PRs welcome 😃

0reactions
github-actions[bot]commented, May 28, 2020

🎉 This issue has been resolved in version 9.11.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS Lambda context object in Python
When Lambda runs your function, it passes a context object to the handler . This object provides methods and properties that provide information...
Read more >
Introduce config context to make original config and different ...
The event is 'config.context'. - Config event listeners are notified now when we install a new configuration (which I think was a missing ......
Read more >
How To Use Contexts in Go - DigitalOcean
Context parameter as the first parameter in a function, and you'll see it there in the Go standard library. But that doesn't apply...
Read more >
User and context configuration - SDKs / - LaunchDarkly docs
This topic explains how to configure user and context objects in LaunchDarkly SDKs. These features are available for both client-side and ...
Read more >
Add Context for JavaScript | Sentry Documentation
Custom contexts allow you to attach arbitrary data to an event. ... Sentry does not recommend sending the entire application state and large...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found