You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When Talisman finds an error in a file at the root level, and there is another file with the exact same name in a different folder, the suggest checksum to paste into .talismanrc will not cause the errors to be ignored when running Talisman again.
To Reproduce
Steps to reproduce the behavior:
Create a repo that contains a child folder, create an empty file under that folder (e.g. README.md)
Make a commit
Create a file with the same name (e.g. README.md) at the root level. Include a sensitive pattern in this file.
Run the Talisman pre-commit hook, it will report an error related to the sensitive pattern and output the following:
If you are absolutely sure that you want to ignore the above files from talisman detectors, consider pasting the following format in .talismanrc file in the project root
fileignoreconfig:
- filename: README.md
checksum: <someChecksumString>
Paste the suggested fileignoreconfig into .talismanrc
Run the Talisman pre-commit hook again, it will report the same error and suggest the same fileignoreconfig even though you have already added this in .talismanrc
Expected behavior
Pasting the suggested fileignoreconfig into .talismanrc should cause the errors to be ignored.
Likely cause
The checksum suggested by Talisman is for the individual file containing the sensitive pattern. When checking for whether a file should be ignored, the file name in .talismanrc is treated as a pattern and matched to both README.md and child/README.md.
If you run talisman --checksum README.md, it will output a different checksum string to the one generated above. Putting this different checksum into .talismanrc will cause the error to be ignored, which is the correct behavior. This indicates there's a mismatch relating to the checksum being generated.
The text was updated successfully, but these errors were encountered:
Hi @wf-anniezhou , thanks for taking the time to submit a detailed issue.
I believe this could be duplicate or side-effect of #342.
When talisman chooses to read a file, it uses the full the path relative to the root of the repository. This makes it highly unlikely that talisman is mixing 2 separate files in the same repository.
@svishwanath-tw that's an interesting theory. I'm not sure if it is related, in this case there's no dirty file that's not in the commit, and I do not see faulty checksums where there are no duplicate file names.
Another thing I noticed while looking through the source code is there's logic for calculating the collective checksum for files based on patterns (i.e. wildcards), hence the theory that the matching for file name may be pattern based rather than path specific.
@wf-anniezhou : Please check if the latest version of talisman fixes this issue. Closing it for now. If you think it still exists. Please re-open the issue.
Describe the bug
When Talisman finds an error in a file at the root level, and there is another file with the exact same name in a different folder, the suggest checksum to paste into
.talismanrc
will not cause the errors to be ignored when running Talisman again.To Reproduce
Steps to reproduce the behavior:
child
folder, create an empty file under that folder (e.g.README.md
)README.md
) at the root level. Include a sensitive pattern in this file.fileignoreconfig
into.talismanrc
fileignoreconfig
even though you have already added this in.talismanrc
Expected behavior
Pasting the suggested
fileignoreconfig
into.talismanrc
should cause the errors to be ignored.Likely cause
The checksum suggested by Talisman is for the individual file containing the sensitive pattern. When checking for whether a file should be ignored, the file name in
.talismanrc
is treated as a pattern and matched to bothREADME.md
andchild/README.md
.If you run
talisman --checksum README.md
, it will output a different checksum string to the one generated above. Putting this different checksum into.talismanrc
will cause the error to be ignored, which is the correct behavior. This indicates there's a mismatch relating to the checksum being generated.The text was updated successfully, but these errors were encountered: