docs icon indicating copy to clipboard operation
docs copied to clipboard

Use a random delimiter in examples

Open martinthomson opened this issue 2 years ago • 5 comments

It was a bit jarring seeing a strong warning about choosing random delimiters, then an example immediately afterwards that didn't follow that advice. This fixes that.

I'm not 100% confident with base64 here. The inclusion of "/" and "+" characters should be fine, but sometimes they are treated specially in ways that might not produce good results.

Also, my powershell isn't that strong, but this seems to do the trick (with slightly lower entropy as I don't include "+" and "/").

FWIW, 120 bits of randomness (or close to that) should be plenty. Using a multiple of three bytes ensures that base64 doesn't add any awkward "=" characters. I'd use hex, but then I'm less confident in the availability of xxd.

Why:

Closes [issue link]

What's being changed (if available, include any code snippets, screenshots, or gifs):

Check off the following:

  • [x] I have reviewed my changes in staging (look for the "Automatically generated comment" and click the links in the "Preview" column to view your latest changes).
  • [x] For content changes, I have completed the self-review checklist.

martinthomson avatar Dec 05 '22 05:12 martinthomson

Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

welcome[bot] avatar Dec 05 '22 05:12 welcome[bot]

Automatically generated comment ℹ️

This comment is automatically generated and will be overwritten every time changes are committed to this branch.

The table contains an overview of files in the content directory that have been changed in this pull request. It's provided to make it easy to review your changes on the staging site. Please note that changes to the data directory will not show up in this table.


Content directory changes

You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.

Source Preview Production What Changed
actions/using-workflows/workflow-commands-for-github-actions.md fpt
ghec
ghes@ 3.8 3.7 3.6 3.5 3.4
ghae
fpt
ghec
ghes@ 3.8 3.7 3.6 3.5 3.4
ghae

fpt: Free, Pro, Team ghec: GitHub Enterprise Cloud ghes: GitHub Enterprise Server ghae: GitHub AE

github-actions[bot] avatar Dec 05 '22 05:12 github-actions[bot]

@martinthomson Thanks so much for opening a PR! I'll get this triaged for review :zap:

cmwilson21 avatar Dec 05 '22 15:12 cmwilson21

Thanks for opening a pull request! We've triaged this issue for technical review by a subject matter expert :eyes:

github-actions[bot] avatar Dec 06 '22 06:12 github-actions[bot]

This is a gentle bump for the docs team that this PR is waiting for technical review.

github-actions[bot] avatar Jan 03 '23 16:01 github-actions[bot]

This is a gentle bump for the docs team that this PR is waiting for technical review.

github-actions[bot] avatar Feb 01 '23 16:02 github-actions[bot]

Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours. If you're looking for your next contribution, check out our help wanted issues :zap:

github-actions[bot] avatar Feb 22 '23 04:02 github-actions[bot]

A random delimiter doesn't really make sense. This will just make your workflow randomly fail if you're unlucky.

The warning should be fixed instead. It feels like a copy&paste of the earlier warning on this page. Neither random nor unique per run makes sense here. What's important is that the delimiter does not occur in the value.

soliton- avatar Jun 15 '23 15:06 soliton-

@soliton- , The random values here are 15 bytes in length. That turns into 20 characters. It's a little tricky to work out the exact odds of a collision, because that depends on what you are delimiting. However, for any given 20 character sequence, the odds that you will produce a collision is 2-120. Sure, with a large file you get many attempts, but even if you have random base64 data, you need to have in the order of 260 bytes before the chance of a collision is meaningful. I don't know about you, but most people won't be including that much data. If you are sending that much data, increase the length of the delimiter by a few bytes.

martinthomson avatar Jun 16 '23 09:06 martinthomson

@martinthomson Normally you pick a delimiter that in principle cannot occur in the values in your specific workflow and you're done. If you absolutely must then pick the delimiter at random but there is no point in picking a different one each run. It just makes this example more complex and will make it all the more confusing if you get an error then and don't even know what the delimiter was.

soliton- avatar Jun 16 '23 10:06 soliton-