Logo

dev-resources.site

for different kinds of informations.

Security Implication of Giving Examples

Published at
2/16/2024
Categories
writing
writingtips
technicalwriting
Author
richardfan1126
Categories
3 categories in total
writing
open
writingtips
open
technicalwriting
open
Author
14 person written this
richardfan1126
open
Security Implication of Giving Examples

In this post, I want to share my thoughts on giving examples in technical writing and the security implications behind it, no matter whether the impact is real or not.

Background

We will likely give examples when writing technical documents, formal or informal, from user manuals to personal blog posts.

And it's inevitable that the examples contain sensitive or even secret values.

There are many ways we deal with those values (e.g., redacting, modifying, etc.)

I also have many ways of dealing with them throughout my journey, but I slowly build my own convention.

And it all started with this Linkedin post:

AWS rolled back its managed IAM policy AmazonEC2ReadOnlyAccess, but it turned out it's because Scott Piper, Principal Cloud Security Researcher at Wiz, mistakenly thought the ec2:GetPasswordData permission allows users to get the EC2 instance password. And it's due to the poor example AWS gives in their documentation.

But instead of blaming AWS for their poor example, I think I should also formalize my own convention and get feedback from others.

What I am confident that we should follow

The following rules are those I'm pretty confident:

Do not use mosaic to hide secret

When we want to hide the secrets (i.e., password) on the screenshot, simply redact it with a solid box, DON'T use mosaic.

There are many techniques and tools available to reveal text under the mosaic.

You don't want to reveal your password through your blog post, so just redact it; don't trust the mosaic anymore.

Do not show a fake secret

If we want to show the secret on the screenshot or example code, without redacting it.

Do not make a confusing fake. Make it evident that it's a fake.

E.g., when we want to give an example of an OAuth token request call

Instead of using this:

https://example.com/v1/oauth/token?grant_type=authorization_code
  &code=b87c3c60ca2b54ae
  &client_id=9af83a008718df9b
  &client_secret=af8c86cb8bca211d
  &redirect_uri=https://example.com/callback
Enter fullscreen mode Exit fullscreen mode

Try using this:

https://example.com/v1/oauth/token?grant_type=authorization_code
  &code=b87c3c60ca2b54ae
  &client_id=9af83a008718df9b
  &client_secret=<your_client_secret>
  &redirect_uri=https://example.com/callback
Enter fullscreen mode Exit fullscreen mode

Or this:

https://example.com/v1/oauth/token?grant_type=authorization_code
  &code=b87c3c60ca2b54ae
  &client_id=9af83a008718df9b
  &client_secret=****************
  &redirect_uri=https://example.com/callback
Enter fullscreen mode Exit fullscreen mode

Although all 3 examples do no harm to ourselves because the client_secret are all fake.

But the readers with little knowledge of OAuth may not know that client_secret is something they shouldn't expose.

And by seeing us showing the secret in the example, they may just follow and show their REAL secret to others.

The other implication I believe is that, many people (including me) is generous to inform people when they find something sensitive is posted online (Not just technical stuff, I've DM many people on social media to take down the photos of their boarding pass).

If I message a blog owner to be careful of their secret and get a reply that it's fake. I would feel being fooled and may have less willingness to do the same thing next time, even though it may be the true secret.

What I am doing but you may have better options

The following rules are what I am following, but not quite sure if they are the best options.

You may argue that my reasons are wrong and have better options.

Use common pattern for personal values

This is similar to Do not show a fake secret, but for some personal data (e.g. AWS account ID, AWS resource ARN).

These data are not secrets, but we still don't want to expose them to the public.

We can use the same method as dealing with secrets, but it may make the example difficult to read.

So, I would use some common patterns to replace those data.

E.g., If I were to give an AWS CLI command example of creating an EC2 instance, I can write:

aws ec2 run-instances \
   --image-id <ami_id> \
   --subnet-id <subnet_id> \
   --instance-type <instance_type> \
   --key-name <key_pair_name>
Enter fullscreen mode Exit fullscreen mode

It's still useful, but if I use the following format, it would be more useful because the reader can understand the format of each value and find them more easily.

aws ec2 run-instances \
   --image-id ami-11111111111111111 \
   --subnet-id subnet-22222222 \
   --instance-type c5.xlarge \
   --key-name my-key-pair-01
Enter fullscreen mode Exit fullscreen mode

Dealing with encoded values

For encoded or even encrypted values, I still don't have a good option to make the example similar to the real one yet obvious to the reader that it's fake.

E.g., If I use the same method as dealing with secret values, I may write this:

password_b64: <your_password>
Enter fullscreen mode Exit fullscreen mode

But then the reader doesn't know it's a base64-encode value.

If I use the base64-encode <your_password>, like this:

password_b64: PHlvdXJfcGFzc3dvcmQ+
Enter fullscreen mode Exit fullscreen mode

Then, the users may not know it's a secret, and they shouldn't expose theirs.

So right now, what I would write is:

password_b64: <base64_encoded_password>
Enter fullscreen mode Exit fullscreen mode

If you have more explanatory options, please let me know.

Wrap up

These are just the rules I found easy for readers to understand yet not making security concerns.

I see many ways of making examples, even across AWS service teams.

I really hope we'll have a more standardized way of giving examples (especially when secrets are involved) on technical writing, like the one for Git commit message.

Please feel free to share your thoughts.

technicalwriting Article's
30 articles in total
Favicon
Organizing Information Properly in Technical Writing
Favicon
Using Active and Passive Voices in Technical Writing
Favicon
Comprehensive Guide to Using Jargon in Technical Writing
Favicon
Understanding the 4C’s in Technical Writing
Favicon
5 Key Skills Every Aspiring Technical Writer Needs in 2025
Favicon
Importance of Technical Writing and Its Process
Favicon
Technical Writing Guide: Introduction to Technical Writing and Its Tools
Favicon
Are technical writing agencies worth it?
Favicon
Beginning as a Technical Writer
Favicon
Content that Converts: The Ultimate Guide to Crafting High-Impact Cybersecurity Blog Posts
Favicon
Technical Writing Journeys: Share Your Path to Success!
Favicon
Step-by-Step Guide to Writing Your Project’s Technical Document
Favicon
Calling all Technical Writers!
Favicon
Principles that Guide Technical Writing
Favicon
InversifyJS: Managing Dependencies in Node.js Applications
Favicon
How AI is Revolutionizing Technical Writing
Favicon
The Future of Technical Writing
Favicon
Technical Writing Process for Absolute Beginners
Favicon
From Google Docs to Mkdocs: Reasons Behind Switching?
Favicon
From Concept to Content: A Beginner's Dive into Technical Writing
Favicon
Demystifying the Technical Writing Process: A Guide to Creating Clear and Effective Documentation
Favicon
Top 5 Technical Writing Communities of 2024
Favicon
Security Implication of Giving Examples
Favicon
2023 β€” A Year of Innovation and Growth for DocsKit
Favicon
Tech Blog on Your Site or on Medium / Dev.to?
Favicon
7 challenges in technical writing and how to overcome them
Favicon
Essential Documentation Categories
Favicon
The Ins and Outs of Using Markdown for Technical Writing
Favicon
Unlocking Your City's Secrets: Unveiling The Hidden Gems Through Mobile Apps
Favicon
How concept maps can help create clear and concise technical documentation

Featured ones: