Publish API examples with clearly identified placeholders or deliberately nonfunctional sample values. Keep real credentials, customer payloads, and environment-specific secrets out of code, screenshots, downloads, and generated references. If a real secret has already been exposed, treat its access authority separately from removing the visible text.
GitHub's sensitive data guidance says the first step for an exposed secret is revocation or rotation. Deleting one paragraph or rewriting a repository does not reliably remove every copy. The credential owner should lead the response under the organization's actual security process.
The documentation integrity review checks unauthorized instructions and provenance. This review concerns legitimate examples that accidentally contain access material. A helpful tutorial can still disclose a dangerous value.
Inventory every representation of the example
Start with the task and the fields it needs. Distinguish public identifiers, confidential identifiers, credentials, personal information, and harmless fictional values. Do not assume every long string is a secret or every short identifier is safe to publish.
Record the source snippet, generated language examples, downloadable collection, embedded playground defaults, screenshots, alt text, captions, and example response bodies. A central template may generate several representations with different escaping or substitution behavior.
| Element | Approved treatment | Acceptance |
|---|---|---|
| Authorization value | Explicit placeholder supplied locally by reader | No live token or misleading shared credential |
| Account identifier | Fictional value where the task permits | No unnecessary customer identity |
| Response record | Synthetic payload labeled as an example | No real personal or confidential data |
| Screenshot | Prepared demonstration environment | Same protection as the code example |
These are editorial categories, not a universal data-classification policy. Ask the authorized owner when a field's sensitivity is unclear.
Write a placeholder contract readers can follow
A placeholder should explain what the reader supplies, where they obtain it through the legitimate product process, and which permissions the task requires. It should not invite them to paste production secrets into a public form, issue, chat, or support comment.
For a fictional API, an example might use a label such as YOUR_TEST_TOKEN and state that it is not an actual credential. The accompanying instructions should identify the approved test environment and warn against publishing the reader's substituted value. Do not use a plausible token copied from a real account merely because it currently appears inactive.
Keep sensitive values outside publicly committed example files. If the implementation uses environment variables or another secret mechanism, explain that mechanism accurately for the actual language and runtime. Do not imply that naming a variable makes its value secure or prevents logs from exposing it.
The content acceptance brief should require a technical reviewer to confirm that the placeholder still leaves the example understandable. Removing every parameter can make the tutorial safe to publish but impossible to use.
Test substitutions and generated surfaces
Review the source before generation and inspect the final public output after generation. A documentation tool may copy environment values into rendered examples, include a request history, or generate a download from a different source than the visible code block. Verify the actual configuration instead of assuming all outputs inherit one redaction.
Use permitted synthetic fixtures for missing credentials, placeholder-only requests, and valid authorized test credentials held outside publication. Record what each fixture is intended to prove. A placeholder that fails authentication is normal; an example that claims it will succeed unchanged is misleading.
Inspect errors and logs produced during technical review. A failed request can echo a sensitive header or payload. Keep the review packet controlled and minimize what is retained. A screenshot of a successful response should not include the credential-bearing request panel.
Automated secret detection can support review, but its pass result is not proof of absence. Manual context review remains necessary for confidential fields, uncommon credential formats, generated examples, and image content.
Respond to exposure through the right owner
If a reviewer finds a real credential, stop its further distribution and notify the authorized security or credential owner through the established internal process. Preserve only the evidence needed for response, with appropriate access. Do not paste the full value into a broadly visible ticket to demonstrate the finding.
The owner should evaluate revocation or rotation, affected permissions, access logs, and the relevant incident obligations. This article does not authorize changing an account or issuing a replacement credential. Removing public text and restoring valid access for legitimate integrations are separate operational tasks.
GitHub's guidance explains that repository history, forks, clones, cached views, and pull-request references can complicate removal. Do not promise complete erasure after editing the current file. Use the platform's supported response and the organization's policy for the actual exposure.
Avoid casually rewriting shared history as an editorial fix. That operation has collaboration and repository consequences. The security and repository owners should decide the scope rather than a writer trying to clean up evidence alone.
Release a safe and truthful learning path
The final acceptance record should list each published representation, placeholder meaning, technical approval, sensitive-value check, and any exposure response reference. Keep actual secrets out of the receipt itself.
Use the prerequisite matrix to state roles, permissions, and supported data categories without revealing access material. Readers can assess whether they are authorized to perform the task before they create or use a credential.
Recheck examples when authentication, generated documentation, screenshots, or sample downloads change. A previously clean snippet can become unsafe if a build begins reading a developer's local environment.
Publish when the reader can complete the intended task through an authorized setup and the public example does not carry real access authority. That is a concrete editorial and technical acceptance decision; it is not a certification that the entire product or repository contains no secrets.
