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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apprise configuration files to support 'include' keyword #226

Closed
caronc opened this issue Apr 4, 2020 · 1 comment
Closed

Apprise configuration files to support 'include' keyword #226

caronc opened this issue Apr 4, 2020 · 1 comment
Labels
enhancement public_collaboration Share your thoughts! Is this a good idea? What would you do differently?

Comments

@caronc
Copy link
Owner

caronc commented Apr 4, 2020

馃挕 The Idea
I was just thinking that it might be useful to support the keyword include in both the YAML and TEXT Apprise configuration files. For text files it would look like:

include http://localhost/path/to/more/configuration/entries
# No limit to the number of includes you specify
include file:///path/to/another/configuration/file/on/your/system

YAML configuration files would be similar, it would just be it's own section:

include:
   - http://localhost/path/to/more/configuration/entries
   - file:///path/to/another/configuration/file/on/your/system

The idea here is people who use the default (always iincluded configuration files that the CLI offers), they can use this entry as a way to have the CLI automatically fetch from a remote server.

Things to consider:

  • A file could include a file/website to which it also has an include statement.
    • recursion of how many includes take place should be controlled (default it to 1 recursive request) but allow users to increase this if they wish.
    • consider that an include could effectively include itself (solved by controlling recursion above).
  • By default people who aren't using the apprise CLI would not have to worry as the include feature would be ignored by default unless they explicitly turned it on.
  • Those who want to turn the feature on, would just need to include a keyword argument with the AppriseConfig() object to do so. I was thinking of making a variable called recursion which by default is set to 0 (or None). Setting this to a positive integer however would define how many times an include could be called from within a configuration already included. e.g.:
    import apprise
    
    # Allow up to 3 levels of recursion (over-riding default value of zero)
    config = apprise.AppriseConfig(recursion=3)
    
    # Now load our configuration
    config.add('/path/to/file/that/includes/config/entries/and/or/include/entries/too.txt')
  • include would respect cache and re-retrieve content if required to do so

馃敀 Security

  • Relative paths specified in file:// based configurations will include relative to the configuration file it was read from.
  • It will not be possible to include file:// based configuration if the request to do so came from a non-file:// based one (such as http://). Only a file:// based configuration can include another file:// based one.
  • memory:// based configurations can't include file:// based either on it's own. However developers can set insecure_includes=True when calling Apprise.add_config() to over-ride this.

馃敤 Breaking Feature
Nothing would break per say but this introduces some security issues that i think having the include feature disabled by default will solve.

@caronc caronc added enhancement public_collaboration Share your thoughts! Is this a good idea? What would you do differently? labels Apr 4, 2020
@caronc caronc changed the title Apprise configuration files to support 'import' keyword Apprise configuration files to support 'include' keyword Aug 25, 2020
@caronc
Copy link
Owner Author

caronc commented Aug 26, 2020

code is now merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement public_collaboration Share your thoughts! Is this a good idea? What would you do differently?
Projects
None yet
Development

No branches or pull requests

1 participant