Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A successful lookup is not proof that you got the object you intended. Check the returned record’s canonical ID against the ID you requested; for a Git object, recompute its object ID from the bytes; and treat an ETag as a validator for a representation, not as proof of application-level identity. These checks answer different questions, so the right one depends on what your code needs to trust.

Why can a lookup succeed but return the wrong object?

A lookup can accept an input that is incomplete or interpreted differently than the caller expects. The server may still return a valid object and an HTTP 200 response. That status says the request succeeded according to the server; it does not, by itself, prove that the response matches the caller’s intended identity.

In an article published October 1, 2026, DEV Community author howcani howcani reports examples involving an ETag that changed when nested response data changed, a Git object ID recomputed from commit bytes, and shortened comment IDs that returned different records. These are the author’s reported reproductions, not independently verified prevalence data. Read the reported examples.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does an ETag identify a resource or its response?

An ETag is a validator associated with a representation. It is useful in conditional requests: a client can send a previously received validator and the server can indicate whether the requested representation has changed. It does not automatically assert that an application-level entity is the one the caller meant, nor does an ETag change necessarily mean the top-level record changed.

#1 Best Overall
Yubico - Security Key C NFC - Basic Compatibility - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key C NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key C NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key C NFC via USB-C and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

The author reports that a comment response’s ETag changed between September 29 and September 30, 2026, after a reply was added to a children array, while the comment body itself had not changed. That example suggests the validator tracked the returned representation including descendants. It is specific to the reported API response; other APIs may construct representations and validators differently.

Git’s HTTP protocol documentation says servers may send ETag and/or Last-Modified headers, and clients may make conditional requests. When a client receives 304 Not Modified, it treats the response as equivalent to 200 by reusing the cached entity. A 304 therefore supports reuse under cache revalidation semantics; it does not independently validate an application’s intended object identity. Git HTTP protocol documentation.

GitHub’s REST API guidance similarly describes 304 as indicating that the requested representation has not changed relative to a previously saved ETag or Last-Modified validator; other response headers may still differ. GitHub REST API best practices.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Yubico - YubiKey 5C NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5C NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5C NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5C NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

Decide which fields matter before acting on an ETag

If a decision depends only on the complete representation, a validator can help determine whether a cached copy should be reused. If the decision concerns a particular record, compare its canonical ID and the fields that matter to that decision. If nested fields such as replies can change independently of the parent’s body, decide whether those fields belong to the representation your application needs to validate.

How should an API client handle shortened identifiers?

Keep the identifier you requested and compare it with the canonical identifier in the returned record before accepting that record. If the API supports prefixes, do not assume every accepted prefix uniquely identifies the same object in every context. Treat a mismatch as a failed identity check, even when the server returned 200.

In the author’s reported example, /api/comments/3g4gi returned the requested comment, while /api/comments/3g4g and /api/comments/3g4 returned different comments with 200 responses. The shorter paths /api/comments/3 and /api/comments/zzzz returned 404. The post reports response sizes of 20,963 bytes and 8,021 bytes for two shortened-ID responses, and 1,151 bytes for the shorter-prefix example; these are measurements from that single incident, not representative statistics.

Rank #3
Yubico - YubiKey 5 NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-A or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5 NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5 NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5 NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

The practical guard is straightforward: retain the requested ID, parse the response’s canonical ID, and reject the result if it does not match the expected identity. If an API intentionally supports aliases or prefixes, encode that behavior explicitly rather than silently treating any successful response as a match.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do you verify a Git object ID?

For a Git object, calculate the object ID from the object bytes and compare it with the claimed ID. Git object IDs are content-addressed: the object’s type, size, and content contribute to its identity. Recomputing the ID checks the bytes you have rather than trusting the displayed or requested ID alone.

The article author reports that git rev-parse HEAD and git cat-file commit HEAD | git hash-object -t commit --stdin both produced 8e874c6217f7b713b81d14eef07e493a26ee51e9 in the example repository. This is an example output reported by the author, not a universal ID or independent reproduction.

Rank #4
Yubico - Security Key NFC - Basic Compatibility - Multi-Factor Authentication (MFA) Key, Connect via USB-A or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key NFC via USB-A and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.
  1. Resolve the commit you intend to inspect and record its reported ID, for example with git rev-parse HEAD.

  2. Read the commit object bytes and hash them as a commit with git cat-file commit HEAD | git hash-object -t commit --stdin.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  3. Compare the resulting ID with the expected commit ID. A mismatch means the bytes you hashed do not correspond to that expected commit object.

    Best Value
    FIDO2 U2F Security Key Passkey Two-Factor Authentication (2FA) USB Key PIN+Touch (Non-Biometric) USB-A Type TrustKey T110
    • Security Key : Protect your online accounts against unauthorized access by using FIDO2 and U2F authentication with T110. It's the world's most protective security key that works with windows, Mac OS, Linux as well as Chrome, Firefox, Edge and many other major browsers.
    • Certified with the new FIDO2 standard, T110 provides the benefit of fast login and strong protection against phishing, account takeover as well as many other online attactks.
    • Works with : Bank of America, Github, Google, Microsoft, DUO, Twitter, Facebook, Dropbox, Apple, ebay, BINANCE, mor and more.
    • Fits USB-A port : Insert the T110 security key into the USB-A port of each service and log in conveniently with one touch
    • For the driver download and user guide, please visit TrustKey Solutions Home support page.

A verified commit is not a verified repository graph

A matching commit ID establishes the identity of that commit object’s bytes. It does not, by itself, establish that every object reachable from its tree or history has been checked. If your trust decision depends on the tree, blobs, parents, or a larger history, validate the relevant objects too. The scope of the check should match the scope of the claim.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What does a Git ref lookup establish?

A ref is a name that points to an object; resolving a name and validating an object’s bytes are distinct checks. Do not assume that a documented or intuitively plausible input form is accepted exactly as expected by every endpoint.

A GitHub Docs issue opened March 1, 2024 reports a discrepancy involving the get-reference endpoint: the reporter says the cited documentation described a commit SHA as accepted input, but their example received 404 for a SHA and succeeded with heads/main, while the corresponding commit endpoint returned the commit. That issue is evidence of a reported documentation/API ambiguity, not confirmation of current endpoint behavior or a live bug. Check the current endpoint documentation and inspect the actual response for the API version and request you use. GitHub Docs issue #31914.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which check should a pipeline use?

Check What it establishes What it does not establish
Compare requested ID with returned canonical ID Whether the returned record identifies as the record your application expected. Whether the record’s contents are authentic or unchanged.
Recompute a Git object ID from received bytes Whether those bytes match the claimed identity of that object. Whether every reachable object in a tree or history has also been validated.
Use an ETag or Last-Modified conditional request Whether a cached representation can be reused under the server’s conditional-request semantics. Whether the representation corresponds to the application-level entity you intended.
Check an HTTP status such as 200 or 304 Whether the request succeeded or the cached representation may be reused, respectively, under the protocol’s semantics. Whether the object identity or every relevant field meets your application’s requirements.

For a pipeline that needs reliable identity checks, retain the request input, inspect and compare the response’s canonical identity, and recompute IDs for content-addressed Git objects from the bytes being trusted. Define which representation fields matter before interpreting ETag changes. When cache freshness affects a decision, recording response age is a useful operational practice, though it is advice rather than a rule established by the protocol sources cited here.

The available sources provide a specific author-reported incident and protocol guidance, but no representative published statistic on how often these failures occur. Treat the examples as reasons to design explicit verification, not as a measure of their frequency.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.