【问题标题】:security in yaml fileyaml 文件中的安全性
【发布时间】:2014-10-01 06:35:12
【问题描述】:

您好,我遵循this 教程并加载我的自定义配置文件。我仍然想在其中使用一些哈希(所以密码或一些敏感数据不是白色文本)我知道 Symfony 2 中内置了一些编码器,但我如何在我的自定义 yaml 文件中使用它或创建我自己的哈希并撤消哈希函数?或者加载 yaml 后在我的控制器内部

    test
       loginTest:test 
       passTest:test{# how can i hash this ?#}

encoders here ????

【问题讨论】:

    标签: php symfony yaml


    【解决方案1】:

    不要将密码直接放在 YAML 文件中,而是将它们与其他敏感数据一起存储在 parameters.yml 中,并使用 % 符号在您的 yaml 文件中访问它们。

    // app/config/parameters.yml
    parameters:
        myPass: my_secret_pass
    
    
    // app/config/config.yml
    test
       loginTest:test 
       passTest:  {% myPass %}
    

    通过这种方式,您可以为每个环境设置不同的密码,并且您不会共享它们

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-19
      • 2011-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-22
      • 2020-07-14
      相关资源
      最近更新 更多