SanitizeString: Allow hypen char #6713

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:MarcoFalke-2015-allowMoreChars changing 2 files +4 −4
  1. MarcoFalke commented at 10:09 AM on September 23, 2015: member

    Maybe someone wants to put their-domain.org in the UA?

    Ref: #4983.

  2. SanitizeString: Allow hypen char 43edd515e5
  3. laanwj commented at 10:31 AM on September 23, 2015: member

    Maybe we could reverse the approach, and allow everything allowed by the BIP14. Otherwise we can keep creating 'also allow XX' pulls (yes, I'm guilty of this one) .

    I think the conceptual issue is that SanitizeString is used for two purposes:

    • to avoid formatting strings that are dangerous to pass to the shell, terminal or debug log, and
    • to filter characters for user agent

    Splitting of these two use-cases with a parameter was a great idea. Now we can make SanitizeString(SAFE_CHARS_UA_COMMENT) pass through all characters allowed per BIP14.

    Unfortunately that BIP isn't clear on that. It says that / : ( and ) are reserved, but it doesn't make any statement about e.g. which character set is used, or even about control characters...

  4. laanwj added the label Feature on Sep 23, 2015
  5. MarcoFalke commented at 10:55 AM on September 23, 2015: member

    Assuming ASCII and forgetting about all non printable ASCII chars, leaves us with 33 chars (alphanum is fine) to make a decision about.

    .,;_/:?@() is already in, so what is left:

     !"#$%&'*+-<=>[]\^`{|}~
    

    IIrc, UAs get dumped to debug.log as well, so is it save to allow any char?

  6. jgarzik commented at 12:18 PM on September 23, 2015: contributor

    ut ACK

  7. laanwj commented at 2:48 PM on September 23, 2015: member

    IIrc, UAs get dumped to debug.log as well, so is it save to allow any char?

    Yes, but only processed through SanitizeString(SAFE_CHARS_DEFAULT) - in principle, just the fact that we don't log some characters doesn't mean that they shouldn't be allowed in uacomments.

  8. laanwj commented at 9:57 PM on September 29, 2015: member

    Meh, I don't think it's worth it to take this to BIP level - although the BIP should have mentioned valid/invalid characters! Good to check for in next proposal if anything relating strings. utACK

  9. laanwj merged this on Sep 29, 2015
  10. laanwj closed this on Sep 29, 2015

  11. laanwj referenced this in commit f6ce59cd3c on Sep 29, 2015
  12. MarcoFalke deleted the branch on Oct 8, 2015
  13. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me